e-mail spaces between if statements that are not shown

 
Author
Message
Elite SysAider
190
 
Hi I was wondering what the command was to that there will be not a lot of white space in e-mails if a if command is now shown.



Like in the picture above we dont want to have such a big white space between them.
SysAid Community Manager Product Team
4490
 
Hi Spikeycloud,

Can you please post a code snippet configured for this email area, including the #if statements?

Thanks,
Danny
Elite SysAider
190
 
Danny Tashiev wrote:Hi Spikeycloud,

Can you please post a code snippet configured for this email area, including the #if statements?

Thanks,
Danny


I already changed it in the mean time but here's a part - and it is not finished yet.

#if( ${SubCategory}=="General")
==================AX incident details================================
<span style="font-size:15px"><strong>Title</strong></span></span>: ${Title}
<span style="font-size:15px"><strong>Department</strong></span></span>: General
<span style="font-size:15px"><strong>Problem type</strong></span></span>: ${AccountObj.getCustValues("sr_cust_genprobsr",$AccountObj.getResourceBundle()).getCaption($sr.getAddonFieldValue("CustomColumn1165sr"))}
<span style="font-size:15px"><strong>AX environment</strong></span></span>: ${AccountObj.getCustValues("sr_cust_axevsr",$AccountObj.getResourceBundle()).getCaption($sr.getAddonFieldValue("CustomColumn1156sr"))}

<span style="font-size:15px"><strong>Description</strong></span></span>

$Description

<span style="font-size:15px"><strong>What did the user do to solve the problem?</strong></span></span>: $sr.getAddonFieldValue("CustomColumn44sr")
<span style="font-size:15px"><strong>Urgency</strong></span></span>: ${Urgency}
<span style="font-size:15px"><strong>Scope</strong></span></span>: ${AccountObj.getCustValues("sr_cust_scope",$AccountObj.getResourceBundle()).getCaption($sr.getAddonFieldValue("CustomColumn4sr"))}
<span style="font-size:15px"><strong>New problem?</strong></span></span>: ${AccountObj.getCustValues("sr_cust_newprobsr",$AccountObj.getResourceBundle()).getCaption($sr.getAddonFieldValue("CustomColumn1122sr"))}
<span style="font-size:15px"><strong>Duration of problem</strong></span></span>: ${AccountObj.getCustValues("sr_cust_dursr",$AccountObj.getResourceBundle()).getCaption($sr.getAddonFieldValue("CustomColumn1121sr"))}

<span style="font-size:15px"><strong>How the problem is reproduced:
</strong></span></span> $sr.getAddonFieldValue("CustomColumn1157sr")

<span style="font-size:15px"><strong>Error notification:</strong></span></span>
</strong></span></span> $sr.getAddonFieldValue("CustomColumn1131sr")

#if( ${LinkToAttachments} && ${LinkToAttachments}!="" )
Attachments: ${LinkToAttachments}
#end
==================AX incident details================================
#end

#if( ${SubCategory}=="Qesh")
==================AX incident details================================
<span style="font-size:15px"><strong>Title</strong></span></span>: ${Title}
<span style="font-size:15px"><strong>Department</strong></span></span>: QESH
<span style="font-size:15px"><strong>Problem type</strong></span></span>: ${AccountObj.getCustValues("sr_cust_qesprobsr",$AccountObj.getResourceBundle()).getCaption($sr.getAddonFieldValue("CustomColumn1164sr"))}
<span style="font-size:15px"><strong>AX environment</strong></span></span>: ${AccountObj.getCustValues("sr_cust_axevsr",$AccountObj.getResourceBundle()).getCaption($sr.getAddonFieldValue("CustomColumn1156sr"))}

<span style="font-size:15px"><strong>Description</strong></span></span>

$Description

<span style="font-size:15px"><strong>What did the user do to solve the problem?</strong></span></span>: $sr.getAddonFieldValue("CustomColumn44sr")
<span style="font-size:15px"><strong>Urgency</strong></span></span>: ${Urgency}
<span style="font-size:15px"><strong>Scope</strong></span></span>: ${AccountObj.getCustValues("sr_cust_scope",$AccountObj.getResourceBundle()).getCaption($sr.getAddonFieldValue("CustomColumn4sr"))}
<span style="font-size:15px"><strong>New problem?</strong></span></span>: ${AccountObj.getCustValues("sr_cust_newprobsr",$AccountObj.getResourceBundle()).getCaption($sr.getAddonFieldValue("CustomColumn1122sr"))}
<span style="font-size:15px"><strong>Duration of problem</strong></span></span>: ${AccountObj.getCustValues("sr_cust_dursr",$AccountObj.getResourceBundle()).getCaption($sr.getAddonFieldValue("CustomColumn1121sr"))}

<span style="font-size:15px"><strong>How the problem is reproduced:
</strong></span></span> $sr.getAddonFieldValue("CustomColumn1157sr")

<span style="font-size:15px"><strong>Error notification:</strong></span></span>
</strong></span></span> $sr.getAddonFieldValue("CustomColumn1131sr")

#if( ${LinkToAttachments} && ${LinkToAttachments}!="" )
Attachments: ${LinkToAttachments}
#end
==================AX incident details================================
#end

#if( ${Category}=="IT-Hardware")
==================IT incident details================================
<span style="font-size:15px"><strong>Title</strong></span></span>: ${Title}

<span style="font-size:15px"><strong>Description</strong></span></span>

$Description

<span style="font-size:15px"><strong>Device ID</strong></span></span>: $sr.getAddonFieldValue("CustomColumn1082sr")

<span style="font-size:15px"><strong>What did the user do to solve the problem?</strong></span></span>: $sr.getAddonFieldValue("CustomColumn44sr")
<span style="font-size:15px"><strong>Urgency</strong></span></span>: ${Urgency}
<span style="font-size:15px"><strong>Scope</strong></span></span>: ${AccountObj.getCustValues("sr_cust_scope",$AccountObj.getResourceBundle()).getCaption($sr.getAddonFieldValue("CustomColumn4sr"))}
<span style="font-size:15px"><strong>New problem?</strong></span></span>: ${AccountObj.getCustValues("sr_cust_newprobsr",$AccountObj.getResourceBundle()).getCaption($sr.getAddonFieldValue("CustomColumn1122sr"))}
<span style="font-size:15px"><strong>Duration of problem</strong></span></span>: ${AccountObj.getCustValues("sr_cust_dursr",$AccountObj.getResourceBundle()).getCaption($sr.getAddonFieldValue("CustomColumn1121sr"))}

#if( ${LinkToAttachments} && ${LinkToAttachments}!="" )
Attachments: ${LinkToAttachments}
#end
==================IT incident details================================
#end

#if($sr.getAddonFieldValue("CustomColumn1131sr")!="" )
<span style="font-size:15px"><strong>Software error notification</strong></span></span>: $sr.getAddonFieldValue("CustomColumn1131sr")
#end
#if($sr.getAddonFieldValue("CustomColumn1137sr")!="" )
<span style="font-size:15px"><strong>Mobile number</strong></span></span>: $sr.getAddonFieldValue("CustomColumn1137sr")
#end
#if($sr.getAddonFieldValue("CustomColumn1135sr")!="" )
<span style="font-size:15px"><strong>Mobile phone type</strong></span></span>: $sr.getAddonFieldValue("CustomColumn1135sr")
#end
#if($sr.getAddonFieldValue("CustomColumn1136sr")!="" )
<span style="font-size:15px"><strong>Internal number</strong></span></span>: $sr.getAddonFieldValue("CustomColumn1136sr")
#end
#if($sr.getAddonFieldValue("CustomColumn1138sr")!="" )
<span style="font-size:15px"><strong>Printer ID</strong></span></span>: $sr.getAddonFieldValue("CustomColumn1138sr")
#end
#if( ${LinkToAttachments} && ${LinkToAttachments}!="" )
Attachments: ${LinkToAttachments}
#end
==================IT incident details================================
#end

==================Ticket details====================================
<span style="font-size:15px"><strong>Title</strong></span></span>: ${Title}
<span style="font-size:15px"><strong>Category</strong></span></span>: ${Category}
<span style="font-size:15px"><strong>Sub Category</strong></span></span>: ${SubCategory}
<span style="font-size:15px"><strong>Third Category</strong></span></span>: ${ThirdLevelCategory}
<span style="font-size:15px"><strong>User that submitted the ticket</strong></span></span>: $SubmitUser
<span style="font-size:15px"><strong>Ticket is requested on behalf of</strong></span></span>: $RequestUser
<span style="font-size:15px"><strong>IT admin</strong></span></span>: $AssignedTo
==================Ticket details====================================

This message was edited 2 times. Last update was at Oct. 16, 2017 06:14 AM

SysAid Community Manager Product Team
4490
 
Unless I'm missing something, or it was already fixed in the code, shouldn't the "AX Incident Details" line be also hidden of the #if statement returns false?
Elite SysAider
190
 
Danny Tashiev wrote:Unless I'm missing something, or it was already fixed in the code, shouldn't the "AX Incident Details" line be also hidden of the #if statement returns false?


The code is not finished yet - but it leaves a lot of spaces where they really should not be. I remembered reading somewhere that there is a command that removes the white spaces

This for an example


I don't want to have that white space in the e-mail

code:

A new ticket has been submitted: #$ID: $Title

#if( ${Status}=="Closed")
----------------------------------------------------------------------------------------------------------------------------------
<span style="font-size:15px"><strong>Solution</strong></span></span>: $Solution
----------------------------------------------------------------------------------------------------------------------------------
#end

#if( ${Status}=="Hardware rejected")
The hardware request has been rejected because of the following reason:

==================Reason of rejection===============================
${sr.getAddonFieldValue("CustomColumn1104sr")}
==================Reason of rejection===============================

You have received a new e-mail with a new link where you can request the correct hardware.
#end

#if( ${Status}=="Request Rejected")
This request has been rejected because of the following reason:

==================Reason of rejection===============================
${sr.getAddonFieldValue("CustomColumn1104sr")}
==================Reason of rejection===============================

You can submit a new request if nessary.
#end

#if( ${SubCategory}=="Finance")
==================AX incident details================================
<span style="font-size:15px"><strong>Title</strong></span></span>: ${Title}
<span style="font-size:15px"><strong>Department</strong></span></span>: Finance

This message was edited 3 times. Last update was at Oct. 16, 2017 06:26 AM

SysAid Community Manager Product Team
4490
 
What happens if you remove the line breaks between each #end and #if? If the system hides the content of these #if statements, it will still show the linebreaks between them.
Elite SysAider
190
 
Danny Tashiev wrote:What happens if you remove the line breaks between each #end and #if? If the system hides the content of these #if statements, it will still show the linebreaks between them.



That makes it a bit more acceptable it still takes the empty spaces within the if statements. But it is a bit better now.
SysAid Community Manager Product Team
4490
 
Just tested it myself and I understood the issue - since the linebreak comes before the #if statement, it remains even if the #if statement returns as false. The way to fix this is to start the #if statement on the previous line (without a linebreak).
Elite SysAider
190
 
Danny Tashiev wrote:Just tested it myself and I understood the issue - since the linebreak comes before the #if statement, it remains even if the #if statement returns as false. The way to fix this is to start the #if statement on the previous line (without a linebreak).

Ok thx - I will use this if the spaces get to far away. Your first solution does fine now but we never know what the future might hold lol.
SysAid Wiz
307
 
Hi all,
I didn't analyzed all the code, but if the problem it's only the white spaces you should add ## at the end of each line.
Your code as a normal indentation to read with ease, but in Velocity every "return carriage" is interpreted, so:

will return three blank line in your notification. While

it will "comment" the EOL without adding white spaces.

Hope it can help.
Bye!

This message was edited 1 time. Last update was at Oct. 16, 2017 08:05 AM

Elite SysAider
190
 
Tomaso wrote:Hi all,
I didn't analyzed all the code, but if the problem it's only the white spaces you should add ## at the end of each line.
Your code as a normal indentation to read with ease, but in Velocity every "return carriage" is interpreted, so:

will return three blank line in your notification. While

it will "comment" the EOL without adding white spaces.

Hope it can help.
Bye!


Thx!