- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2022 06:42 AM
Hi ,
We have the excel file contain below data.
Created transform map to update the table based on the excel sheet and u_vm coalesce is true
We need to update the Most Recent Discovery to be updated based on the data on the excel sheet. If there is no update , and excel sheet contain data it should get updated .
How to implement?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2022 07:17 AM
Hi
Just saw your recent comment, what I have suggested should work for you. If not you can try with a Transform Script as below:
Write a On After Transform Script and use the script as below:
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
var sourceVM = source.u_vm.toString();
var gr = new GlideRecord('Give your target Table Name here');
gr.addQuery('name',sourceVM);
gr.query();
if(gr.next()){
target.last_discovered = new GlideDateTime();
target.update();
}else{
ignore=true;
}
})(source, map, log, target);
Screenshot for reference below:
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2022 07:17 AM
Hi
Just saw your recent comment, what I have suggested should work for you. If not you can try with a Transform Script as below:
Write a On After Transform Script and use the script as below:
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
var sourceVM = source.u_vm.toString();
var gr = new GlideRecord('Give your target Table Name here');
gr.addQuery('name',sourceVM);
gr.query();
if(gr.next()){
target.last_discovered = new GlideDateTime();
target.update();
}else{
ignore=true;
}
})(source, map, log, target);
Screenshot for reference below:
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2022 07:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2022 07:52 AM
Thanks Shloke .
The above code worked for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2022 06:28 AM
Hi Shloke,
On the below code you sent to me. I just applied it. It is working fine. And blank record is getting created after this transform script put in my system.
var sourceVM = source.u_vm.toString();
var gr = new GlideRecord('Give your target Table Name here');
gr.addQuery('name',sourceVM);
gr.query();
if(gr.next()){
target.last_discovered = new GlideDateTime();
target.update();
}else{
ignore=true;
}