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-30-2017 02:09 AM
Hi Satheesh,
You can use below code as subject for your notification.
REMINDER: Action Required: ${document_id.item} was requested for ${document_id.requested_for}
provided you are setting up a new notification for RITM approvals. As item & requested_for would be only on RITMtable.
In the existing notification condition you can add Task Type is not RITM condition & for new one you can make selection as Task Type is RITM & then add the above subject.
If same subject is used for other approval notifications it would then show the result you get now as it would be able to locate any item field on Change/Enhancements or other tasks that require approval.
Also, the code for your subject does not work is the sysapproval field is an string field & not reference & hence dot walking does not work as desired.
Thanks,
Jaspal Singh
Hit Like or Correct on the impact of response.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2017 04:31 AM
Hi guys,
Thanks for the response, the problem is on some other part of code.