Issue with "onAfter" script with in transform map.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-23-2017 12:09 PM
Hi All,
We are facing an issue with the onafter script that we use in transform.
we are trying to bulk update the Records and we want the records which have been updated to update "work-notes" as well.
We have used the following code
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
if(action == "update")
target.u_work_notes = "The Ordered fields of the asset have been updated as per STRY##";
gs.log('The asset with the following serial number is updated: ' + target.serial_number);
})(source, map, log, target);
How ever
it isnt updating the record worknotes
Please let us know if we have to correct something on the same.
Thank you,
Kamal
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2017 04:28 AM
Hey Kamal,
Could you try the below code :
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
if(action == "update")
target.work_notes = "The Ordered fields of the asset have been updated as per STRY##";
gs.log('The asset with the following serial number is updated: ' + target.serial_number);
})(source, map, log, target);
post me your feedback
Please Hit ✅Correct, âÂ��Helpful, or ��Like depending on the impact of the response
Have a lovely day ahead
Regards,
Divya Mishra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2017 05:06 AM
Hi Divya,
Have tried it but no it made no difference.
The field 'work notes' which we are trying to update through on after field script is a journal field.
The strange thing is that it is updating all (irrespective of the record update) records if we put the same script in on before field script. But the condition is that we only need to update the work notes of the records which are updated through transform map.
please suggest as it is customer critical.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2017 05:05 AM
Hi Kamal,
Can you place a log statement inside function and check whether it is getting called or not?
Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2017 05:13 AM
Hey Kamal,
Got the reason why:
The onAfter event script is processed at the end of a row transformation, after the source row has been transformed into the target row and saved. Here the record is already saved into the system and has no more access to its field anymore for that particular record.
post me your feedback
Please Hit ✅Correct, âÂ��Helpful, or ��Like depending on the impact of the response
Have a lovely day ahead
Regards,
Divya Mishra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2017 05:44 AM
Hi Divya,
How can we get a solution to update the asset records??
thanks,
kamal