Update List collector from Excel data load
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2023 02:59 AM - edited 11-21-2023 03:10 AM
Hi All,
Please Help.
I have built a catalog item that when submitted the a business rule is triggered to run an import of the attachment from the RITM, everything is working expect when I try update the list collector field it removes the current data and inserts the value form the attachment, I need it to maintain current data and add the new value from the attachment.
Here is my onBefore Transform Script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2023 03:12 AM - edited 11-21-2023 03:12 AM
Hi @Michael_Nash ,
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Retrieve the new value from the source field 'u_kit'
var newKitValue = source.u_kit;
// Check if the target field 'u_kits' already has existing values else initialize as empty array
var existingKits = target.u_kits ? target.u_kits.split(',') : [];
// Add the new value to the array of existing values
existingKits.push(newKitValue);
// Join the array of values back into a comma-separated string
target.u_kits = existingKits.join(',');
})(source, map, log, target);
Can you try this.
I think in your snippet, it kind of replacing with the new array.