Scripting record producer submissions with catalog api
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2017 10:39 AM
I'd like to add records to the HR Case table in a business rule using a record producer set to an hr_case table.
var cart = new Cart();
var catItemGR = new GlideRecord("sc_cat_item");
catItemGR.addQuery("name", "Contractor Update");
catItemGR.query();
if (catItemGR.next()) {
var item = cart.addItem(catItemGR.sys_id);
cart.setVariable(item, 'opened_by', lv_user_obj.sys_id);
cart.setVariable(item, 'Select_the_contractor_you_wish_to_upd', lv_user_obj.sys_id);
cart.setVariable(item, 'email', lv_current.variables.reqfor_email);
cart.setVariable(item, 'change_end', lv_current.variables.change_end);
cart.setVariable(item, 'contractor_name', lv_user_obj.name);
cart.setVariable(item, 'contractor_email', lv_user_obj.email);
cart.setVariable(item, 'contractor_department', lv_user_obj.department);
cart.setVariable(item, 'contractor_supervisor', lv_user_obj.manager);
cart.setVariable(item, 'contractor_location', lv_user_obj.location);
var rc = cart.placeOrder();
gs.log(rc.number + " should be an HRC number","AMP");
}
Even though the Contractor Update is a record producer for the hr_case table, the above code submits a sc_request record instead.
Does anyone know if placeOrder needs to be specified so that the record is submitted to the correct table?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2018 09:40 AM
and you can script that? Is it easier that what you pointed to above?