I added a button to a ServiceNow catalog item using a macro, but it is not working in the SP

Sai_snow
Tera Contributor

We need to create a new catalog item. Once the user enters an email ID, the dependent fields should be auto-populated. This requires integration with a third-party system to fetch user data based on the entered email and populate the relevant fields.

After submitting the request, a PDF document should be automatically generated containing all variable details, along with a unique serial number displayed at the top of the document. The generated PDF should be attached to the same RITM.

Additionally, the catalog item should support photo upload functionality.

Queries / Clarifications:

* Please advise on the feasibility of the above requirements and suggest the best approach to implement them.
* Is it possible to upload and attach a photo/document after submitting the request?
* For fetching data based on email, should we use a button or is there a better approach
* We need to automatically attach two documents to the RITM after submission:

1. A PDF document containing basic user details in table format along with a unique serial number.
2. A document containing all variable details, including the uploaded photo.

 

1 REPLY 1

Sanjay191
Kilo Patron

Hi  @Sai_snow 

1. Is it possible to upload and attach a photo/document after submitting the request?
Yes, it is possible. After submitting the request, the system redirects to the standard ticket page where the Activity Stream is available. From the Activity Stream, users can upload photos or documents, which will automatically be attached and synced with the record.

2. For fetching data based on email, should we use a button or is there a better approach?
There are two possible approaches:

  • You can use a button to fetch the data when clicked.
  • You can  use onChange client script on the user/email field that calls a Script Include to fetch the required data automatically.

The onChange approach is generally better for user experience, but the API call should be optimized and monitored to ensure it does not create unnecessary load.

3. Automatically attaching two documents to the RITM after submission
This can be achieved using Document Templates to generate PDFs with the PDF Generation APIs. A Business Rule can trigger the generation once the record reaches a specific state. The template script can fetch user details and include the uploaded photo as part of the generated document.

If you do not want to use Document Templates, you will need to implement custom logic to generate the PDF by utilizing HTML formatting and scripting within a Business Rule or Script Include.

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Thank You!!