Document Preview question about Generate / Regenerate regarding the use of multiple templates

Community Alums
Not applicable

Hello Community,

 

My use case: I want to use the document preview and generate multiple attachments. However, when I try this, I am presented with the 'Regenerate' button, which overwrites the 1st attachment.

 

Anyone know how this button decides to show up? Is there a way where we can expose the 'Generate' button? Would that even work? Is there an approved method for when using multiple document templates to one case?

 

In my testing I tried this, and it works to not overwrite it, but it's cumbersome:

  1. Load the 1st template into the document template field.
  2. Preview the document.
  3. Generate the 1st template.
  4. Download the 1st attachment.
  5. Delete the 1st attachment from the case.
  6. Attach the downloaded version of the 1st attachment.
  7. Load the 2nd template into the document template field.
  8. Preview the document.
  9. Generate the 2nd template.
    • Note here that the 'regenerate' button is not showing up after I manually attached the 1st template.
    • I wish to understand why it shows up, what is the link? Can it be broke or manipulated?
1 ACCEPTED SOLUTION

michaelj_sherid
ServiceNow Employee
ServiceNow Employee

@Community Alums  This "regenerate" is presented because the draft document is created. Your use case is not "configurable" out of the box due to the functionality where only one document template can be called for a specific HR Service. There are configurable ways to change the (Document) template dynamically, but the Out of the Box workflow will only allow one attachment based on the selected document template for the HR Case. We have some OOTB examples of multiple documents (if you look at the Onboarding Activity of Employee Documents) where this has a main HR Service with child HR Services, each of which have a separate Document Template. You can see there are a few script includes involved, but for HR Document Templates, the magic happens in the script include - GeneralHRForm. It is not a recommendation to modify the OOtB script includes, but interested in the use case to understand if there is another way to configure this.

 

If my answer has helped with your question, please mark my answer as an accepted solution and give a thumbs up.

Regards,

Mike

View solution in original post

5 REPLIES 5

michaelj_sherid
ServiceNow Employee
ServiceNow Employee

@Community Alums  This "regenerate" is presented because the draft document is created. Your use case is not "configurable" out of the box due to the functionality where only one document template can be called for a specific HR Service. There are configurable ways to change the (Document) template dynamically, but the Out of the Box workflow will only allow one attachment based on the selected document template for the HR Case. We have some OOTB examples of multiple documents (if you look at the Onboarding Activity of Employee Documents) where this has a main HR Service with child HR Services, each of which have a separate Document Template. You can see there are a few script includes involved, but for HR Document Templates, the magic happens in the script include - GeneralHRForm. It is not a recommendation to modify the OOtB script includes, but interested in the use case to understand if there is another way to configure this.

 

If my answer has helped with your question, please mark my answer as an accepted solution and give a thumbs up.

Regards,

Mike

Community Alums
Not applicable

Hi @michaelj_sherid,

 

Thank you for the answer. Would you happen to be able to provide insights as to why the download, delete, and reattach method works to bypass the associate with the 'regenerate' option? My guess is that it is treating the uploaded attachment as a completely different attachment, even though on the sys_attachment table, they look identical.

 

The core of my question is: How does the 'preview document' option know when to generate vs regenerate?

@Community Alums There is a UI page 'preview_html_document_dialog' which is handling this feature.  

You can check this page, hope it helps with your core query.

abirakundu23
Mega Sage

Hi @Community Alums ,

The scenario that you have mentioned which is not configurable as OOB in HR Document template features due to limited functionality. Its only support single document as of now OOB feature if you want to achieve multiple document template configuration you can simply use child cases in order to able to achieve use case, for my client also have recommended similar workaround.

The main difference b/w "Generate" & "Regenerate" option in Preview Document is if you click "Preview Document" on particular case the "Generate" option would be displayed, after attachment creation complete if you click 2nd time "Preview Document" option 2nd time its shows "Regenerate" option on same case & Attachment will be created.
In backend both Generate & Regenerate options are associated with "Preview Document" option.

Please mark helpful & correct answer if my answer helpful for you.