Transform map script to check the active and inactive records
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 01:14 AM
Hi All,
I have a requirement where the data comes from a third party and we are using webservice and it updates in a custom table.
we are using transform maps to map the data into custom table.
Scenario 1 : I have two records in the custom table with same number (number is the unique value) one is active and other was inactive so if there is any update that was coming through the webservice then it has to check the active record and update it and it should ignore the inactive record,.
Scenario 2 : In custom table there is only one record and it was inactive if there is any update receiving then the system should ignore that update.
Can you please help me with this.
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 02:23 AM
hi @nikhitha24,
So in this case it will update the record as per your below query:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 02:40 AM
Hi Jitendra,
I have tried this but not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 03:12 AM
Hi,
Could you try to target.active == 'true'
Thanks
Jitendra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 03:32 AM
Not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2024 05:13 AM
Hi @nikhitha24,
Could you pls check in this table sys_import_set how the data is inserted and make sure all field data is mapping according to if condition given below;
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here]
if(source.u_number == target.number && target.active == "true"){
ignore = false;
}
})(source, map, log, target);