Update HR11 User Fields from Portal?

Sort:
You are not authorized to post a reply.
Author
Messages
phanna@ghs.org
Basic Member
Posts: 4
Basic Member
    We need to allow employees to update a single user field on HR11 from Portal ESS. Can this be done?

    Can we use Javascript to make an AGS call to update the user field?
    If not, can we store the employee input on a file in some UNIX directory (by using Javascript) and later update via batch?
    (I am a Javascript novice).

    There is of course the Personnel Actions form in Portal, but this is available only to Managers.

    We are using Lawson Env 8.0.2.9, Portal 3.0.9.1, on a UNIX IBM AIX 5.2 machine.

    Thanks for any clues,
    Paul
    John Henley
    Senior Member
    Posts: 3349
    Senior Member
      In order to make AGS calls, you have to have a back-end form that does the work. Ironically, Lawson doesn't have one for the HR user fields. Check my article (see https://www.danalytics.co...archive/2005-12.htm) on using the Excel uploads for updating HR user fields, and you'll see an alternative to using HR11--creating your own back-end form (see my screen shot here: https://www.danalytics.com/guru/letter/archive/2005-12_files/addins6.gif)

      You would then need to modify whatever the HTML pages in ESS on which you wanted to display, capture and update the user fields. As part of that process, I wrote a utility JavaScript module (i.e. 'update_user_fields.js') which does AGS calls against the custom form.

      Hope that answers your question...
      Thanks for using the LawsonGuru.com forums!
      John
      phanna@ghs.org
      Basic Member
      Posts: 4
      Basic Member
        John,
        Thank you very much for your reply!
        Some questions arise.

        (1) Can one create a form (similar to your DA15.1) using Design Studio against HR11?
        (No doubt you have more intricate methods.)

        (2) Must the user enter key values? Or,
        can the form allow entry of one user field value only, without requiring the user to specify key fields?

        To be able to do that from ESS is basically what we need. Is it feasible?
        Alex Tsekhansky
        Veteran Member
        Posts: 92
        Veteran Member
          Hello, Paul!

          I respectfully disagree with John on the inability to do it via AGS calls. If it is possible to do it via some form or a combination of forms (including form transfer, inquiry-first tasks etc.), it CAN be done via AGS calls, potentially more than one though. I have implemented things in the past (admittedly, using the ideas of others :-)) that modify data in Lawson using "indirect" calls (e.g. the ones with function pair codes, inquiry first, form transfers etc).

          Moreover, if it can be done with Excel add-on in some way, you probably can do it with only 1 custom AGS call, that needs to be captured by a technique indicated in John's Excel add-on article (DEBUG switch on Portal works too).
          John Henley
          Senior Member
          Posts: 3349
          Senior Member
            Alex, it's quite alright to disagree with me--that's what I'm here for!

            BTW, I do agree that what Paul could be done via some AGS calls (which is how Excel ultimately does it). However, it would require a complicated AGS call (as well as a way [i.e. a DME call] to translate the field name to the field number). In the end, I think the COBOL form I offered as an alternative is a much more approachable solution. It can be called with either the field name OR number. And, since it's sitting on the back-end, it can be called either from AGS/Design Studio, ESS/MSS, and/or the Excel addins.
            Thanks for using the LawsonGuru.com forums!
            John
            John Henley
            Senior Member
            Posts: 3349
            Senior Member
              Paul,
              The technique I'm describing is a COBOL form on the application server that updates HRHISTORY. It can be called via AGS from Excel addins, as well as Design Studio, ESS/MSS, and Process Flow. One common misconception in the Lawson world is that Design Studio is the solution for everything...it can only be used to modify the Portal XML forms.

              The user would only key the "data" value, the "key" (company/employee/fieldname) would be coded in the ESS Javascript AGS call that invokes the form.
              Thanks for using the LawsonGuru.com forums!
              John
              phanna@ghs.org
              Basic Member
              Posts: 4
              Basic Member
                John,
                Thanks for the information.
                I have not been able to successfully code an AGS call from within a javascript.
                I know that we must have the COBOL form (like you described) in place first.

                But assuming we have such a form,
                how would I obtain the user's employee ID,
                and then format and invoke the AGS call in js?
                If only I had one good example ...
                Thank you for the help you've been so far.
                Paul

                John Henley
                Senior Member
                Posts: 3349
                Senior Member
                  Here's an example. This particular function is called with a field name/value pair, and adds the user field. It then transfers control to a function called DspMsgDA15().

                  It helps if you understand the JavaScript syntax and browser object model, such as the "parent" object. Also remember that JavaScript is case-sensitive. It also helps if you understand how ESS is put together and that there are certain functions and objects that are available in ESS (such as AGSObject) that are callable from JavaScript. When ESS loads in the browser, a number of variables get set in the "parent" object in the browser. "prodline", "employee" and "company" are examples of those variables.

                  function UpdateUserFieldA(myFieldName, myFieldValue)
                  {
                  var object = new AGSObject (parent.prodline, "DA15.1")
                  object.rtn ="MESSAGE"
                  object.longNames = true
                  object.tds = false
                  object.event ="ADD"
                  object.field = "FC=Add"
                  + "&HEU-EMP-APP=0"
                  + "&HEU-COMPANY=" + parseFloat(parent.company)
                  + "&HEU-EMPLOYEE=" + parseFloat(parent.employee)
                  + "&HRU-FIELD-NAME=" + escape(myFieldName)
                  + "&HEU-A-FIELD=" + escape(myFieldValue)
                  + "&ADD-OVERWRITE-FLAG=Y"
                  object.func = "parent.DspMsgDA15()";

                  // object.debug = true;

                  showWaitAlert("Updating Employee information - Please Wait")

                  AGS(object, "bnreturn")

                  }

                  function DspMsgDA15()
                  {
                  if (lawheader.gmsgnbr == 000)
                  {
                  removeWaitAlert()
                  }
                  else
                  alert(self.lawheader.gmsg)
                  }
                  Thanks for using the LawsonGuru.com forums!
                  John
                  phanna@ghs.org
                  Basic Member
                  Posts: 4
                  Basic Member
                    John,
                    What can I say? but thank you very much for taking time to assist so generously.
                    You have been a tremendous help.

                    I have already discussed the various tips you offered, here and elsewhere on your website, with my coworkers and supervisor.
                    Thanks again,
                    Paul
                    DarrylS
                    New Member
                    Posts: 1
                    New Member
                      John,

                      I am working on something related to this thread...

                      I am creating a Self Service screen that updates HR11 user fields. I am trying to get AGS Javascript to work to do this. I modified you JS example above and I am trying to get the following to work:

                      //function UpdateUserFieldA(myFieldName, myFieldValue)
                      //{
                      var object = new AGSObject (authUser.prodline, "HR11.1")
                      object.rtn ="MESSAGE"
                      object.longNames = true
                      object.tds = false
                      //object.event ="ADD"
                      object.event ="CHANGE"
                      //object.index = "heuset2"
                      //object.key = "58" + "=" + "0" + "=" +
                      //escape(parseInt(authUser.company,10)) + "=" +
                      //escape(parseInt(authUser.employee,10))
                      //object.field = "FC=Add"
                      //object.field = "FC=A"
                      object.field = "FC=C"
                      + "&HEU-FIELD-KEY=58"
                      + "&HEU-EMP-APP=0"
                      + "&HEU-COMPANY=" + parseFloat(authUser.company)
                      + "&HEU-EMPLOYEE=" + parseFloat(authUser.employee)
                      //+ "&HRU-FIELD-NAME=" + escape(myFieldName)
                      //+ "&HEU-D-FIELD=" + escape(myFieldValue)
                      + "&HRU-FIELD-NAME=UF-EMP-SMKR-CODE"
                      + "&HEU-A-FIELD=" + escape(updateValue) //Y or N
                      + "&ADD-OVERWRITE-FLAG=Y"
                      //+ "&XMIT-HREMP-BLOCK=1000000000"
                      //+ "&XMIT-REQDED=1"
                      + "&EFFECT-DATE=" + formjsDate(fmttoday)
                      object.func = "parent.DspMsgHR11()";
                      //object.func = "parent.DisplayMessage()";
                      object.debug = true;
                      showWaitAlert("Updating Employee information - Please Wait")
                      AGS(object, "jsreturn")
                      //}

                      Any recommendations?
                      Thanks,
                      Darryl
                      You are not authorized to post a reply.