PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 10/28/2020 3:36 PM by  Demi
results from AGS call
 12 Replies
 4 Subscribed to this topic
 77 Subscribed to this forum
Sort:
You are not authorized to post a reply.
Author Messages
Ragu Raghavan
Private
Private
Veteran Member
(1333 points)
Veteran Member
Posts:463


Send Message:

--
10/5/2017 3:31 PM

    For years I have been using this syntax to get the results from an AGS call:

     var sMsgNbr  = sAGSInfo.selectSingleNode("//MsgNbr").text;

    This seems to work only in IE. Gets an 'undefined' in Chrome and Firefox.

    This workaround seems to work on all 3 browsers.

     var vNew1 = sAGSInfo.getElementsByTagName("MsgNbr")[0];
     var vNew2 = vNew1.childNodes[0];
     var vNewMsg = vNew2.nodeValue;

    Joe O'Toole
    Private
    Private
    Veteran Member
    (808 points)
    Veteran Member
    Posts:314


    Send Message:

    --
    10/10/2017 9:11 PM

    Does anyone have sample DME and AGS call syntax that will work both in IE and Chrome?

    We just finished getting a custom form working in V10 on IE working around the JS and object behavior changes only to find that the DME and AGS calls are not working when users try to use it in Chrome.

     

    Thanks.

    Zachary Dever
    Infor/Lawson Consultant
    Southeast ERP
    New Member
    (4 points)
    New Member
    Posts:2


    Send Message:

    --
    10/11/2017 11:13 AM

    I recently ran into this same issue with a client.  The DME and AGS calls are working but IE11 stores the return data in a different spot than Chrome and FireFox.  

    The solution I used was to check the browser userAgent for IE and then pull from the correct location.  One thing we ran into with this was that the data from Chrome and Firefox needed to be trimmed of character-return/line feeds.

     

    var ua = navigator.userAgent; //ZD032717 - Update userAgent check to IE11(Trident)
    var trident = ua.indexOf('Trident/');

    if (trident > 0)
    {   
    vELcommentArray = vCols[0].firstChild.data;
    }
    else
    {
    var stringToReplace = vCols[0].firstChild.wholeText;
    vELcommentArray= stringToReplace.replace(/[\n\r]+/g, '');
    }

    Ragu Raghavan
    Private
    Private
    Veteran Member
    (1333 points)
    Veteran Member
    Posts:463


    Send Message:

    --
    7/30/2020 10:54 PM
    Zachary's post confirmed what I saw today: DME results different in IE Vs Chrome. Has anybody found a different solution? Thanks.
    John Henley
    Private
    Private
    Senior Member
    (9980 points)
    Senior Member
    Posts:3344


    Send Message:

    --
    8/7/2020 3:46 PM

    I have found that Chrome returns the columns as a huge array. So my solution is to increment a column index by the number of columns in the returned result set.

    Thanks for using the LawsonGuru.com forums!
    John
    Attachments
    ShawnV
    Private
    Private
    Advanced Member
    (81 points)
    Advanced Member
    Posts:37


    Send Message:

    --
    8/7/2020 8:00 PM

    Regarding DME conversion from IE to Chrome:

    Per an Infor post, you can store the individual 'record' in a new portalWnd.DataStorage and then pull off the individual columns using the .getElementCDataValue('COL', ).  I have attached a sample of before & after code for the DME data.

    However - going back to the original request, has anyone been able to fix the Design Studio code surrounding the .selectSingleNode("//MsgNbr" return from the AGS call to work in Chrome?

    Thanks - Shawn

    Attachments
    ShawnV
    Private
    Private
    Advanced Member
    (81 points)
    Advanced Member
    Posts:37


    Send Message:

    --
    8/7/2020 8:17 PM

    Sorry - I re-read the original post and found that RaguRagu had already found a solution for the sAGSInfor.selectSingleNode("//MsgNbr".text;

    Below is the before/after code I am using to get the results from the AGS call.  Before code works in IE only & After code works in both IE & Chrome.

    var sMsgNbr = sAGSInfo.selectSingleNode("//MsgNbr".text;

    var sMsgNbr = sAGSInfo.getElementsByTagName("MsgNbr"[0].childNodes[0].nodeValue;

    Is anyone doing this differently?  Is there there a better solution?

    Thanks - Shawn

    Ragu Raghavan
    Private
    Private
    Veteran Member
    (1333 points)
    Veteran Member
    Posts:463


    Send Message:

    --
    8/7/2020 9:05 PM
    Yes, the new AGS syntax works consistently with IE11, Edge. Chrome, Safari and Firefox. Bear in mind that if the nodeValue is null, the script just freezes.
    FldNbr, MsgNbr and Messsage are always populated, so not at issue. For instance MsgNbr will come across as
    219. Or if no error
    000

    I was interrogating a PA52 screen to see what the user entered value was: they had entered none, since there was no change to the field. The results came back as



    I had to put in some if/then logic to check for null, to bypass this.
    Scott Nalian
    Sr. Lawson Architect
    Palomar Health
    Basic Member
    (12 points)
    Basic Member
    Posts:4


    Send Message:

    --
    9/10/2020 4:46 PM

    I tried to incorporate your solution into my script with the getElementCDataValue('COL', 0) for Edge, I get the message that it is not a function when using the Devloper Console.
    What version of Design Studio is this API in. 

    Thank You for your help.

    Scott

     

    Ragu Raghavan
    Private
    Private
    Veteran Member
    (1333 points)
    Veteran Member
    Posts:463


    Send Message:

    --
    9/14/2020 1:58 PM
    I tested the AGS calls on Design Studio version 10.0.9.0.1232. However, I think the DME syntax you are trying was from ShawnV. He will need to confirm his version and if that syntax did work on Edge or just IE and Chrome.
    ShawnV
    Private
    Private
    Advanced Member
    (81 points)
    Advanced Member
    Posts:37


    Send Message:

    --
    9/14/2020 4:52 PM

    I was able to confirm in works in Edge.  We are on version 10.0.10.0.592.  I originally got the code from an Infor post and I believe the getElementCDataValue function was added somewhere in version 10. Not sure exactly what exact version.

    Demi
    Private
    Private
    Veteran Member
    (157 points)
    Veteran Member
    Posts:67


    Send Message:

    --
    10/21/2020 4:10 PM
    I have been reading through this post and I am curious if anyone has encountered any issues regarding the global variables defined within their DS forms. We are in the process of migrating our custom forms, needing them to work in both IE and Chrome. Although the forms appear to be working fine in IE, I am encountering issues when coding/testing in Chrome. I have several defined variables at the beginning of the code, prior to any defined functions; but their values are not populating globally. What I mean is... I populate their values... say in the OnBeforeTransaction function, but if the OnBeforeTransaction calls another function... say editValues, editValues does not recognize that the variable was populated in the OnBeforeTransaction and displays as blank. I know that I can pass the values from one function to another; but the globals are so much easier and serve a greater purpose to my needs. Has anyone else encountered this behavior? Could it be related to Zachary Devers' post from 10/11/2017 relating to the location of storage? We are also migrating our forms access from Lawson Mingle over onto Infor OS (within a wrapper) on a brand new platform. Forgive me if this last statement doesn't make sense ... I'm just trying to keep up with possible impacts as to what has happened to my variables.
    Demi
    Private
    Private
    Veteran Member
    (157 points)
    Veteran Member
    Posts:67


    Send Message:

    --
    10/28/2020 3:36 PM
    I discovered that the issues I was encountering with the global variables was not related to this in any way.
    You are not authorized to post a reply.