Need to display email script information in a table format for the notification?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2022 02:21 AM
Hi All,
I want to display to display email script information in a table format for the notification?, this notification basically trigger when fields(termination value , contract termination) changes
Email script :
if (event.parm2 == "contract_termination") {
template.print("Contract Termination changes from " + event.parm1 + " to " + current.u_contract_termination);
} else if (event.parm2 == "termination_value") {
template.print("Termination value changes from " + event.parm1 + " to " + current.u_termination_value);
} else {
template.print("Contract Termination changes from " + event.parm1 + " to " + current.u_contract_termination);
template.print('<br>');
template.print("Termination value changes from " + event.parm2 + " to " + current.u_termination_value);
}
Business rule:
if (current.u_contract_termination.changes() && current.u_termination_value.changes()) {
gs.eventQueue('cg_field_changes', current, previous.u_contract_termination, previous.u_termination_value);
}else if (current.u_contract_termination.changes()) {
gs.eventQueue('cg_field_changes', current, previous.u_contract_termination, "contract_termination");
} else if (current.u_termination_value.changes()) {
gs.eventQueue('cg_field_changes', current,previous.u_termination_value,"termination_value");
}
And we have one table format code actually so we need to implement that code to my script
Table code
Please help me to complete this
Thanks
Deepika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2022 02:30 AM
You can use the below tabular format in your email notification script and modify the code accordingly
template.print('<br />');
template.print('<table style="height: 23px;" width="100%"><tbody><tr><td style="background-color: #0e5399;"><font color="#FFFFFF"><strong>Details</strong></font></td></tr></tbody></table>');
var tbl = '<table style="height: 293px;" width="100%"><tbody>';
//template.print(tbl);
var tab = '<table style="width: 100%; border-collapse : collapse; " border = "2" cellpadding = "10"> <tbody>' +
'<tr>' + '<td style="background-color: #aeaeae;">' + '<b>Label_1</b>' + '</td>' +
'<td style="background-color: #aeaeae;">' + '<b>Label_2</b>' + '</td>' +
'<td style="background-color: #aeaeae;">' + '<b>Label_3description</b>' + '</td>' +
'<td style="background-color: #aeaeae;">' + '<b>Label_4</b>' + '</td>' +
'</tr>';
template.print(tab);
var clsed = '<tr>' + '<td>' + gr.getDisplayValue('field_1') + '</td>' +
'<td>' + gr.getDisplayValue('field_2') + '</td>' +
'<td>' + gr.getDisplayValue('field_3') + '</td>' +
'<td>' + gr.getDisplayValue('field_4') + '</td>' +
'</tr>';
template.print(clsed);
var tab_end = '</tbody> </table>';
template.print(tab_end);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2022 02:46 AM
Hi Sai Kumar
Thanks for the response
Basically for all our notifications we are using the table format code which i shared above, so here the confusion is actually for other notifications we glide the table from that we can get the value and that value comes into the row by gr.getDisplayvalue(" "):
But in my script we can get that values from business rule as you see above code which i share, a in the script based on condition i print the values
But now i need to implement my table code in the email script but ,so we not glide any table , how we pass the our value into row data , that is the concern for me
So can you please you how to implement my table code to email script?
Thanks
Deepika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2022 03:07 AM
Is your BR and Notification is on the same table?
If yes, Why don't you use the current object directly in the email script to set values in tabular code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2022 03:12 AM
Yes, both are in same table
can you please share sample script for that ,it will helpful to understand easily
Thanks
Deepika