Custom triggers for PA02

 6 Replies
 0 Subscribed to this topic
 52 Subscribed to this forum
Sort:
Author
Messages
John
New Member
Posts: 1
New Member
    Hello. I'm new to this. Has anyone ever created a custom trigger for processflow?
    Woozy
    Veteran Member
    Posts: 709
    Veteran Member
      Yes. There is an entire section in the ProcessFlow Developer Guide discussing custom triggers, so you should probably start there.
      Kelly Meade
      J. R. Simplot Company
      Boise, ID
      David Williams
      Veteran Member
      Posts: 1127
      Veteran Member
        If you also have Design Studio, it's a better method of creating triggers. Without DS you have to modify the COBOL code (user exit) and any program updates (via CTP, etc.) would require you to add the user exit code back in.
        David Williams
        Kyle Jorgensen
        Veteran Member
        Posts: 122
        Veteran Member
          Lawson delivered code will not overwrite user exits. We use them to trigger flows and 2 ESPs and MSPs have gone by without a hiccup.
          John Henley
          Posts: 3353
            Posted By David Williams on 08/27/2013 03:17 PM
            If you also have Design Studio, it's a better method of creating triggers. Without DS you have to modify the COBOL code (user exit) and any program updates (via CTP, etc.) would require you to add the user exit code back in.


            This is not correct. CTPs do not modify user exits, which make user exits the preferred way for crafting less-intrusive modifications.
            Thanks for using the LawsonGuru.com forums!
            John
            M Graham
            Veteran Member
            Posts: 32
            Veteran Member
              I created a custom process flow trigger for a PA02 "Add" function. Here is the COBOL code to create a custom process flow trigger in PA02 for an "Add" function using and 'end' User Exit:
              1. Create two 'END' User Exit files called "PA02EPD" and "PA02EWS" using the code below.
              2. You also need to set up a service in PF Admin called "PA02E.1_A" with service variables.
              You are welcome to contact me with any questions about it. Enjoy!

              PA02EPD code:
              ------------------
              ******************************************************************
              PA02ES1-TRANSACTION SECTION 20.
              ******************************************************************
              PA02ES1-START.

              IF (PA02F1-FC NOT = "A")
              GO TO PA02ES1-TRANSACTION-END.

              *-----------------------------------------------------------
              *Check if workflow is enabled for the service
              *-----------------------------------------------------------
              PERFORM 1000-OPEN-WORKFLOW-DB.

              INITIALIZE WFAPI-INPUT
              WFAPI-OUTPUT.
              IF (PA02F1-FC = "A")
              MOVE "PA02E.1_A" TO WFAPI-I-SERVICE.
              * IF (PA02F1-FC = "C")
              * MOVE "PA02E.1_C" TO WFAPI-I-SERVICE.
              MOVE PA02F1-POS-COMPANY TO WFAPI-I-CRITERION-1.
              MOVE PA02F1-POS-POSITION TO WFAPI-I-CRITERION-2.
              PERFORM 1000-WF-SERVICE.
              IF (WFAPI-O-RETURN-CODE NOT = ZEROS)
              GO TO PA02ES1-TRANSACTION-END.

              *-------------------------------------------------------------
              *Create work unit header
              *-------------------------------------------------------------
              INITIALIZE WFAPI-INPUT.

              MOVE WFAPI-O-SERVICE TO WFAPI-I-SERVICE.
              MOVE WFAPI-O-AGENT TO WFAPI-I-AGENT.
              MOVE WFAPI-O-PROCEDURE TO WFAPI-I-PROCEDURE.
              MOVE 1 TO WFAPI-I-WORK-PRIORITY.
              MOVE WFAPI-O-WORKUNIT TO WFAPI-I-WORKUNIT.
              MOVE WFAPI-O-FILE TO WFAPI-I-FILE.
              MOVE "POSSET1" TO WFAPI-I-OBJECT-NAME.
              MOVE PA02F1-POS-COMPANY TO WFAPI-I-KEY-VALUE(1).
              MOVE PA02F1-POS-POSITION TO WFAPI-I-KEY-VALUE(2).
              MOVE PA02F1-POS-EFFECT-DATE TO WFAPI-I-KEY-VALUE(3).
              MOVE SPACES TO WFAPI-I-WORK-TITLE.
              STRING "POSITION ADD - " PA02F1-POS-POSITION
              DELIMITED BY SIZE INTO WFAPI-I-WORK-TITLE.
              MOVE "Company" TO WFAPI-I-WORK-CATEGORY.

              INITIALIZE WFAPI-OUTPUT.
              PERFORM 1000-WF-CREATE-SETUP.

              *----------------------------------------------------------
              *Create work unit variables - Set 1
              *----------------------------------------------------------
              INITIALIZE WFAPI-INPUT.
              MOVE WFAPI-O-WORKUNIT TO WFAPI-I-WORKUNIT.

              MOVE "Company" TO WFAPI-I-VARIABLE-NAME(1).
              MOVE "S" TO WFAPI-I-VARIABLE-TYPE(1).
              MOVE PA02F1-POS-COMPANY TO WFAPI-I-VARIABLE-VAL (1).

              MOVE "Position" TO WFAPI-I-VARIABLE-NAME(2).
              MOVE "S" TO WFAPI-I-VARIABLE-TYPE(2).
              MOVE PA02F1-POS-POSITION TO WFAPI-I-VARIABLE-VAL (2).

              MOVE "Effect_Date" TO WFAPI-I-VARIABLE-NAME(3).
              MOVE "S" TO WFAPI-I-VARIABLE-TYPE(3).
              MOVE PA02F1-POS-EFFECT-DATE TO WFAPI-I-VARIABLE-VAL (3).

              MOVE "Function" TO WFAPI-I-VARIABLE-NAME(4).
              MOVE "S" TO WFAPI-I-VARIABLE-TYPE(4).
              MOVE PA02F1-FC TO WFAPI-I-VARIABLE-VAL (4).

              MOVE "Old_Supervisor" TO WFAPI-I-VARIABLE-NAME(5).
              MOVE "S" TO WFAPI-I-VARIABLE-TYPE(5).
              MOVE OLD-SUPERVISOR TO WFAPI-I-VARIABLE-VAL (5).

              MOVE "Old_Posit_Status" TO WFAPI-I-VARIABLE-NAME(6).
              MOVE "S" TO WFAPI-I-VARIABLE-TYPE(6).
              MOVE OLD-POSIT-STATUS TO WFAPI-I-VARIABLE-VAL (6).

              MOVE "Old_Process_Level" TO WFAPI-I-VARIABLE-NAME(7).
              MOVE "S" TO WFAPI-I-VARIABLE-TYPE(7).
              MOVE OLD-PROCESS-LEVEL TO WFAPI-I-VARIABLE-VAL(7).

              MOVE "Old_Department" TO WFAPI-I-VARIABLE-NAME(8).
              MOVE "S" TO WFAPI-I-VARIABLE-TYPE(8).
              MOVE OLD-DEPARTMENT TO WFAPI-I-VARIABLE-VAL (8).

              MOVE "Old_Salary_Class" TO WFAPI-I-VARIABLE-NAME(9).
              MOVE "S" TO WFAPI-I-VARIABLE-TYPE(9).
              MOVE OLD-SALARY-CLASS TO WFAPI-I-VARIABLE-VAL (9).

              INITIALIZE WFAPI-OUTPUT.
              PERFORM 1000-WF-ADD-VAR-SETUP.

              PERFORM 1000-PROCESS-FLOW.

              *----------------------------------------------------------
              *Release Work Unit
              *----------------------------------------------------------
              PERFORM 1000-WF-RELEASE-SETUP.

              PA02ES1-TRANSACTION-END.
              ******************************************************************
              PA02ES2-TRANSACTION SECTION 10.
              ******************************************************************
              PA02ES2-START.
              PA02ES2-TRANSACTION-END.
              ******************************************************************

              PA02EWS code:
              -------------------
              000100******************************************************************
              000200* PA02EWS *
              000300******************************************************************
              MG 01 PA02EWS.
              MG 02 OLD-POSIT-STATUS PIC 9(01).
              MG 02 OLD-PROCESS-LEVEL PIC X(05).
              MG 02 OLD-DEPARTMENT PIC X(05).
              MG 02 OLD-SUPERVISOR PIC X(10).
              MG 02 OLD-SALARY-CLASS PIC X(01).

              ------------------------------
              I also created a custom trigger for PA52.4 and posted the User Exit code in this forum post: https://www.lawsonguru.co...ft/6252/Default.aspx
              David Williams
              Veteran Member
              Posts: 1127
              Veteran Member
                I apologize for the wrong information on the user exit code being overwritten by a program update. I just wish I knew everything.
                David Williams