- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 02:21 AM
Hello there, I'm trying to figure out, if there is some reliable way of finding the WF Context in BR which has no relation to running WF or RITM.
The scenario:
I have a cat item which takes an xls file, uploads this file into data source, triggers the import into target table. There is a Wait for event action inside WF, this event needs to be triggered from onComplete transform script. Now how do I find the reference to the correct WF Context when I don't know the RITM id inside this onComplete script.
The reason is that I need to update some WF scratchpad values inside the onComplete script before the WF Wait for event action is triggered.
Right now I'm storing the RITM ID inside out internal config field, which is not acceptable:
getWfContext: function() {
var contextGR = null;
var wfContextGR = new GlideRecord("wf_context");
if (wfContextGR.get("id", this.gvsIntmUtils.getConfiguration("qualys_result.load_xls.current_ritm_id"))) {
contextGR = wfContextGR;
}
return contextGR;
}
Thank you for any help.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 02:41 AM
Hello,
If you are parsing that excel and running transform map through script after submission of catalog item you must be gliding sys_attachment table to get the attachment which is attached to that RITM that gets created after submission and copy that attachment from RITM to data source which will run the transform map
So if this is the process that you are following , we can glide to sys attachment table again with and get the RITM sys_id which is stored in table_sys_id field and use it in wf_context table
Not sure if this works but give it a try
Please mark my answer correct if it helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 07:52 AM
Share us the update if the solution works.
I am skeptical since in the onComplete transform script you can query sys_attachment with the data source associated with the current import set.
But the issue is when multiple users submit the catalog item then the query might fail to find the correct table_sys_id.
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
‎07-19-2022 02:26 AM
Hi,
why not handle this in the onComplete transform script itself?
I believe it would be difficult to know the RITM number in onComplete
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
‎07-19-2022 02:34 AM
Thank you, there are many other steps inside the WF which are dependent on those scratchpad values updated in the onComplete script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 02:48 AM
Hi,
I doubt you would know the RITM number in the onComplete script as there might be multiple users submitting the catalog item
If not then you can query RITM with your catalog item and pick the latest one.
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
‎07-19-2022 02:26 AM
Thank you for quick reply. The target table is custom table.