
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 09-03-2024 07:10 AM
ServiceNow's Advanced Forms feature is a powerful tool for HR services, enabling HR agents to generate specific documents linked to HR cases. While this functionality is robust, it has a limitation: out of the box, it only allows for the generation of one document per HR case. But what if your process requires multiple documents to be created automatically for a single case?
In this article, I'll explain a solution that overcomes this limitation, allowing you to generate multiple documents automatically based on specific conditions.
The Challenge: Generating Multiple Documents
By default, ServiceNow’s functionality restricts HR agents to generating just one document per case. This limitation can be problematic for organizations that require multiple documents for compliance, process, or other business needs.
The Solution: Custom Action and Flow
To address this, you can create a custom action within ServiceNow's Flow Designer that automates the generation of multiple documents on a single HR case. This action can be triggered by specific conditions defined in your flow, ensuring the correct documents are created when needed.
Please note that I won't be explaining the steps for creating a document template, as I assume that you already know how to do so.
Step 1: Creating the Custom Action
1. Create an Action in Flow Designer:
- Inputs:
- Task Record ID: SysID
- Document Template ID: SysID
- Generated PDF Name: String
2. Add a Script Step in the action:
- Pull the above inputs into input variables. For example:
taskRecordId
documentTemplateId
generatedPdfName
3. Write the Script:
- Use the
GenerateDocumentAPI
to generate the document. Here's a sample script:
(function execute(inputs, outputs) {
outputs.generatedattachmentid = new sn_doc.GenerateDocumentAPI().generateDocumentForTask(inputs.taskRecordId, inputs.documentTemplateId, inputs.generatedPdfName);
})(inputs, outputs);
Note: The script does not require any outputs. It will generate the document and automatically attach it to the task record, in this case, the HR case.
Step 2: Creating the Flow
1. Set Up the Flow in Flow Designer:
- Define the trigger and conditions based on your requirements. For instance, you might have two fields in the HR case table,
Doc 1
andDoc 2
. If either or both are checked, the corresponding document templates will be generated
2. Configure the Flow:
- Ensure that the correct values are passed, particularly the SysID for the task record and document template, rather than the case number or template name.
3. Run/Trigger the Flow:
-
Once triggered, the flow will generate and attach the documents to the HR case automatically.
-
For example, if both
Doc 1
andDoc 2
are set to true, both documents will be generated and attached to the case.
Flow is triggered:, both documents got generated and auto-attached to the case:
Conclusion
By following the steps outlined above, you can effectively extend ServiceNow’s out-of-the-box capabilities to automatically generate multiple documents for a single HR case.
Final Tips:
- Ensure Consistency: Make sure that the document template table and the case table are the same.
- Set the Right Conditions: Configure your flow triggers and checks carefully to meet your specific business requirements.
- Remember: This solution focuses on document generation only. It does not handle the triggering of signature tasks or other actions.
I hope you found this guide helpful and that it enhances your ability to automate document management within ServiceNow.
- 1,556 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Thank you this is really helpful! Just one question - can documents generated this way be previewed and edited before then triggering a workflow or are they not editable?

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@Ashish32 Unfortunately you cannot preview/edit with this method as we assume that you want to directly generate the document automatically. If you want to preview/edit, then you should write the flow to just update the doc template and have the HR manually preview/edit the generated doc
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
@Apurva16 I have a query in this as servicenow has a limitation that we can generate one DocuSign per hr case.
I am facing one challenge currently i am not aware what I am going to do is it feasible or not.
The challenge is the first DocuSign task that is invite letter. After manager sign after closing the DocuSign task if there were some changes we wanted to make we can edit a d regenerate the DocuSign task in the parent case.
For the 2nd DocuSign task that is outcome letter. We will created a child ER cases and inside that we will generate after signed by manager DocuSign task is getting closed as well as child er case. Here the issue is in child er case we can only generate the DocuSign task once , also we can edit only once . Currently it's not possible that if after generating DocuSign task if agent gets any request for changes in outcome letter , we can't regenerate the outcome letter once again.
Is there any way we can tackle this business requirements.
Thank you , i also raised in community but haven't got any reply.
Context was In ER cases, we have two DocuSign tasks. The first one is the invite letter. After generating and getting it signed by the manager, the DocuSign task closes. However, from the ER case, we can still regenerate the invite letter if any changes are needed, which works as expected.
The second DocuSign task is for the outcome letter. Since ServiceNow has a limitation of allowing only one DocuSign task per ER case, we created a child ER case where this task is generated. The issue here is: once the outcome letter is generated and signed, the child ER case closes. At this point, if we need to make any changes and regenerate the outcome letter, it’s not possible.
Could you please suggest how I can address this challenge and meet the business requirement?