- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2018 12:16 AM
Hello...
Can i add if condition on email script? i have try it, but it not working. Maybe i do some mistake. I try to add condition based on variables value. i try to create like email script in below. but it is not working. I want to show jenis and otentikasi when value of Terkait hak akses is TRUE. But when I try this simple script. notification always show else condition. Help please.
(function runMailScript(current, template, email, email_action, event) {
template.print('<p><font size="4" color="#808080" face="helvetica"><strong>');
template.print(gs.getMessage('Detail ${cat_item} :'));
template.print('</strong></font></p>');
var Terkaithakakses = gs.getMessage('Terkait hak akses');
var Jenis = gs.getMessage('Jenis');
var Otenkasi = gs.getMessage('Otenkasi');
var Informasidurasi = gs.getMessage('Informasi durasi');
var Tanggalmulai = gs.getMessage('Tanggal mulai');
var Tanggalberakhir = gs.getMessage('Tanggal berakhir');
var terkaithakakses = gs.getMessage(': ${variables.hak_akses}');
var jenis = gs.getMessage(': ${variables.jenis}');
var otenkasi = gs.getMessage(': ${variables.otentikasi}');
template.print('<tr>');
template.print('<td><font size="3" color="#808080" face="helvetica">' + Terkaithakakses + '</font></td>');
template.print('<td><font size="3" color="#808080" face="helvetica">' + terkaithakakses + '</font></td>');
template.print('</tr>');
template.print('<tr>');
var ya, tidak;
if (gs.getMessage('${variables.hak_akses}') == 'true'){
ya = gs.getMessage(': Ya');
template.print('<td><font size="3" color="#808080" face="helvetica">' + Terkaithakakses + '</font></td>');
template.print('<td><font size="3" color="#808080" face="helvetica">' + ya + '</font></td>');
template.print('</tr>');
} else {
tidak = gs.getMessage(': Tidak');
template.print('<td><font size="3" color="#808080" face="helvetica">' + Terkaithakakses + '</font></td>');
template.print('<td><font size="3" color="#808080" face="helvetica">' + tidak + '</font></td>');
template.print('</tr>');
}
template.print('</table>');
})(current, template, email, email_action, event);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2018 01:03 AM
I'm using this if (current.variables.hak_akses == 'true'){. CURRENT. and its working. 😄 Thank you....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2018 12:57 AM
it still not working, Variable hak_akses is checkbox. and the value is TRUE FALSE.
I have been try if(variables.hak_akses== true), but its not working too. -.-"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2018 01:17 AM
try adding a statement to print eg: template.print('hak_akses = '+current.variables.hak_akses); or
gs.log('hak_akses = '+current.variables.hak_akses); to see what value it is printing. It should give you an idea.
Regards,
Udhay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2018 01:03 AM
I'm using this if (current.variables.hak_akses == 'true'){. CURRENT. and its working. 😄 Thank you....