System fields are not populating from transform maps import.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 04:44 AM
I am creating case records from record producer.
I am calling cart api to place order from record producer. but it is populating only variables under variable editor but it is not setting assignment group or assigned ,comments to fields.
please suggest.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 06:00 AM
we are loading case data records which should call record producer for variables and import case records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 06:02 AM
For record producers, you should use https://developer.servicenow.com/dev.do#!/reference/api/vancouver/server/sn_sc-namespace/c_CatItem#C...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 06:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 06:26 AM
tried this
no luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 06:34 AM
cart API cannot set assignment group, assigned to etc
you need to explicitly update those
(function runTransformScript(source, map, log, target /* GlideRecord */ ) {
var item = gs.getProperty('sn_customerservice.record producer');
var sub = source.u_subject.getDisplayValue();
var des = source.u_description.getDisplayValue();
var num = source.u_number.getDisplayValue();
var x;
var acc;
var ref = new GlideRecord("sys_user"); //Replace sys_user with any reference table
ref.addQuery("email", source.u_contact); //Replace email with any unique field
ref.query();
if (ref.next()) {
x = ref.getValue('sys_id');
acc = ref.getValue('company');
var cart = new sn_sc.CartJS();
var item = {
'sysparm_id': item,
'sysparm_quantity': '1',
'variables': {
'short_description': sub,
'description': des,
'number': num,
'contact': x,
'request_type': source.u_request_type.getDisplayValue(),
'u_bma_updated': source.u_bma_updated.getDisplayValue(),
}
};
var cartVals = cart.addToCart(item);
var checkoutVals = cart.checkoutCart();
var parsedData = JSON.parse(checkoutVals);
var caseSysId = parsedData.request_id;
var gr = new GlideRecord("case table");
gr.addQuery("sys_id", caseSysId);
gr.query();
if (gr.next()) {
gr.assignment_group = ''; // give the group sysId here
gr.assigned_to = ''; // give the group member (user) sysId here
gr.update();
}
ignore = true;
}
})(source, map, log, target);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader