1 of 1 people found this helpful
How many items do you have that may have a quantity amount?
If it's only a few you might as well use a nested if-expression with every parameter in your mail.
To get a list of all the Parameters you have to use the ForEachChild() function (see an example under kb 12854):
$(ForEachChild("ServiceReq#", RecId, "ServiceReqParam#", "ParameterName + ': ' + ParameterValue + '\r\n'", "CreatedDateTime ASC"))
Unfortunately you are not able filter out which child object(s) are to be shown.
But you can use the ReplaceRegex() function afterwards to replace all Parameter Values without values.
The Regex expression should be something like "/.*:\s\n/".
There are quite a few items on this request form. I give your suggestion a try. My other option is to configure it where we add the manager as the alternate contact and allow them to see the request in their 'My Items' list.
Add a new field to the Service Req object called ApprovalTxt - Text(max), as part of your RO workflow update this field using an update block and push in what ever data from the SRP's you need. Then call this field to you approval email. Gives fine control of the layout and the data. You can use this method to write the HTML fro a nice table to insert in the email if needed. With this solution I think you could even test the quantity values so only the positive ones get displayed.
That's a good idea too. What I'm really looking for is the same data that shows in the Parameters tab on the layout. That is done through a plugin though...
We use a similar approach as proposed by florian and alasdair with the following extension:
By sticking to a naming convention for the "internal" parameter name (i.e. the "Unique ID" specified for a service request parameter), we are able to filter out parameters that shall not be included in the "ParameterList" text field.
For example, using the following expression, only parameters and their values will be included as row in a HTML table, if their Unique ID does not start with the prefix "Hidden":
$("<table width='700' border='1' cellspacing='2' cellpadding='2'><tbody><tr><td width='25%'><b>Parameter Name</b></td><td width='75%'><b>Parameter Value</b></td></tr>" +
"if Find('Hidden', ParameterName) == 0 then EmptyString() else '<tr><td>' + (if nvl([ServiceReqTemplateParam#.]DisplayName, '') != '' then [ServiceReqTemplateParam#.]DisplayName else ParameterName) + '</td><td>' + (case DisplayType when 'textarea' then Replace(ParameterValue, '\r\n', '<br>') when 'list' then Replace(ParameterValue, '~^', ', ') when 'datetime' then FormatDate(ToLocal(DateTime(ParameterValue), 'Etc/UTC'), 'yyyy-MM-dd HH:mm') when 'date' then FormatDate(ToLocal(DateTime(ParameterValue), 'Etc/Utc'), 'yyyy-MM-dd') when 'time' then FormatDate(DateTime(ParameterValue), 'HH:mm') else ParameterValue) + '</td></tr>'",
"ParameterName ASC") +
To include only parameters with a quantity, you could then extend the condition within the "ForEachChild" expression to check for example, if the parameter name starts with "Qty" and the parameter value is not equal zero (although I think that parameters that have not been set when submitting the service request will not be created at all).