- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2022 12:13 AM
Hi All,
I have Record Producer. which has variable called Will you require IT's assistance for your meeting? or "it_requirement". It is multiple choice type with Values: Yes, No, Do not know.
If its variable value is 'yes' then I have to auto create a RITMXXXXXX with already created catalog item:
Requirement is:
- If Will you require IT's assistance for your meeting? = Yes a new catalog item is created with the following information:
- Item type: Can't Find What I Need (This is a catalog item existed)
- (Field on RITM) Requested for: Event Host (Employee Name) - variable in Record producer
- (Field on RITM) Due date: When is your event? (1st Choice) - variable in Record producer
- Assignment Group: SG_SN-IT-ServiceDesk Tier I
- State: Open
- Approval: Not Required
- Parent: WPS record created (show in Request Item form)
- Short Description: IT Assistance for {Event Type} for {Requested for}
- Area you need assistance with? Other
- Provide a short description of your request: Same as short Description
- Provide a detailed explanation and justification of your request:
- Reference {WPE #}
- Event Host:
- Event type:
- Event Format:
- Event Title Name:
- Event Description = Describe this event, including its purpose
- Event 1st Choice:
- Event 2nd Choice:
- Expected Number of Attendees:
- Requested Country:
- Other Requests/Notes:
Attached is the Catalog item form
Please help me how to proceed.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2022 02:34 AM
Hi,
you cannot set field using Cart API
So update as this -> you need to query RITM with the REQ sysId and then update the record
if (producer.it_requirement == 'yes') {
try {
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
//add your requested item to the cart by sys_id of the catalog item
var item = cart.addItem('ed8e941a1bee9010f5bef5f61a4bcb82', 1);
//fill in the variables on the request item form
cart.setVariable(item, "requested_for", producer.event_host);
cart.setVariable(item, "state", "1");
cart.setVariable(item, "due_date", producer.virtual_event_choice_1);
cart.setVariable(item, "assignment_group", "0a064b7f1b8bd410eda185d7cc4bcb3d");
cart.setVariable(item, "approval", "not_required");
var rc = cart.placeOrder();
gs.info(rc.number);
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('request', rc.sys_id);
ritm.query();
if(ritm.next()){
ritm.parent = current.sys_id;
ritm.update();
}
} catch (ex) {
gs.info(ex);
}
}
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
08-04-2022 12:29 AM
Hello Rekha,
what should happend if the answer is not "yes"?
If the Request should not create at all for this case you can write a catalog client script on Submit and there check if the answer is not "yes" and there block possiblity to submit the request.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2022 12:42 AM
HI Wojciech,
No, Actually Record Producer is creating record in u_workplace_service table.
This is record will always be created no matter what the value is for the variable.
Requirement is if variable value is "yes" in record producer form then RITMXXXXXX record should be created with above mapping mentioned.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2022 12:39 AM
Hi,
you can create RITM and REQ from script using Cart API
check this link where I shared solution; try to enhance it further
How to create scheduled job to auto generate RITM ticket every 2nd Tuesday of each month?
another link for your help
Create a RITM using cart api in scoped application.
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
08-04-2022 01:36 AM
Hi
Thanks for sharing link.
I was able to map all required fields to RITM but not able to give Record Producer record number in RITM parent field. Please suggest how to map?