8 Replies Latest reply: Feb 6, 2013 10:07 AM by Bunty RSS

    Modify response template workflow_info.htm

    Jon Almada
      Hi - I'm wanting to modify response template workflow_info.htm to display full names of reviewers in the template. I already know that the getValueForSpecifiedUser function will do that for me and I have some experience with custom components, but I'm not quite sure how to go about this particular change since the template is called from the GET_WORKFLOW_INFO_BYNAME service.

      The questions I have are as follows:

      What type of resource definition do I create?

      Do I use a super tag to override the existing output? I'm leaning to the belief that I override the service itself rather than the output of the response template, but could use a pointer here.

      Appreciate any advice anyone can provide.

      Many thanks,

      Jon
        • 1. Re: Modify response template workflow_info.htm
          Jiri.Machotka-Oracle
          Most likely you will end up modifying few includes - changing the template, or even the whole service should not be necessary. Super tag can be useful and recommended, but not a must.
          • 2. Re: Modify response template workflow_info.htm
            Jon Almada
            Trouble is, the template has the HTML and IDOC I need to have changed... I need to figure out how to get the service to use my particular template rather that the original and the super tag seemed to be the answer, but I'm still back at square one - what approach to take? I'll keep stabbing away at it to see if I can work out the steps...
            • 3. Re: Modify response template workflow_info.htm
              Jiri.Machotka-Oracle
              IMHO the necessary changes can be quite simple. What exactly do you want to do? In the table Workflow Content Action History, column 'Users' do you want to display the full name instead of dDocAuthor?

              For instance, this piece is in the template (workflow_info.htm) represented by this code
              <!-- USERS cell -->
              <td class="<$rowClass$>">
              <div class="xuiListCellDivCenter" nowrap>
              <script language="JavaScript">
              var userString = "<$js(wfUsers)$>";
              var userArray = userString.split(",");
              for (var i=0; i<userArray.length; i++) { document.write(userArray[i] + "<br>") }          
              </script>
              </div>
              </td>
              (unfortunately, no include here, so you will have to modify the whole template, and you won't be able to use the super tag either)

              This means you have two options:
              a) define a template resource with the same name as the standard one (workflow_info.htm) and set its load_order properly so that yours rather than standard is used (for includes it's higher than the standard - check whether this logic is true also for templates)
              b) or you create a new template resource, and redefine the whole service in a service resource (again, with the right load_order) so that it uses your new template (the remaining lines has to be the same)

              I'd go with a) (personally, it seems to be simpler), but in reality there is no real difference.
              • 4. Re: Modify response template workflow_info.htm
                Bunty
                In the template, the code loops on WorkflowActionHistory resultset and uses wfUsers column of the resultset to generate the approbvers list.
                What you can do is, overwrite any includes in the template like
                doc_info_notify_data
                special_doc_info_fields
                custom_wf_info_fields

                and alter the values for WorkflowActionHistory.wfUsers.
                <$loop WorkflowActionHistory $>
                <$WorkflowActionHistory.wfUsers = getValueForSpecifiedUser.....$>[[%can be muliple approvers...so you alter your code accordingly%]]
                <$endloop$>
                Hope this works!
                I have plans to implement on similar lines, I will update on how it goes.
                • 5. Re: Modify response template workflow_info.htm
                  Jon Almada
                  That helps a bunch. What I'm dealing with is that we need to display the full first and last name of the approvers in the workflow action history section as follows:

                            <!-- USERS cell -->
                            <td class="<$rowClass$>">
                                 <div class="xuiListCellDivCenter" nowrap>
                                      <script language="JavaScript">
                                           var userString = "<$js(wfUsers)$>";
                                           var userArray = userString.split(",");
                                           for (var i=0; i<userArray.length; i++) { document.write(userArray[i] + "<br>") }
                                      </script>
                                 </div></td>

                  So I would change the output to display their last and first name rather than their account name, which is what is currently showing up. That is the goal.

                  In the past, I've done components where I had used the @dynamichtml to key off the named fragment, so this became a problem when I was trying to use the response template for the Workflow service which didn't have any of these and I was left to try to make sense of how to do a component for this... I think I'm getting what you are saying to do and will give it a go. I'll post my success/fails here to go through it with you guys...

                  Many thanks

                  Edited by: Jon Almada on Feb 5, 2013 1:38 PM
                  • 6. Re: Modify response template workflow_info.htm
                    Jon Almada
                    And yes, I'll go with your option "A".

                    So, I need to do the following then:

                    1. Create a new component.
                    2. Use "Resource - HTML Include/String
                    3. Set the filename the same as the workflow_info.htm
                    4. Load Order set to lower number than 10 ( So I'm not sure what to set it to yet - ideas?)
                    5. Clip a copy of the original workflow_info.htm in this resource file and edit as needed.
                    6. Enable component.

                    Is this even close?
                    • 7. Re: Modify response template workflow_info.htm
                      Jiri.Machotka-Oracle
                      Close, but 2. and 3. must be different:

                      2) create a Template; accept all default values until you get to Add Intradoc Template page, where you fill in
                      3) Name = WORKFLOW_INFO, Class = Workflow, Form Type = Workflow Docs, filename = workflow_info.htm
                      • 8. Re: Modify response template workflow_info.htm
                        Bunty
                        I implemented this without modifying the template..(displaying User Full Name)
                        <@dynamichtml custom_wf_info_fields@>
                        <$include super.custom_wf_info_fields$>
                        <$loop WorkflowActionHistory $>          
                             <$if rsExists("myCustomApproverNames")$>
                                  <$exec rsRemove("myCustomApproverNames")$>
                             <$endif$>
                             <$exec rsMakeFromString("myCustomApproverNames",WorkflowActionHistory.wfUsers,"approvers")$>
                             <$strApproverNameString = ""$>
                             <$strFirstTime="1"$>     
                             <$loop myCustomApproverNames$>          
                                  <$if strFirstTime like "1"$>
                                       <$strApproverNameString = getValueForSpecifiedUser(strTrimWs(myCustomApproverNames.approvers), "dFullName")$>
                                  <$else$>
                                       <$strApproverNameString = strApproverNameString & "," & getValueForSpecifiedUser(strTrimWs(myCustomApproverNames.approvers), "dFullName")$>
                                  <$endif$>                    
                                  <$strFirstTime="0"$>     
                             <$endloop$>
                             <$WorkflowActionHistory.wfUsers = strApproverNameString$>
                             <$strApproverNameString=""$>
                        <$endloop$>
                        <@end@>