We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

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

Hi Shivani,

This is the requirement:

Requirement:

  1. A request has to be created when ever email triggers to service now. So for that i have created an inbound action on request table
  2. later, my manager told me RITM is also required. So for that i have created a Business rule on request form, after -- insert and with some condition and in the Advanced part i am glide recording ritm table and inserting record into RITM table.
  3. Soon after doing this, i am calling a workflow using script.

Note: i am calling the workflow by giving the condition like,

if(current.u_request_type == 'User Disable')

{

//calling the WF here

}

Note again: Request Type(u_request_type) & Title(u_title) are the two custom fields created both on request and RITM forms. 

 

 

 

So in future, if the request type is something else, and i should call another workflow, then i can give the condition there and call the workflow. right?

Actually i got an idea, if i create a select box, then based on that selection of request type, then i can use switch condition in the workflow. right?

 

So please tell me how to achieve this in my office instance.

ANything else to discuss. mail me

sravanthisraz02@gmail.com

 

 

 

Regards,

Indup

Hi Indup,

 

Despite of logs, request is getting created along with RITM.

Inbound

find_real_file.png

Script

var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
var item = cart.addItem("<sysid of catalog item>");
current = cart.placeOrder();
current.<fieldname> = email.body.<tag>;
current.update();

 

Check in sc_request table, records should be created. Please deactivate BR, if it's still running.