Submit Catalog item Via Workflow run script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2023 02:26 PM
Hello All, need some help.
i am trying to submit another catalog item via current catalog form and i have all the variables mapped to the new form and after submiting current request its generating the new item with all the details except the RITM request.requested_for is not generating as per the variable requested_for.
Just need the Requested for Variable and RITM requested for should be same
var requestedFor = current.variables.requested_for;
var phonetype = current.variables.phone_system;
var dateneededby = current.variables.expected_start_date;
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
var item = cart.addItem('sys id of item', 1);
//fill in the variables on the request item form
cart.setVariable(item, "requested_for", requestedFor);
cart.setVariable(item, "need_by_date", dateneededby);
cart.setVariable(item, "type_of_phone_system", phonetype);
var rc = cart.placeOrder();
Tried to use this to Update Requested for but having Issues with other Item and notifications.
reqRecord.get(rc.sys_id); reqRecord.requested_for = requestedFor; reqRecord.update();
Can someone give another type of solution to get this done!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-27-2023 03:06 PM
Do you have a variable named requested_for on the Catalog Item that is getting submitted via the Cart API? If so, is that variable getting populated correctly, just like need_by_date and type_of_phone_system? Do you have something on the workflow for the original item or a Business Rule to populate the requested_for field on the REQ record from the requested_for variable? If the variable on the new item is getting populated, it seems like you would just need the same on the workflow of the new item to populate the field from the variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2023 05:58 AM - edited ‎10-30-2023 07:50 AM
Hi so the thing is i have 2 catalog items A and B. catalog A has few mandatory variables when those are filed then catalog B has to be submited after Manager approval. catalog B has its own workflow which has Manager approval and email notification.
Problem is i am able to use the above script in the workflow and auto submit the catalog B via catalog A. but the requested for is showing as opened by. so i used the Update() to update the RITM requested for with Variable requested_for. but the manager approval and email notifications are still going to opened by person not the RITM requested_for person.
i want to have a solution when catalog A is submited then catalog B should have current requested for as a variable requested for.