Automate Transform map using catalog item for end users
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello All,
I have a similar requirement as per below video:
Automate Transform map using catalog item for end users
To give insights about the video above:
"Create a ServiceNow Flow that automatically processes Excel files uploaded through the "Test Compliance Case" catalog item and creates Compliance cases using an existing Data Source, Import Set, and
Transform Map"
So, everything in place and also creating cases once attachment submitted through catalog.
But I have few more questions on this and issues as well.
Extended requirement:
1. I wanted to update work notes of RITM that which is submitted with attachment and processed with transform map with following details like:
Capture Import Results on the respective RITM:
Retrieve import/transform statistics, including:
Rows Processed
Records Inserted (Cases Created)
Records Skipped
Errors
2. On successful completion of transform map execution, set or close the RITM
3. If transform execution fails, update worknotes with results and close incomplete the RITM.
Issues I am facing:
1. post import script to delete already existing attachment on data source is not getting deleted using
var attach= new GlideSysAttachment();
attach.deleteAll(data source);
2. And executions are happening many times even I submit the catalog once in portal using catalog, but case is creating only once. But many times, execution record getting created.
Please help me in how to go technically with above requirements and how to fix the issues that I am facing
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Sriram28 ,
Based on your requirement, you are already able to upload the Excel file through the Catalog Item and create Compliance Cases using the Data Source, Import Set, and Transform Map. The remaining requirements can be achieved with some additional logic in the Flow/Script.
1. Update RITM Work Notes with Import Results
After the Transform Map execution completes, retrieve the import statistics from the Import Set/Transform History records. ServiceNow stores information such as:
- Rows Processed
- Records Inserted (Cases Created)
- Records Skipped/Ignored
- Error Count
These values can be added to the Work Notes of the corresponding RITM.
Example Work Notes:
ServiceNow maintains these statistics in the Import Set Run and Transform History records, which can be queried after the transform execution completes.
2. Close the RITM on Successful Completion
Once the Transform Map execution is completed successfully and there are no errors:
- Update the Work Notes with the import summary.
- Set the RITM state to Closed Complete.
Typical flow:
3. Close the RITM as Incomplete on Failure
If the Transform Map fails or the import process throws errors:
- Update the Work Notes with the error details.
- Set the RITM state to Closed Incomplete.
Example:
Issue 1: Attachment Not Getting Deleted from Data Source
The following code is not correct:
deleteAll() expects a GlideRecord, not a variable name or string value. The correct approach is:
Alternatively, you can explicitly delete each attachment one by one, which is often more reliable. ServiceNow's GlideSysAttachment API supports retrieving attachments and deleting them individually.
Issue 2: Multiple Execution Records Created
If the catalog item is submitted only once but multiple execution records are created, usually one of the following is happening:
Scenario 1: Flow is Triggering on Update
Verify whether the Flow trigger is configured as Created or Updated
Instead of Created only
During catalog submission, the RITM gets updated multiple times, which can create multiple flow executions.
Scenario 2: Attachment Copying Causes Record Updates
If your flow:
- Receives the attachment on RITM
- Copies it to the Data Source
- Updates the record
those updates may retrigger the Flow and create additional execution records.
Scenario 3: Import is Invoked More Than Once
Check that you are not:
- Calling the Transform Map through a Script, and
- Also calling a Flow Designer "Transform Data" action.
This can produce multiple import executions even though the final case is created only once.
Scenario 4: Recursive Flow Execution
Sometimes the Flow updates the RITM itself.
Example:
To avoid this:
- Trigger only on Create, or
- Use a flag field such as
u_import_processed = true, and - Add conditions so the flow runs only once.
Recommended Solution
This approach will meet all three requirements and also help eliminate duplicate execution records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
hi @pavani_paluri ,
Thanks for all explaining in detail with patience.
As per the flow provided :