Scenario: Looking to automatically add frequency code to pay period to reduce manual steps required for each payroll run.

Requirements: Access to Execute the SQL Query on the Vista Database.

Example Solution:

  1. Test this customization in a test environment before installing on your live environment.
  2. Edit the provided code to add the required frequency code, the example code adds A-Always to the pay period.
  3. Execute the SQL Script in SQL Server Management Studio.
  4. Test the script by adding a new pay period and checking the Active Frequency Codes tab for the automatically added frequency code.

SQL Query

CREATE TRIGGER [dbo].[ubtPRPCi] ON [dbo].[bPRPC] AFTER INSERT
    AS
    
     SET NOCOUNT ON
    
    BEGIN

   -- auto add Always Frequency Code
   INSERT dbo.bPRAF(PRCo, PRGroup, PREndDate, Frequency)
   SELECT i.PRCo, i.PRGroup, i.PREndDate, 'A'
   FROM INSERTED i
   WHERE NOT EXISTS (
        SELECT * FROM dbo.bPRAF 
        WHERE PRCo = i.PRCo 
        AND PRGroup = i.PRGroup 
        AND PREndDate = i.PREndDate
        AND Frequency = 'A'
        )

    END