Trigger PFI from Submit button on LM199

Sort:
You are not authorized to post a reply.
Author
Messages
amylynanderson
Advanced Member
Posts: 26
Advanced Member
    I am trying to use java to do this.
    I cannot find a variable that is unique enough to say it is a submit.
    The message on all transactions is submit
    The fc code is not set for a button.
    I know my ags call works but I only want it to happen when they submit the job.

    Any suggestions, Amy
    David Williams
    Veteran Member
    Posts: 1127
    Veteran Member
      Do you have Design Studio? If so, replace the Submit function with a function that will trigger ProcessFlow (using an AGS call to WFWK.1). The flow could run the job (pass userid and jobname to the flow) and then do whatever else you need the flow to do once the job is done.
      David Williams
      amylynanderson
      Advanced Member
      Posts: 26
      Advanced Member
        I have Design Studio that is what I was trying to write the java script in as FORM_OnAfterTransaction.
        When you say replace the submit function do you mean replace the action on the properties button?
        What would I replace it with? Why Type of function? Currently has FC=S which I have not clue why I cannot address the field.

        Thanks Amy
        David Williams
        Veteran Member
        Posts: 1127
        Veteran Member
          Replace the FC=S with the Function you developed to trigger the flow.
          David Williams
          amylynanderson
          Advanced Member
          Posts: 26
          Advanced Member

            function FORM_OnBeforeTransaction(fc)
            {
            // was the transaction successful?
            if (formState.agsError) return;
            // following an submit transaction, trigger flow
            if (fc == "S")
            {
            var vMessage="Lease PFI was Triggered";
            alert(vMessage);
            var s = portalWnd.AGSPath+"?_PDL="+
            "FOCUSQA&_TKN=WFWK.1&_EVT=ADD&_RTN=DATA&_LFN=ALL&_TDS=IGNORE"+
            "&FC=A&SERVICE=LMEXPIRING&WORK-TITLE=LM199TriggerLMEXPIRING"+
            "&_DELIM=%09&_OUT=XML&_EOT=TRUE";
            portalWnd.httpRequest(s);
            }
            return true;
            }

            FORM_OnBeforeTransaction()
            or
            FORM_OnBeforeTransaction(fc)
            error on page
            amylynanderson
            Advanced Member
            Posts: 26
            Advanced Member
              My main problem here too is FC is not initialized.  If I leave FC out completely it will execute everytime even it they inquire.

              I have a word doc with print screen but am not able to attach here

              Thanks Amy
              David Williams
              Veteran Member
              Posts: 1127
              Veteran Member
                Change the name of your function: function triggerMyFlow()
                Change the Action of your Submit button to Function and select your function.
                David Williams
                David Williams
                Veteran Member
                Posts: 1127
                Veteran Member
                  David Williams
                  amylynanderson
                  Advanced Member
                  Posts: 26
                  Advanced Member
                    That worked ... now I just need to figure out how to pass the jobname, user id and company to the PFI to webrun the job first. Thanks for you help.
                    David Williams
                    Veteran Member
                    Posts: 1127
                    Veteran Member
                      Add the variables to your Service and pass them in your AGS call:

                      var s = portalWnd.AGSPath+"?_PDL="+
                      "FOCUSQA&_TKN=WFWK.1&_EVT=ADD&_RTN=DATA&_LFN=ALL&_TDS=IGNORE"+
                      "&FC=A&SERVICE=LMEXPIRING&WORK-TITLE=LM199TriggerLMEXPIRING"+
                      "&VARIABLE-NAMEr0=USERID" +
                      "&VARIABLE-VALUEr0=" + lawForm.getFormValue("text1") +
                      "&VARIABLE-NAMEr1=JOBNAME" +
                      "&VARIABLE-VALUEr1=" + lawForm.getFormValue("text2") +
                      "&_DELIM=%09&_OUT=XML&_EOT=TRUE";
                      David Williams
                      amylynanderson
                      Advanced Member
                      Posts: 26
                      Advanced Member
                        thanks got the job working. But I do not want the flow to continue if the job goes into needs recovery or invalidate paramenters. I have the WAIT=true so at least it will wait until the job is done before continuing. What do I put in the success string field on the webrun to indicate success?
                        David Williams
                        Veteran Member
                        Posts: 1127
                        Veteran Member
                          I'm not sure. You could always Query the QUEUEDJOB table to make sure the job didn't go into Waiting status.
                          http://consultdavidw.blog...ou-would-use-to.html
                          David Williams
                          John Henley
                          Senior Member
                          Posts: 3348
                          Senior Member
                            Are you referring to a &WAIT=true parameter on jobrun.exe ?
                            Thanks for using the LawsonGuru.com forums!
                            John
                            amylynanderson
                            Advanced Member
                            Posts: 26
                            Advanced Member
                              NO, I am using that. The results to check if the job completed successful. How can I do that? The WAIT=true does not stay on the node when a job goes into Needs recovery or Invalid parms too. If either of these situation happen I do not want to go to the next node.

                              Thanks Amy
                              John Henley
                              Senior Member
                              Posts: 3348
                              Senior Member
                                Use David's query, after the jobrun, and branch accordingly.

                                Thanks for using the LawsonGuru.com forums!
                                John
                                amylynanderson
                                Advanced Member
                                Posts: 26
                                Advanced Member
                                  Just an FYI on what I did to solve my problem of verifying the report did not go into need recorvery or invalid parameters.
                                  I changed the webrun node to a syscommand node
                                  /bin/wtsubmit -v | grep | wc -l

                                  ERROR = Abnormal

                                  After this node I put a branch to test for outputData = 0 Job Completed Success outputData = 1 Job Needs Attention
                                  David Williams
                                  Veteran Member
                                  Posts: 1127
                                  Veteran Member
                                    Thanks, I'll try to remember that. It's good to learn new things.
                                    David Williams
                                    You are not authorized to post a reply.