Can a string field from source file mapped to the Currency type filed on the target record ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2025 04:37 AM
fields on the target record is
- 'Amount spent $' - currency type field.
- 'vendor id' - string type
source file column
- 'Amount spent' - string type.
existing logic is - based on the vendor id, populating vendor information like address, contact no ,email, Amount spent etc
Run Business rules is checked in the transform map and there is a before insert update Br that auto populates the above vendor information. I just wrote the below lines, in on before transform script. Just giving the vendor Id and rest of the details are populating on the inserted record except 'Amount spent'
Requirement is if 'Amount spent' from the source file is empty then it should populate from 'vendor id' else the Amount spent should have the value from source file.
onafter script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2025 04:47 AM
Hello @SAS21
Please try to add currency type.
gr.x_cyc_u_amount_spent = 'USD;' +source.u_amount_spent;
Regards,
Krishna Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2025 05:04 AM
the auto population is happening from before insert BR.
you are using gr object to create record on target table?
share complete onBefore & onAfter transform script.
In your onAfter use this
if (!gs.nil(source.u_amount_spent)) {
gr.x_cyc_u_amount_spent = source.u_amount_spent;
gr.update();
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader