Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Notification Email Client

VSN
Tera Expert

I need help with the email client,

my requirement is in employee form I have 2 fields employee location(list collector with choices), and location (string) fields.

if I select the Employee location field choice as "Other" then only I can see the Location field or else it should be hidden, for this one I choose UI policy and it works fine.

and I also designed a notification by adding all the fields, but I need same functionality as mentioned above. 

so for that, I used this email script logic:

 

var loc = ' ';

var gr = new gliderecord("table name");

gr.addquery('sys_id' , current.sys_id);

gr.query();

while (gr.next()) {

         loc=gr.getdisplayvalue("employee location field");

         var arr =loc.split(',');

         for (var i =0; i< arr.length; i++) {

              if(arr[i] == "other(employee location field-choice) {

                            template.print(current. string field name (location);

 

}

}

}

 

but if we select

1. employee location field choice other than it will work.[ex: Other]

2. employee location field choice other, any other choice it will work.[ex: Other, noida,pune]

3. employee location field choice any other choice, other than it was not working.[ex: noida, pune, Other]

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Anand Kumar P
Tera Patron

Hi @VSN ,

Use below script,

var loc = '';
var gr = new GlideRecord('table_name');
gr.addQuery('sys_id', current.sys_id);
gr.query();
while (gr.next()) {
    loc = gr.getDisplayValue('employee_location_field');
    var arr = loc.split(',');
    for (var i = 0; i < arr.length; i++) {
        if (arr[i].trim() === 'Other') {
            template.print(current.location);
            break;
        }
    }
}

Mark it helpful and solution proposed if it serves your purpose.

Thanks,

Anand

View solution in original post

1 REPLY 1

Anand Kumar P
Tera Patron

Hi @VSN ,

Use below script,

var loc = '';
var gr = new GlideRecord('table_name');
gr.addQuery('sys_id', current.sys_id);
gr.query();
while (gr.next()) {
    loc = gr.getDisplayValue('employee_location_field');
    var arr = loc.split(',');
    for (var i = 0; i < arr.length; i++) {
        if (arr[i].trim() === 'Other') {
            template.print(current.location);
            break;
        }
    }
}

Mark it helpful and solution proposed if it serves your purpose.

Thanks,

Anand