System fields are not populating from transform maps import.

Shruti Bhosale
Tera Contributor

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.

 

12 REPLIES 12

Kristen Ankeny
Kilo Sage

Where is the code that populates those fields? Is it in the "script" on the record producer, a business rule, or a flow? 

Shruti Bhosale
Tera Contributor

transform maps script.

Kristen Ankeny
Kilo Sage

can you outline the whole process? I'm not clear how transform map scripts are involved with scripting creating a record via record producer.

Shruti Bhosale
Tera Contributor
(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();
        ignore = true;
 



    }
})(source, map, log, target);