Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to input Order Guide variable data into REQ/RITM/SCTASK attribute field?

Jeremy F_
Giga Expert

Hello Community,

 

Any assistance would be appreciated. I need to post data coming from variables fields from an Order Guide, to an attribute on the REQ/RITM/SCTASK record form.

The variables are "hardware_delivery_date" or "hardware_delivery_date_urgent".

The attribute is "u_hardware_delivery_due_date".

Workflow:

JeremyF__0-1706559101214.png

Script A:

var gr = new GlideRecord('sc_request');

if (gr.get(current.request))  {

   gr.short_description = "Hardware Request for " + current.variables.requested_for.getDisplayValue();

    gr.assignment_group = current.assignment_group;

    gr.location = current.variables.requested_for.location;

    current.u_hardware_delivery_due_date = current.variables.hardware_delivery_date;

   gr.update();

   }

 

Script B:

task.short_description = "Hardware Request for " + current.variables.requested_for.getDisplayValue();

task.description = current.quantity.getDisplayValue() + " - " + current.cat_item.short_description.getDisplayValue();

task.u_order_number = current.variables.ornumber;

task.u_po_number = current.variables.ponumber;

task.location = current.variables.location;

task.u_hardware_delivery_due_date = current.variables.hardware_delivery_date;

//Set assignment group

if (current.variables.location != "") {

    var group = new GlideRecord('sys_user_group');

    group.addQuery('u_location', current.variables.location);

    group.query();

    if (group.next()) {

        task.assignment_group = group.sys_id;

    }

} else {

    task.assignment_group = "Solution Center"; // solution center group

    task.short_description = current.cat_item.getDisplayValue() + " for " + current.variables.requested_for.getDIsplayValue();

}

 

Order Guide:

JeremyF__1-1706559149931.png

 

Variables:

 

JeremyF__3-1706559198885.pngJeremyF__4-1706559204770.png

 

Attribute:

JeremyF__5-1706559222676.png

 

0 REPLIES 0