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

Ankush16
Kilo Guru

You can add if condition in your script and populate zoneflag variable.

if (producer.green_zone ==true|| producer.yelllow_zone ==true || producer.brown_zone ==true ){

var zone_flag=true;

}else{

zone_flag=false;

}

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

 

Hi Ankush,

This is returning the zone as "false" instead of the correct value

Sudhanshu Talw1
Tera Guru

if(producer.red_zone){ var zones=zones+producer.red_zone+" "; } if(producer.green_zone)

{ var zones=zones+producer.red_zone+" "; }

Check for every zone. At the end zone is: "Zone is:"+zones;

Assuming that you have selectbox for each zone.

If assumption is wrong please correct them.

Thanks 

Sudhanshu

Hello Sudhanshu,

I am getting the error "zones is already defined"