- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2017 11:13 PM
Hello Everyone,
i want to populate Requested By name under Email template, Requested For (u_req_for) is from RITM table which should be populated on Template i tried Select Variables which is present in the Template but i unable to find the Requested For name since the email template is written on Approval table.
Can anyone please help me out how to populate the RITM table field on Approval table ?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2017 04:09 AM
Rajesh feedbacks were helpful but you will still need to query the req_item table;
Please try this just for the fun somewhere on your code
<mail_script>
var ritm = new GlideRecord('sc_req_item');
if(ritm.get(current.sysapproval)){
var req_for = ritm.u_req_for.name;
template.print("Requested for :"+ritm.request.requested_for.name);
template.print("Requested by :"+ritm.u_req_for.name);
}
</mail_script>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 11:14 PM
That is the bad part. You will have to write the HTML code yourself. But do not fear. You can get it from the HTML editor.
Something like this
You begin with HTML. And you have switch to mail script whenever you need
<table>
<tbody>
<tr style="background-color: #bfbaba;">
<mail_script>
var ritm = new GlideRecord('sc_req_item');
if(ritm.get(current.sysapproval)){
var req_for = ritm.u_req_for.name;
template.print('<tr>');
template.print('<td><span style="color: #000080;">Requested for </span></td>');
template.print('<td><span style="color: #000080;">Requested for </span></td>');
template.print('</tr>');
template.print('<tr>');
template.print('<td><span style="color: #000080;">'+ritm.request.requested_for.name+' </span></td>');
template.print('<td><span style="color: #000080;">'+ritm.u_req_for.name+' </span></td>');
template.print('</tr>');
template.print("Requested by :"+ritm.u_req_for.name);
}
</mail_script>
<tr>
<td> </td>
<td> </td>
</tr>
<tr colspan="2" style="background-color: #bfbaba;">
<td><span style="color: #000080;"> Additional Comments</span></td>
<td> </td>
</tr>
<tr colspan="2" >
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 10:13 PM
Younes,
Thanks for your script it worked for me. I written the same script in Notification Scripting and i called the script name under Template and now it is displaying Requested For name..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2017 05:35 AM
Hi Irfan,
i hope your query is been Answered or else let me know if you need more help.
Please close this thread.
If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
If you are viewing this from the community inbox you will not see the correct answer button. If so, please review How to Mark Answers Correct From Inbox View.
Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke