- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2020 03:58 AM
Hello,
I have an integration of SN with a third system.
I have a field: "Number" in a record producer. On this field I have set a on change catalog client script. So, every time that this value changes a rest api call is made to see if the number exists on the third system (I call a script include and the script include makes the call).
If so, another field "Description" is auto-populated with the data received from the third system. On the other hand, if it does not exist, an alert box pops up.
When the user submits the form, I want the number and the description to be inserted as new record on a custom table. For this, I can make a catalog client script on submit and call a script include to insert the new record.
However, for making this work, I need to take the description value that is fetched on the onchange client script.
Is there any way to make the onChange catalog client script to communicate with the onSubmit catalog client script?
In other words, my onSubmit catalog client script needs data from the onChange catalog client script.
Any ideas??
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2020 06:21 AM
Hi,
it would take the latest value when your record producer script runs
So it would be 222 and BBB
var gr=new GlideRecord("u_custom_table");
gr.initialize();
gr.u_number = producer.number; // use valid number variable name here
gr.u_description = producer.description; // use valid description variable name here
gr.insert();
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2020 06:49 AM
Thanks Ankur!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2020 06:25 AM
Hey Student
Could You Please Help How did You configure the Rest One with Scripting ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2020 06:49 AM
Hey,
I have a onChange catalog client script on my record producer.
From this script I send some data from the form (for example, number field), to the script include. Inside my script include, I receive the data and send them to the third system using RESTMessageV2().
Then, I get the response from the third system on my script include and pass it back to the catalog client script.
That's the logic.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2024 01:37 AM
Can you pls give the exact coding ,if it is currently with you@student1