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.

Need full

poco
Tera Contributor

In record producer Variable I have one variable drop down variable name is "This the issue "

a resolved

b in progress

Suppose user select a

I want to set state of incident resolved And update the resolution code

Suppose user select b

I want to set state of incident is in progress In service now

i tried below script in record produce script field 

poco_0-1727462066753.png

 

please help me on this 
4 REPLIES 4

Mani A
Tera Guru

Write this in record producer script field

 

var issueState = producer.variables.this_issue_request_is;

var incidentGR = new GlideRecord('incident');

incidentGR.get(producer.varibales.inc); 

if (incidentGR.isValidRecord()) {

    if (issueState == 'Resolved') { 

        incidentGR.state = 6; 

        incidentGR.close_code = 'code'; 

    } else if (issueState == 'In Progress') {

        incidentGR.state = 2; 

}

    incidentGR.update();

poco
Tera Contributor

Not working 

Share your updated script and what is not working..have u added logs ?

poco
Tera Contributor

poco_0-1727879819601.png