Create catalog tasks based on the attachment

Merza Lyn
Mega Guru

We have catalog item Employee information Change Request.

And on the request, there is a attachment for the Employee information that needs to be update.

Currently, our catalog item only creates one catalog task for AD user data change.

How can we add more catalog tasks based on the number of users in the attachment?

Example there 22 users in the attachment, the catalog task for AD user data change should also 22.

 

6 REPLIES 6

@Merza Lyn 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Community Alums
Not applicable

@Merza Lyn ,

To achieve the requirement where multiple catalog tasks are created based on the number of users listed in an attachment for the "Employee Information Change Request" catalog item, you will need to customize the logic that runs after the request is submitted. Right now, your catalog item only creates one task for AD user data change, but this behavior can be enhanced by reading the attached file, extracting the user records, and dynamically generating one task for each user.

This can be done by using a scripted approach, either in Flow Designer or a classic Workflow. The key is to parse the attachment—usually a CSV or Excel file—attached to the request. You can use the GlideSysAttachment API to read the content of the file and loop through each line, assuming each line corresponds to one user. As you loop through the records, you can dynamically create a catalog task within the loop, setting the necessary task details such as the user’s name or ID in the description or a variable.

For example, when a file is attached to the request item, a custom script can read that file and count how many users are listed. Then, for each user, the script can trigger the creation of a separate catalog task, allowing each one to be worked on independently. This provides better visibility and task tracking for every individual change request included in the file.

To make this work seamlessly, it’s recommended to create a Flow using Flow Designer. In that flow, you could insert a custom script action to parse the file, loop through the user list, and create tasks dynamically using the “Create Catalog Task” action. If you're using a workflow, a similar script logic can be embedded inside a Script activity to handle this.

By doing this, your catalog item becomes more intelligent and responsive to the actual data submitted, making the process scalable and efficient for handling bulk user changes from a single request. Let me know if you’d like help writing the script that reads the file and creates the tasks.