Trouble with FORM_OnAfterTransaction

Sort:
You are not authorized to post a reply.
Author
Messages
Brian
Basic Member
Posts: 8
Basic Member

    I was wondering if someone could help me understand how the event FORM_OnAfterTransaction works.  We're trying to make a couple of changes to the AP20 screen to help streamline match invoice entry.  In many situations the only reason that an invoice doesn't match is the fact that a handling charge is off by a couple of cents.  I've added a couple of fields to the AP20 form so the AP user can see the amount of AOC setup on the PO and update with what came in on the invoice (without having to go over to the MA41.7 screen which is how it worked pre 8.0.3 MSP10).  We've setup the form so that it would do the following in the FORM_OnAfterTransaction event.

    1. Check to see that the transaction was a Match and that it wasn't a perfect match. 
    2. If the user was doing a match and it didn't match check to see if the AOC matches the PO.
    3. If the AOC doesn't match do an AGS call to MA41.7 to update the Invoice AOC.
    4. If #3 was sucessful then try to do another match (using AGS call).
    5. If #4 was sucessful then set the message (ie Match Complete) on the AP20 form and clear out some of the fields(voucher number, etc) so user can enter next invoice.

    Steps 1 -4 are working ok but when I try to set the message and clear the fields it isn't working.  It seems like FORM_OnAfterTransaction isn't really after the transaction completes...seems like after my Step #5 finishes Lawson then sweeps in and overwrites my message and the fields I tried to blank out.  Does anyone know a way around this?  Otherwise I will probably eliminate Steps 4 -5.  Is there a line of code that I need to put in that will stop the processing after step 5 (return false;? or something like that).

    thanks

    John Henley
    Senior Member
    Posts: 3348
    Senior Member
      What method are you using to clear the fields? Ate you clearing the "form" objects or the "data" objects, or both? Are you using the Lawson method to set the status message or setting it directly in the window object via HTML? You can put an alert() after you perform those steps and look at the screen and see if they are really clearing out and then getting repopulated. Lastly, there were a lot of recent changes on AP20 that actually added an Inquire AFTER the change, so you might want to look into that.
      Thanks for using the LawsonGuru.com forums!
      John
      Brian
      Basic Member
      Posts: 8
      Basic Member
        Thanks John,
        I was trying to use the Lawson method. I was initially just trying to clear a couple of fields to see if it would work (using the lawForm.setFormValue("text5",''); method). I was trying to set the message using the lawForm.setMessage(vMessage); method. I followed your suggestion and inserted an alert on my vMessage and it is coming up correctly, then I can see it briefly flash my message on the toolbar before Lawson overrides with the original transaction information. So it doesn't truly seem like its after the transaction (maybe 'after transaction but before screen update' is a better description of the event). I decided it was probably safer to put this as a seperate push button...that way user can still using the standard match function if they want to.


        thanks for the suggestions.
        John Henley
        Senior Member
        Posts: 3348
        Senior Member
          You might want to put in an alert(fc) in FORM_OnBeforeTransaction to see if it is doing the inquire after the change...
          Thanks for using the LawsonGuru.com forums!
          John
          Gary Davies
          Veteran Member
          Posts: 248
          Veteran Member
            You could create a text field and display the message there instead.
            You are not authorized to post a reply.