Scriipt to initiate Release and Issue final

 4 Replies
 0 Subscribed to this topic
 12 Subscribed to this forum
Sort:
Author
Messages
Chris Ross
Basic Member
Posts: 6
Basic Member

    Can someone provide the scripte necessary to trigger a "Release" and then a "Issue final" in PO23 once you have successfully create a PO after you have selected the "Add" button in PO23?

    Terry P
    Veteran Member
    Posts: 234
    Veteran Member

      Made need to tweak this, but the general format is:

       

      function FORM_onAfterTransaction()
       {
          fc = tranMagic.FC
          tranMsg = lawForm.getMessage()
          if (fc == "A" && tranMsg == "Add Complete - Continue")
            {
                lawformDoFunction("R")
                   // put a check here to make sure the release worked
                lawformDoFunction("F")
                   // put a check here to make sure the issue final worked
            }
      }

       

      Chris Ross
      Basic Member
      Posts: 6
      Basic Member
        I can get the following to work:

        function FORM_onAfterTransaction()
        {
        fc = tranMagic.FC
        tranMsg = lawForm.getMessage()
        if (fc == "R" && tranMsg == "Release complete - continue")
        {
        lawformDoFunction("F")
        }


        But when I try this, it clears out the PO number before the release occurs and returns a message "Must inquire before using this function code" The PO is created and I can see that it is in an unreleased status in PO20.

        function FORM_onAfterTransaction()
        {
        fc = tranMagic.FC
        tranMsg = lawForm.getMessage()
        if (fc == "A" && tranMsg == "PO(s) created - all records selected")
        {
        lawformDoFunction("R")
        }
        }

        If I can get the release to work, I can string them together.

        Any thoughts?
        Robert
        Veteran Member
        Posts: 82
        Veteran Member
          Chris:

          So, are all of your required fields initialized in your PO23 before you fire the function code? If not, you will need to enforce it, the form is telling you that you are missing required fields.

          Question: Does the getMessage() method return the same string as data.selectSingleNode("//Messge").text which is used with the FORM_OnAfterTransaction(data) method? Also, using the logical equals operator "==" for exact string messages with embedded whitespaces is a little risky, make sure that is working properly, I use regex which I think are more reliable.

          My PO is fuzzy at this point, and I would need to better understand what you are trying to automate. Bear in mind that your Inquire may never be satisifed because you have to force the release. I not certain you can accomplish this within your script, but I might have a solution for that if I have all of this right.

          Regards,
          Robert.
          David Williams
          Veteran Member
          Posts: 1127
          Veteran Member
            If you're having problems getting the Release and Issue Final to work with the DoFunction you could simply do an AGS call against PO20 to Release and another to Issue Final.
            David Williams