Populate Catalog Item Variable with REST Call with Immediate Results Displayed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2017 09:13 AM
I have a REST integration that pulls in application names from a 3rd party into a custom SN table when the form loads using an onLoad catalog client script that references a script include. There is a variable on the catalog item that is linked to the names on the custom table so a user can pick from the list of names brought in from the 3rd party API.
The problem I'm having is that the variable only shows the results from the last call to the 3rd party application. For example, User 1 opens the form and the call brings in applications A, B, and C from the integration that performs the REST integration function onLoad. This user tries to select from the list in the variable, and it's empty.
User 2 opens the form and the call brings in applications D and E. User 2 tries to select an app from the variable list, and User 2 only sees A, B, and C from User 1's call, but not D and E from User 2's call.
And so on... it will always be one behind.
Thoughts?
Thanks!
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2020 09:20 AM
Howdy, yes! I'm so sorry for the delay in responses. Do you have a transform map set up? In the import table I just store the response in a field called payload and then do a field map script to pull out the value I want and then it gets mapped to the new record in the transform automatically, without using GlideRecord. Script example:
answer = (function transformEntry(source) {
var theData, obj, result, res, theMatch;
theData = source.payload;
obj = JSON.parse(theData);
result = obj.name;
res = result.match(/[^[]*/).toString();
theMatch = res.trim();
return theMatch; // return the value to be put into the target field
})(source);
Your transform map that uses a source script would look something like this:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2020 06:40 AM
Thank you,
Best regards,
Harriet