- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2020 06:23 PM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2020 09:01 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2020 06:35 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2020 08:15 PM
Hi Ankush,
This is returning the zone as "false" instead of the correct value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2020 08:09 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2020 08:36 PM
Hello Sudhanshu,
I am getting the error "zones is already defined"