Personnel Action Previous Values in a Flow

 7 Replies
 0 Subscribed to this topic
 52 Subscribed to this forum
Sort:
Author
Messages
Bob Canham
Veteran Member
Posts: 217
Veteran Member
    I am trying to write a process flow that will send out emails to employees based on a Status change that happens.  The email will be different depending on what the status changed from and to.  Does anyone have any ways of getting the previous value of an item in a personnel action?  I have tried using the PA66.3, but that isn't letting me parse well to get just the Status items.

    Thanks
    BarbR
    Veteran Member
    Posts: 306
    Veteran Member
      We do this all the time, but to get the previous values we simply query the employee data.
      Bob Canham
      Veteran Member
      Posts: 217
      Veteran Member
        What do you mean by query the employee data? Isn't the employee data the new values once the personnel action has been processed?
        John Henley
        Posts: 3353
          The values are stored in HRHISTORY. Assuming you are querying against tables, e.g. HRHISTORY or PERSACTHST, you will need to use platform-specific SQL to determine the previous value for a given field.
          Thanks for using the LawsonGuru.com forums!
          John
          Ragu Raghavan
          Veteran Member
          Posts: 476
          Veteran Member
            Query loop to HRHISTORY for the company+employee where fld_nbr = 20 and beg_date < beg_date of current status.
            The A_value from the most recent one will be the previous status. Maybe use conditional branch/assignment inside the loop to do this ?
            John Henley
            Posts: 3353
              Posted By Ragu Raghavan on 04/30/2012 01:34 PM
              Query loop to HRHISTORY for the company+employee where fld_nbr = 20 and beg_date < beg_date of current status.
              The A_value from the most recent one will be the previous status. Maybe use conditional branch/assignment inside the loop to do this ?

              That's not 100% accurate, as you can have multiple rows for the same beg_date with different seq_nbr.
              Thanks for using the LawsonGuru.com forums!
              John
              BarbR
              Veteran Member
              Posts: 306
              Veteran Member
                To clarify my response - I had assumed that your Personnel Action was work-flow enabled. When set up that way, your flow will kick off when the Personnel Action is entered and you can query employee data at that time since the PA hasn't yet finished processing, send your "before" and "after" email notifications, then let the Personnel Action process.
                If you aren't work flow enabled and your flow is looking at past actions - then the true, you would have to read the history tables.
                Bob Canham
                Veteran Member
                Posts: 217
                Veteran Member
                  Thanks for everyone's responses.  I was actually able to get the PA66.3 working.  This let me query on the actual action and let the Lawson application do the previous value logic.

                  Once I had the query response, I used Javascript to loop through the results and find the status field and pull the associated pre and new values.  Also because the screen only returns 12 results at once, there was re-querying logic built in to get subsequent pages of results until it finds the status.

                  result looping:
                  var n=0;
                  var fieldName = "";
                  var found = false;

                  for (n=0; n <= 11; n++) {
                      fieldName =     eval("Transaction3200_PAD_ITEM_NAMEr" + n);
                      if (fieldName == "Status"){
                          CurrentStatus = eval("Transaction3200_LOG_NEW_VALUEr" + n);
                          PreviousStatus = eval("Transaction3200_LOG_PRE_VALUEr" + n);
                          found=true;
                          break;
                      }
                  }