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.

Populate incident description with record producer variables

AP30
Tera Expert

Hello,

I am looking to populate incident description based on the variable selected from the record producer. Currently, the script is working as it should but because I have several select box type variables for zone, I am not able to get others to populate in the description field except one zone

Script:

current.description = '\n Comment:     ' + producer.description + '\n Target is Located at: ' + producer.target + '\n Zone is:   ' + producer.red_zone;

What i am having issues with is populating the description field based on the selected zone. The above script works well for red_zone but i have green_zone, yellow_zone, blue_zone, white_zone and brown_zone and trench_zone and i want the description field to show when any of the other zones is selected. Please provide guidance

Thank you.

1 ACCEPTED SOLUTION

Pooja Mallikarj
Kilo Sage

Hi,

Try this.

var zones=' ';

if(producer.red_zone)

{

zones=zones+producer.red_zone;

}

if(producer.yellow_zone)

{

zones=zones+' '+producer.yellow_zone;

}

So on...

current.description = '\n Comment:     ' + producer.description + '\n Target is Located at: ' + producer.target + '\n Zone is:   ' +zones

 

Thanks,

Pooja M

 

View solution in original post

8 REPLIES 8

Var zones="";

if(producer.red_zone)

{

zones=zones+producer.red_zone+" ";

} if(producer.green_zone)

{

zones=zones+producer.green_zone+" ";

}

Check.this one.

Pooja Mallikarj
Kilo Sage

Hi,

Try this.

var zones=' ';

if(producer.red_zone)

{

zones=zones+producer.red_zone;

}

if(producer.yellow_zone)

{

zones=zones+' '+producer.yellow_zone;

}

So on...

current.description = '\n Comment:     ' + producer.description + '\n Target is Located at: ' + producer.target + '\n Zone is:   ' +zones

 

Thanks,

Pooja M

 

I have tried and it is working fine in my PDI.

Thanks Pooja, This worked fine.