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

Indup
Tera Expert

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

21 REPLIES 21

Apurva Malewad1
Kilo Guru

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

 

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:

find_real_file.png

............................................................................................................................................

Business Rule:

Table: Request 

after --- Insert

Script:

find_real_file.png

 

The workflow executed log was coming.

 

............................................................................................................................................

Work Flow Run script: (after Begin Activity) 

Note: workflow is on RITM

find_real_file.png

 

I tried with above commented lines also. But those logs are not getting executed. 

 

 

Please help me

 

 

 

Regards,

Indup

Hello,

Is there any catalog item which you want to raise via scripting or creating request without variables ?

Hi Shivani, There is no catalog item I want to raise. Just I want to get ritm number and requested for values in the workflow. My friend told me we can achieve this by calling service catalog API , create a dummy cat item with no variables and attach the workflow to it. But how to do that I am not aware of it Regards, Indup