- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2020 10:42 PM
I'm involved in developing a onboarding task which takes an excel sheet. There I have created a data source ( for excel in [sys_data_source]) which will be uploaded to a importset table from there the data is transformed to a staging table with the help of Transform Map. The staging table contains onbefore business rule that creates a cart item to populate an existing catalog item called onboarding.
My issue is once I create the cat item then try to set some Request variables (requested_for, description ) after executing ' cart.placeOrder() '. that does not work. Plesae explane why is it, and a work arround to set Request parameters.
var cart = new Cart();
var item = cart.addItem(itemsysid)
cart.setVariable(item, 'rr_id', current.u_rr_id);
cart.setVariable(item, 'irec_vacancy_id', current.u_irec_vacancy_id);
cart.setVariable(item, 'irec_status', current.u_irec_status);
cart.setVariable(item, 'applicant_id', current.u_applicant_id);
cart.setVariable(item, 'nationality', current.u_nationality);
cart.setVariable(item, 'location', current.u_location);
cart.setVariable(item, 'first_name', current.u_name_of_the_candidate);
cart.setVariable(item, 'name_in_upload_file', current.u_name_of_the_candidate);
cart.setVariable(item, 'name_of_the_candidate', current.u_name_of_the_candidate);
var rc = cart.placeOrder();
rc.description ="Created via Excel import"; // is not set
rc.requested_for=current.u_requested_by;// is not set
current.u_request_number=rc.number;
rc.update();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2020 11:06 PM
Hi,
why not create/set the variables during the creation itself?
why to update it later?
Are you willing to update the REQ record? if yes then update as below
var rc = cart.placeOrder();
var req = new GlideRecord('sc_request');
req.addQuery('number', rc.number);
req.query();
if(req.next()){
req.description ="Created via Excel import"; // is not set
req.requested_for = current.u_requested_by;// is not set
current.u_request_number=rc.number;
req.update();
}
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
11-08-2020 11:06 PM
Hi,
why not create/set the variables during the creation itself?
why to update it later?
Are you willing to update the REQ record? if yes then update as below
var rc = cart.placeOrder();
var req = new GlideRecord('sc_request');
req.addQuery('number', rc.number);
req.query();
if(req.next()){
req.description ="Created via Excel import"; // is not set
req.requested_for = current.u_requested_by;// is not set
current.u_request_number=rc.number;
req.update();
}
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
03-18-2021 04:21 AM
Hi Ankur,
How to set description in RITM form?
Please help
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2021 04:53 AM
Hi,
I posted solution to your question.
Please run, test and mark my response as correct and helpful.
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
11-09-2020 03:02 AM
Any update on this?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader