Need to get the Sys ID of the inserted record from onBefore transform Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 06:14 AM
Before inserting, the source fields are populating in target record but since the need of the running business rules the fields on the form (Status and lifecycle) are auto setting. Hence trying to get the SysID of the inserted record in Onbefore transform script and need to use that in OnAfter script to overwrite the Status and lifecycle with the Source file fields. But no luck.
Here is the script
Inserting the record if number(coalesce ) field is empty
OnBefore
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 08:51 AM
Hello @SAS21
I just checked you have marked number field as coalesce ?
In this case it will always insert if it's not found it doesn't matters whether you have action insert ignored or not.
I think you should keep things simple. Keep one transform map for update and one transform map for insert.
If you making a field coalesce, it will always insert even if you restrict it, if the record is not found. So a part of the script becomes redundant here.
Either you remove the coalesce things and mark it as false.
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 08:52 AM
@SAS21 can you tell your whole requirement once ?
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 09:37 AM
@Shivalika need to insert the records with the data given. There are chances that BU might comeup with modifying the data for the existing records. Hence made the number field as coalesce and checking if the number is empty in the source file then insert else update. So wrote the script in the onBefore and using same function for both insert and update. But there are few fields we have to auto populate certain fields based on other fields in the form .Hence running the Business rules. Because of this status and life cycle are setting as per Workflow/Br but need to update the status and lifecycle as provided in Source. Hence using the onafter script.