how to save a catalog item value into a table form field

NewBiee
Tera Contributor

I have a requirement where I need to get values like description, category from my catalog item and save it in request (sc_request) form.

I tried writing a business rule for description field but I'm unable to pass values to the business rule from a catalog item.

Can anyone help me pass both description and category values.

screenshots:

find_real_file.png

 

find_real_file.png

find_real_file.png

Thank You.

8 REPLIES 8

Jaspal Singh
Mega Patron
Mega Patron

You need an After insert business rule on RITM (sc_req_item) table with below code.

(function executeRule(current, previous /*null when async*/ ) {

    var reqis = new GlideRecord('sc_request');
    reqis.addQuery('sys_id', current.request);
    reqis.query();
    if (reqis.next()) {
        reqis.description = current.variables.description1; //replace description1 with correct description variable name
        reqis.short_description = current.variables.category; //replace category with correct category variable name;
        reqis.update();
    }

})(current, previous);

no it is still not working

the fields are not showing any value (not even false or undefined) in both (sc_request) and (sc_request_item)

Did you replace correct variables above?

Can you share business rule conditions & screenshot. Apply logs for a check & confirm what you get in logs.

the previous code worked but the values didn't pass

the new code didn't work

i want the category and description values in sc_request table

BR with after insert 

find_real_file.png