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 12:43 AM
Hi @Jessica28 ,
Please check this below link this will work you
Please mark my answer correct and helpful if this works for you.
Thanks and Regards
Sarthak

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 12:49 AM
The transform scripts can be used to control the behavior of the transformation process.
Types:
1. onStart: The onStart event script is processed at the start of an import run, before any data rows are read. onStart runs at the very beginning of the import before any of the records are processed. If you want to notify user that the import has started then you can create the onStart script to send out the message.
2. onBefore: The onBefore event script is processed at the start of a row transformation, before the source row is transformed into the target row. onBefore runs before every row is processed. This script runs for each individual record. If you want to set or alter values on the source table it can be done here. onBefore scripts can be used to verify that the value of a source field is valid. If the value is invalid, the script can take action.
3. onAfter: The onAfter runs after every row has been processed, after the source row has been transformed into the target row and saved. Fields on the target table can be accessed from this point. They contain the value that was just inserted. At the time that this script runs, the source and target field values should be the same.
4. onForeignInsert: The onForeignInsert runs before a new referenced record is created. Since this script only runs on an insert, the choice action “create” has to be selected for that field map. If “create” is not selected, the script will never run.
At this point, we can access values on the source table. We also have access to the fields on the target table that have already been filled in. The one being transformed, however, will not yet have a value. onForeignInsert scripts can manage what happens when a new record is added to a referenced table. When I was playing around with onForeignInserts, I couldn’t find a way to change values on the referenced table from my script. There might be a way to do this, but I haven’t figured it out yet. An onAfter script might be a better option if that’s what you’re going for.
5. onChoiceCreate: The onChoiceCreate event script is processed at the start of a choice value creation, before the new choice value is created.
6. onComplete: The onComplete event script is processed at the end of an import run, after all data rows are read and transformed.
7. onReject: The onReject event script is processed during the occurrence of a foreign record or choice creation, and the foreign record or choice is rejected, the entire transformation row is not saved.
I created sample script onAfter type please refer this will help you
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
gs.log('Incide ON Complete script = ' + source.u_number);
var JsonData = {
number: source.getValue('u_number'),
short_description: source.getValue('u_short_description')
};
// Convert object to JSON string
var jsonToString = JSON.stringify(JsonData);
gs.log("jsonToString = " + jsonToString);
target.description = jsonToString; // Replace u_json_data with your field name
target.update();
})(source, map, log, target);
Please mark my answer correct and helpful if this works for you.
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 07:44 AM
Hello @Community Alums
Please allow me some time to digest the code, as I don't have much experience with coding. Thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 08:28 AM
Please ask me if you have any doubt.
Please mark my answer correct and helpful if this works for you.
Thanks and Regards
Sarthak