We need help with the transform maps script.

Jessica28
Tera Guru

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.

8 REPLIES 8

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

Jitendra Diwak1
Kilo Sage

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

Please accept my solution if it works for and thumps up.

Hi @Jitendra Diwak1 

Thank you for your help.  Let me give it a try and provide feed back.  Thank you

Hi @Jitendra Diwak1 

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?