Solved

Possible to add #if #end clause in a table in a notification mail

  • 14 July 2023
  • 5 replies
  • 64 views

Badge +1

Hi,

 

Is it possible to add an @If statement in a table in a notification mail.

It keeps disappearing when I put one in?!

 

Kind Regards,

Rudi

icon

Best answer by alin.lupascu 18 July 2023, 10:43

View original

5 replies

Userlevel 3
Badge +1

Hi @JSR ICT,

 

It is possible to do so - Here is an example.

#if( ${Status}=="New" )

DO THIS

#end 

 

You can find more details about notifications here. If you still need assistance, do let me know what you’re trying to achieve and I can help.

Badge +1

Hi Alin,

 

I can do this outsite a table.

When doing this inside a table, this disappears after saving the notification?!

 

<table style="width: 80%; border: 1px solid black; border-collapse: collapse; height: 264px;"><tbody>
<tr style="background-color: #f0f9fc;">
<td class="styled-text3" style="height: 22px; width: 41.3074%;"><span style="color: #3d3e9a;"><strong>Title:</strong></span></td>
<td class="styled-text3b" style="height: 22px; width: 58.5535%;"><strong>${Title}</strong></td>
</tr>
<tr style="background-color: #95a5a6;">
<td class="styled-text4" style="height: 22px; width: 41.3074%;"><strong> </strong></td>
<td class="styled-text4" style="height: 22px; width: 58.5535%;">&nbsp;</td>
</tr>
<tr style="background-color: #f0f9fc;">
<td class="styled-text2" style="height: 22px; width: 41.3074%;"><span style="color: #3d3e9a;"><strong>Request time:</strong></span></td>
<td class="styled-text2b" style="height: 22px; width: 58.5535%;">${SubmitTime}</td>
</tr>
#if( ${Status}=="Solved" )
<tr style="height: 22px;">
<td class="styled-text3" style="height: 22px; width: 41.3074%;"><span style="color: #3d3e9a;"><strong>Solution:</strong></span></td>
<td class="styled-text3b" style="height: 22px; width: 58.5535%;">${Solution}</td>
</tr>
#end
<tr style="background-color: #f0f9fc;">
<td class="styled-text2" style="height: 22px; width: 41.3074%;"><span style="color: #3d3e9a;"><strong>Attachments:</strong></span></td>
<td class="styled-text2b" style="height: 22px; width: 58.5535%;">${LinkToAttachments}</td>
</tr>

</tbody>
</table>

Kind Regards,

Rudi

Userlevel 3
Badge +1

Hi @JSR ICT ,

 

You’ll need to move the #end after the table if the intent is to render the table only when the condition of Status = Solved is met. 

<!DOCTYPE html><html><head></head><body><p>#if( ${Status}=="Solved" )</p><table style="width: 80%; border: 1px solid black; border-collapse: collapse; height: 264px;"><tbody><tr style="background-color: #f0f9fc;"><td class="styled-text3" style="height: 22px; width: 41.3074%;"><span style="color: #3d3e9a;"><strong>Title:</strong></span></td><td class="styled-text3b" style="height: 22px; width: 58.5535%;"><strong>${Title}</strong></td></tr><tr style="background-color: #95a5a6;"><td class="styled-text4" style="height: 22px; width: 41.3074%;"><strong></strong></td><td class="styled-text4" style="height: 22px; width: 58.5535%;">&nbsp;</td></tr><tr style="background-color: #f0f9fc;"><td class="styled-text2" style="height: 22px; width: 41.3074%;"><span style="color: #3d3e9a;"><strong>Request time:</strong></span></td><td class="styled-text2b" style="height: 22px; width: 58.5535%;">${SubmitTime}</td></tr><tr style="height: 22px;"><td class="styled-text3" style="height: 22px; width: 41.3074%;"><span style="color: #3d3e9a;"><strong>Solution:</strong></span></td><td class="styled-text3b" style="height: 22px; width: 58.5535%;">${Solution}</td></tr><tr style="background-color: #f0f9fc;"><td class="styled-text2" style="height: 22px; width: 41.3074%;"><span style="color: #3d3e9a;"><strong>Attachments:</strong></span></td><td class="styled-text2b" style="height: 22px; width: 58.5535%;">${LinkToAttachments}</td></tr></tbody></table><p>#end</p></body></html>

 

Let me know if this is what you were looking for or you were referring to render something within the table itself when the condition is met. 

Badge +1

Hi Alin,

The intend is to only show the specific row in a table when the condition of Status = Solved is met.

When the condition is not Solved, we don’t have a solution yet, so no point in putting this in the table.

Kind Regards,

 

Rudi 

Userlevel 3
Badge +1

@JSR ICT 

 

The initial code it’s correct if you only want to display that section however the editor is changing the rendering when pasted in sysaid - unfortunately I do not have a solution for this yet. 

 

My recommendation is to have variables outside the table - you can take the default Template and change it to your liking. 

 

<!DOCTYPE html><html><head/><body>
<div style="background-color: #f8f8f8;"><br /><br /><br />
<table style="border-collapse: collapse; width: 700px; height: auto; background-color: #ffffff; border-style: none; margin-left: auto; margin-right: auto;">
<tbody>
<tr style="height: 27px;">
<td style="background-color: #00b074; height: 58px; width: 1694px;" colspan="6">
<p style="text-align: center;"><span style="font-size: 18pt; color: #ffffff;"> Service Desk Notification</span></p>
</td>
</tr>
<tr style="height: 40px;">
<td style="width: 187px; height: 80px;">&nbsp;</td>
<td style="height: 80px; width: 1357px;" colspan="4"><span style="font-size: 12pt;"> <strong style="color: #787993;">Hi ${ReqUser.FirstName},</strong> <br /></span><span style="font-size: 12pt;"> <strong style="color: #787993;">Here are the details regarding ${ServiceRecordType} <span style="color: #0645ad; font-size: 12pt;"><a style="color: #0645ad;" title="#${ID} - ${Title}" href="${SelfServicePortalURL}/servicePortal/SRview/${ID}">#${ID}</a></span> you submitted:</strong></span></td>
<td style="width: 150px; height: 80px;">&nbsp;</td>
</tr>
<tr style="height: 21px;">
<td style="width: 187px; height: 21px;">&nbsp;</td>
<td style="width: 1357px; height: 21px;" colspan="4"><span style="text-decoration: underline; font-size: 14pt;"><strong style="color: #787993; text-decoration: underline;">${Title}</strong> </span></td>
<td style="width: 150px; height: 21px;">&nbsp;</td>
</tr>
<tr style="height: 21px;">
<td style="width: 187px; height: 25px;">&nbsp;</td>
<td style="width: 318px; height: 25px;"><span style="color: #787993; font-size: 12pt;"> <strong>Admin group</strong> </span></td>
<td style="width: 358px; height: 25px;"><span style="color: #787993; font-size: 12pt;">${AssignedGroup}</span></td>
<td style="width: 325px; height: 25px;"><span style="color: #787993; font-size: 12pt;"> <strong>Status</strong> </span></td>
<td style="width: 356px; height: 25px;"><span style="color: #787993; font-size: 12pt;">${Status}</span></td>
<td style="width: 150px; height: 25px;"><span style="color: #787993; font-size: 12pt;"><strong> </strong></span></td>
</tr>
<tr style="height: 21px;">
<td style="width: 187px; height: 10px;">&nbsp;</td>
<td style="width: 318px; height: 10px;"><span style="color: #787993; font-size: 12pt;"> <strong>Assigned to</strong> </span></td>
<td style="width: 358px; height: 10px;"><span style="color: #787993; font-size: 12pt;">${AssignedTo}</span></td>
<td style="width: 325px; height: 10px;"><span style="color: #787993; font-size: 12pt;"> <strong>Priority</strong> </span></td>
<td style="width: 356px; height: 10px;"><span style="color: #787993; font-size: 12pt;">${Priority}</span></td>
<td style="width: 150px; height: 10px;"><span style="color: #787993; font-size: 12pt;"><strong> </strong></span></td>
</tr>
<tr style="height: 21px;">
<td style="width: 187px; height: 10px;">&nbsp;</td>
<td style="width: 318px; height: 10px;"><span style="color: #787993; font-size: 12pt;"> <strong>Request user</strong> </span></td>
<td style="width: 358px; height: 10px;"><span style="color: #787993; font-size: 12pt;">${RequestUser}</span></td>
<td style="width: 325px; height: 10px;"><span style="color: #787993; font-size: 12pt;"> <strong>Urgency</strong> </span></td>
<td style="width: 356px; height: 10px;"><span style="color: #787993; font-size: 12pt;">${Urgency}</span></td>
<td style="width: 150px; height: 10px;"><span style="color: #787993; font-size: 12pt;"><strong> </strong></span></td>
</tr>
<tr style="height: 21px;">
<td style="width: 187px; height: 10px;">&nbsp;</td>
<td style="width: 318px; height: 10px;"><span style="color: #787993; font-size: 12pt;"> <strong>Request time</strong> </span></td>
<td style="width: 358px; height: 10px;"><span style="color: #787993; font-size: 12pt;">${SubmitTime}</span></td>
<td style="width: 325px; height: 10px;"><span style="color: #787993; font-size: 12pt;"> <strong>Category</strong> </span></td>
<td style="width: 356px; height: 10px;"><span style="color: #787993; font-size: 12pt;">${Category}</span></td>
<td style="width: 150px; height: 10px;"><span style="color: #787993; font-size: 12pt;"><strong> </strong></span></td>
</tr>
<tr style="height: 21px;">
<td style="width: 187px; height: 13px;">&nbsp;</td>
<td style="width: 318px; height: 13px;"><span style="color: #787993; font-size: 12pt;"> <strong>Submit user</strong> </span></td>
<td style="width: 358px; height: 13px;"><span style="color: #787993; font-size: 12pt;">${SubmitUser}</span></td>
<td style="width: 325px; height: 13px;"><span style="color: #787993; font-size: 12pt;"> <strong>Sub category</strong> </span></td>
<td style="width: 356px; height: 13px;"><span style="color: #787993; font-size: 12pt;">${SubCategory}</span></td>
<td style="width: 150px; height: 13px;"><span style="color: #787993; font-size: 12pt;"><strong> </strong></span></td>
</tr>
<tr style="border-style: none; height: auto;">
<td style="width: 187px; height: auto;">&nbsp;</td>
<td style="width: 1357px; height: auto;" colspan="4">
<p style="line-height: 1.5;"><span style="color: #787993; font-size: 12pt;"> <strong style="color: #787993;">Description</strong> <br />${Description}</span></p>
<p style="line-height: 1;">#if( ${Solution} &amp;&amp; ${Solution}!="" )<span style="color: #787993; font-size: 12pt;"><strong>Solution</strong> </span></p>
<p style="line-height: 1;"><span style="color: #787993; font-size: 12pt;">${Solution}</span>#end <br />#if(${isClosedSR}==true &amp;&amp; ${LinkToSurvey} &amp;&amp; ${LinkToSurvey}!="" )<span style="color: #787993; font-size: 12pt;"><strong>Please fill out this Survey: </strong> ${LinkToSurvey}</span>#end</p>
<p>#if(${isClosedSR}==true &amp;&amp; ${ReopenSR}!="0" )<span style="color: #787993;"><span style="font-size: 12pt;"><strong>Click here if you would like to reopen this service record: </strong></span> </span><span style="color: #787993;"><span style="font-size: 12pt;">${ReopenSR}</span></span>#end</p>
<br />#if( ${IsNewSr}==true &amp;&amp; ${AfterHours} &amp;&amp; ${AfterHours}==true)
<p><span style="color: #787993; font-size: 12pt;"><strong style="color: #787993;">Helpdesk Operating Times</strong> </span> <br /><span style="color: #e03e2d; font-size: 12pt;"><strong>The Helpdesk is not active at the moment, your service record will be addressed during working hours.</strong></span> <br /><span style="font-size: 12pt; color: #787993;">$OperatingTimesTable</span>#elseif (${IsNewSr}==true) <br /><span style="color: #787993; font-size: 12pt;"><strong style="color: #787993;">Helpdesk Operating Times</strong> <br /></span><span style="font-size: 12pt; color: #787993;">$OperatingTimesTable</span></p>
<br />#end</td>
<td style="width: 150px; height: auto;">
<p><span style="color: #787993;"><span style="font-size: 14pt;"><strong> </strong></span></span></p>
</td>
</tr>
</tbody>
</table>
<p style="text-align: center;"><span style="font-size: 10pt;"> <span style="color: #95a5a6;">Help Desk Software by</span> <span style="color: #0645ad;"> <a style="color: #0645ad;" href="${SelfServicePortalURL}" target="_blank" rel="noopener">SysAid</a> </span> </span></p>
<table class="sysaidEditNotificationTable" style="border-collapse: collapse; width: 100%; border-style: none;" border="0">
<tbody>
<tr>
<td style="width: 98.3558%; border-style: none;">&nbsp;</td>
</tr>
</tbody>
</table>
</div>
</body></html>

 

Reply