2 Replies Latest reply on Jun 11, 2018 12:38 AM by lgtandi

    Iteration of Service Request Parameters

    DTurner Expert

      This in the usual sense is not too difficult:

      $(ForEachChild("ServiceReq#", RecId, "ServiceReqParam#.", "ParameterName + ': ' + ParameterValue + '\r\n'"))

       

      The problem I'm facing is that I would like to use the ParameterDisplayName which lives under the ServiceRequestTemplateParam BO.

       

      Any ideas how I can call this from a ServiceReq?

       

      I have tried:

      1 | $(ForEachChild("ServiceReq#", RecId, "ServiceReqParam#.", "GetBOValue(RecId, 'SvcReqTmplParamLink_RecID', 'ServiceReqTemplateParam#.', 'DisplayName') + '\r\n'"))

      2 | $(ForEachChild("ServiceReq#", RecId, "ServiceReqParam#.", "ForEachChild('ServiceReqParam#', 'RecId', 'ServiceReqTemplateParam#.', 'Name') + '\r\n'"))

      3 | $(ForEachChild("ServiceReq#", RecId, "ServiceReqParam#.", "EvalField('ServiceReqTemplateParam#', 'RecId', 'Name') + '\r\n'"))

       

      I didn't get an error message on line 02 & 03, but I also didn't get anything.

       

      Anyone able to help?

       

      TIA

      Declan

        • 1. Re: Iteration of Service Request Parameters
          DTurner Expert

          Couldn't find a way of doing this where the functions worked correctly.

           

          Resorted to my back up of a large case switch for every control with hard coded display values - enjoyed troubleshooting this one...

           

          Dec

          • 2. Re: Iteration of Service Request Parameters
            lgtandi Specialist

            We use the following expression to build a HTML table with the service request parameter display name and value.

             

            $("<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>" +

                   ForEachChild("ServiceReq#",

                   RecId,

                   "ServiceReqParam#.",

                   "if Find('Hidden', ParameterName) == 0 then '' 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 'text' then Replace(ParameterValue, '\r\n', '<br>') when 'list' then Replace(ParameterValue, '~^', ', ') when 'datetime' then FormatDate(DateTime(ParameterValue), 'yyyy-MM-dd HH:mm') + ' (UTC)' when 'date' then FormatDate(DateTime(ParameterValue), 'yyyy-MM-dd') + ' (UTC)' when 'time' then FormatDate(DateTime(ParameterValue), 'HH:mm') + ' (UTC)' else ParameterValue) + '</td></tr>'",

                   "ParameterName ASC") +

                   "</tbody></table>")

             

            Note that in this expression considers our naming convention for service request parameters: if it starts with "Hidden", the parameter name and value pair is ignored.

             

            Hope this helps

            AnDi

            1 of 1 people found this helpful