We need help with the transform maps script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 12:11 AM
Hello,
Currently, we are using Flow Designer to create one request and one RITM whenever a user submits a service request. We would like to create multiple SC tasks from an Excel file and link them to the corresponding RITM record.
We are familiar with data sources, transform maps, and scheduled imports, but we are unsure how to link the SC tasks to the existing RITM record. Could someone please help? Thank you so much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 06:38 PM
hello @Community Alums
I have attempted to create the tasks, and they were generated successfully. However, the newly created tasks were not linked to the existing RITM.
The use case involves a user submitting a service request with an attached Excel file.
The system parses the Excel file and creates tasks based on the number of rows in the spreadsheet. Based on the code you provided, how will it determine which RITM sys_id to target?
Please let us know if there is another way of achieving this.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 01:07 AM
Hi @Jessica28,
to link the SC tasks to the existing RITM record can be achieved by below script:
var task = new GlideRecord('sc_task');
task.addQuery('request_item', target.sys_id);//request_item is field on SC TASK which stores the sysid of RITM
task.query();
if(task.next()){
source.description = task.description;
task.update();
}
It is just raw script rest can be modified as per your requirement. I am writing this script in onBefore transform map .Hope this will help you.
Please mark my answer correct and helpful if this works for you.
Thanks
Jitendra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 07:46 AM
Thank you for your help. Let me give it a try and provide feed back. Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 06:42 PM
As I mentioned to SarthakKashyap after a user submitted the service request, based on the code you provided, how will it determine which RITM sys_id to target?