Using the Submit button on a form to trigger an email

Sort:
You are not authorized to post a reply.
Author
Messages
ryand
Veteran Member
Posts: 51
Veteran Member
    In Design Studio, is there a way to add an "Assigned action" on RW100 or PA100 form? Currently, I see Add, Change, Delete, Inquire, Next, Previous, Validate Request.  I can send emails with Work Flow Enabled checked based on an Add action but I need notification of when the job is submitted. 

    Any ideas?
    David Williams
    Veteran Member
    Posts: 1127
    Veteran Member
      I suggest you read the status bar message for when the job is submitted and trigger ProcessFlow via an AGS call to WFWK. If you add the trigger based upon the Submit button then if the user cancels the job submission you will have sent your email in error.
      David Williams
      ryand
      Veteran Member
      Posts: 51
      Veteran Member

        Are you speaking of something similar to this i found in the DS User guide? That script below can trigger a process flow for an email notice?



        function FORM_OnAfterTransaction(data)

        {

        // was transaction successful?

        if (formState.agsError) return;

        sMsg = lawForm.getMessage();

        if (sMsg=="Add Complete - Continue")

        {

        var s =portalWnd.AGSPath+"?_PDL=LOGAN”+

        “&_TKN=WFWK.1&_EVT=ADD&_RTN=DATA&_LFN=ALL&_TDS=IGNORE”+

        “&FC=Add&SERVICE=ServiceName&WORK-TITLE=ServiceTitle”+

        “&_DELIM=%09&_OUT=TEXT&_EOT=TRUE";

        portalWnd.httpRequest(s);

        }

        }

        David Williams
        Veteran Member
        Posts: 1127
        Veteran Member
          Yes, I think the status message would be "Job Submitted" but that's what I'm suggesting.
          David Williams
          Gary Davies
          Veteran Member
          Posts: 248
          Veteran Member
            I don't like checking message text, can change.

            I would suggest change the Submit button action to a function called say SubmitJob, create the javascript function with the AGS call to WFWK then the last line of:

            lawformDoFunction("S")'
            ryand
            Veteran Member
            Posts: 51
            Veteran Member
              When i paste in the above script, i'm getting the error mssg on save of "unterminated string constant" Do I have to declare any variables to get this line to work? --> portalWnd.httpRequest(s);
              Gary Davies
              Veteran Member
              Posts: 248
              Veteran Member
                Make sure all your double quotes are correct, retype each of them.
                ryand
                Veteran Member
                Posts: 51
                Veteran Member
                  That did it. Thanks, now i can see that the double quotes came over differently when i pasted it in from the pdf.
                  ryand
                  Veteran Member
                  Posts: 51
                  Veteran Member
                    I'm getting an error now in portal "The value WFWK.1 is invalid for the parameter _TKN.

                    /servlet/Router/Transaction/Erp?_PDL=LOGAN&_TKN=WFWK.1&_EVT=ADD&.........."

                    I found a Lawson article id on this 558526.
                    ---------------------------------------------------

                    I created a custom program and it runs in Lawson Insight Desktop (LID), but I receive the following error in Lawson Portal:
                     
                    The value is invalid for the parameter _TKN
                     
                    How do I resolve this?

                    Resolution:  
                    To resolve this error, following these steps:
                     
                    1. Open a LID command line
                    2. Type pgmdef and tab down to the custom program
                    3. Enter F6 Define
                    4. Choose Program
                    5. Go down to Run Type and change it to Four G/L
                    6. Then recompile the program. 
                    7. Now try it in Portal again.
                    ---------------------------------------------------------------------------
                    I verified that it is type Four G/L and I recompiled it without errors.

                    My form in LID will work normally but it doesnt execute the ags code i inserted with Design Studio.
                    David Williams
                    Veteran Member
                    Posts: 1127
                    Veteran Member
                      WFWK is now in the application product line instead of the LOGAN product line.
                      David Williams
                      ryand
                      Veteran Member
                      Posts: 51
                      Veteran Member
                        Finally! It works when I do an inquire and look for that type of portal message but when I change the message i'm looking for to this 'Job Has Been Submitted' and submit it my alert is blank. There is a second box that comes up on that screen to submit it again that I think is stopping this process. How do I have my script look for the final after transaction message?

                        sMsg = lawForm.getMessage();

                        alert(sMsg)

                        if (sMsg == "Job Has Been Submitted")
                        {
                        ryand
                        Veteran Member
                        Posts: 51
                        Veteran Member
                          Thanks for your help David and Gary!

                          This is what i ended up using:


                          function FORM_OnBeforeTransaction(fc)
                          {
                          var vCompany=lawForm.getDataValueById("text4")
                          var vUpdate=lawForm.getDataValueById("select3")

                          if (vCompany == "1234" || vCompany == "0987" && vUpdate == "Y")
                          {
                          if (fc == "S")
                          {
                          var s = portalWnd.AGSPath+"?_PDL=TEST"+
                          "&_TKN=WFWK.1&_EVT=ADD&_RTN=DATA&_LFN=ALL&_TDS=IGNORE"+
                          "&FC=Add&SERVICE=test100&WORK-TITLE=test100email"+
                          "&_DELIM=%09&_OUT=TEXT&_EOT=TRUE";

                          portalWnd.httpRequest(s);
                          }
                          }
                          return true;
                          }
                          M Graham
                          Veteran Member
                          Posts: 32
                          Veteran Member
                            Rather than hard-coding the productline in the AGSPath ("?_PDL=TEST"), how can a variable be defined to store the productline? --Marcy
                            David Williams
                            Veteran Member
                            Posts: 1127
                            Veteran Member
                              Use the following to get the Product line that is set up on the User Profile.
                              var vProd = portalWnd.oUserProfile.getAttribute("productline")

                              You can then reference it in your AGS call
                              var s = portalWnd.AGSPath
                              + "?_PDL=" + vProd
                              David Williams
                              Gary Davies
                              Veteran Member
                              Posts: 248
                              Veteran Member

                                You don't have to store it to a variable first, you can just put:

                                var s = portalWnd.AGSPath + "?_PDL=" + portalWnd.oUserProfile.getAttribute("productline")
                                You are not authorized to post a reply.