Need to pass ritm field values to work flow which is calling from the script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2020 09:31 AM
I am creating a request from inbound action. And I am creating corresponding ritm using business rule. In the business rule after creating the ritm, I am calling a workflow which is on requested item table. There is only one run script activity in the workflow. In that run script activity, I want the ritm number and requested for values in a scratchpad variable. Workflow is triggering but the related ritm number and requested for is not coming . I checked with log messages also. Can someone help me here. It's a bit urgent
For my code, please see this link
https://community.servicenow.com/community?id=community_question&sys_id=b1745ecd1b946410305fea89bd4bcb41
Regards,
Indup
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2020 10:02 AM
Hi Indup,
I checked your code in above link you mentioned and I think one line change should be there as follow:
In your second line of code as you have written workflow on Request table and you are gliding RITM table so query should be like:
gr.addQuery('request',current.sys_id);
You were using wrong query as per my opinion.
Try this above query line on your 2nd line of code and then check if it works or not. Also I want to give you one suggestion here as you should use RITM table for workflow instead of Request which is the best practice that we follow.
If you have any questions, please let me know.
Please mark my answer as Correct/Helpful if it helps you to find the solution so that this thread can be closed to help others.
Regards,
Apurva

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2020 06:48 PM
HI Apporva,
Thanks for the reply.
My Workflow is on Requested Item(sc_req_item). I changed it, but even now its not working.
Point 1:
Created two string fields (u_request_type & u_title) on Request & RITM form.
Point 2:
Created an inbound action which creates a Request and then populates the required fields on request
Point:3
Created a BR to create an RITM for the above Request & in the same BR i am calling workflow using script.
Inbound Action:
............................................................................................................................................
Business Rule:
Table: Request
after --- Insert
Script:
The workflow executed log was coming.
............................................................................................................................................
Work Flow Run script: (after Begin Activity)
Note: workflow is on RITM
I tried with above commented lines also. But those logs are not getting executed.
Please help me
Regards,
Indup
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2020 07:11 PM
Hello,
Is there any catalog item which you want to raise via scripting or creating request without variables ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2020 07:16 PM