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-05-2020 01:55 AM
Hi Shivani,
This is the requirement:
Requirement:
- 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
- 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.
- 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-05-2020 10:24 AM
Hi Indup,
Despite of logs, request is getting created along with RITM.
Inbound
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.