Email notification --> subject is not displaying properly (Code is displaying as it is)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2017 02:00 AM
Hi,
I am trying send notifications based on user language . so i used the below code to change the subject of the email depending on the user language.
But what the problem now was , the subject is working fine for some notifications and not working fine some notifications. when i trigger the event manually everything is fine but when it is triggered automatically it throws the below error. Anyone suggest me to overcome this issue,
var getSub = subject_value.toString().split("${");
gs.log(getSub.toString());
var getEle = [] ;
for(var i=0;i<getSub.length ;i++)
{
if(getSub[i].indexOf('}')>=0)
getEle.push(getSub[i].toString().split("}")[0]);
}
getEle = getEle.toString().split(',');
var newElevalues = [] ;
var finalSubject = objSubjectBody[0] ;
for(var p=0;p<getEle.length;p++)
{
if(getEle[p] !="event.parm1" && getEle[p] !="event.parm2")
{ newElevalues.push(current[getEle[p]]);
if(getEle[p].toString().split('\.').length > 1)
{
var getDotWalked ="" ;
if(getEle[p].toString().split('\.').length == 2)
{
getDotWalked = current[getEle[p].toString().split("\.")[0]][getEle[p].toString().split("\.")[1]].getDisplayValue();
}
if(getEle[p].toString().split('\.').length == 3)
{
getDotWalked = current[getEle[p].toString().split("\.")[0]][getEle[p].toString().split("\.")[1]][getEle[p].toString().split("\.")[2]].getDisplayValue();
}
finalSubject =finalSubject.replace("${"+getEle[p]+"}",getDotWalked );
}
else
{
finalSubject =finalSubject.replace("${"+getEle[p]+"}",current[getEle[p]].getDisplayValue());
}
}
else{
if(getEle[p] =="event.parm1" )
{newElevalues.push(current[getEle[p]]);
finalSubject =finalSubject.replace("${"+getEle[p]+"}",event.parm1);}
else
{newElevalues.push(current[getEle[p]]);
finalSubject =finalSubject.replace("${"+getEle[p]+"}",event.parm2);}
}
}
email.setSubject(finalSubject);
Thanks,
satheesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2017 03:40 AM
Hi Satheesh,
I have an idea and hope it will be useful for you:
- Assume, you have created the notification under "sysapproval_approver" table
- In the subject, you have the script used the dot working ${sysapproval.cat_item.xxxx} and ${sysapproval.request.xxxx} ==> I think error here, because the "sysapproval_approver" table will reference to multi-table that extended from "task" table. I'm not sure these table have "cat_item" or "request" field (invalid field in some case).
You can try and verify the table of "approval for" field.
Hope it will help for you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2017 04:12 AM
Hi Satheesh,
Please make sure that the Notification is configured in the Approvals (sysapproval_approver) table. If not, then the Subject line won't make any sense as you are fetching as sysapproval.xxx.
I hope this helps.Please mark correct/helpful based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 08:16 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 11:04 PM
Hi ,
The subject line written by you indicates that you have created notification for table - sysapproval_approver.
I would suggest you to try once by replacing the subject line by -
REMINDER: Action Required: ${sysapproval.request_item.cat_item} was requested for ${sysapproval.request.requested_for}
Regards,
Tarleen