- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 03:22 AM
Hello Community,
I have transform map that is using IRE via Before transform script (below), that is afterwards setting ignore variable. Therefore, the transform map itself will not be processed.
Before transform script (IRE)
var cmdbUtil = new CMDBTransformUtil();
cmdbUtil.setDataSource('MySuperDataSource');
cmdbUtil.identifyAndReconcile(source, map, log);
ignore = true;
if (cmdbUtil.hasError()) {
// Log error
} else {
// Log payload
}
However I have some logic (example below) on field level that I need to apply. What is the best way how to do it? I want IRE to find target record in CMDB.
I weas thinking about modification of source data (filling of additional field in stagging table that will be created for this purpose). But I don't think that this is correct, as staging data should represent values received from external system.
Should this script be part of data stream flow? Should it be moved into main transform map script alongside with IRE script above?
Thanks for suggestions!
Field map (set via script)
answer = (function transformEntry(source) {
if (source.foo === "match" ) {
return "1234";
} else {
return "5678";
}
})(source);
Pavel
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 03:52 AM
Hi @Kolda ,
I trust you are doing great.
Here's the updated main transform map script:
var cmdbUtil = new CMDBTransformUtil();
cmdbUtil.setDataSource('MySuperDataSource');
cmdbUtil.identifyAndReconcile(source, map, log);
ignore = true;
if (cmdbUtil.hasError()) {
// Log error
} else {
// Log payload
// Additional field logic
if (source.foo === "match") {
target.additionalField = "1234";
} else {
target.additionalField = "5678";
}
}
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 03:52 AM
Hi @Kolda ,
I trust you are doing great.
Here's the updated main transform map script:
var cmdbUtil = new CMDBTransformUtil();
cmdbUtil.setDataSource('MySuperDataSource');
cmdbUtil.identifyAndReconcile(source, map, log);
ignore = true;
if (cmdbUtil.hasError()) {
// Log error
} else {
// Log payload
// Additional field logic
if (source.foo === "match") {
target.additionalField = "1234";
} else {
target.additionalField = "5678";
}
}
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 07:46 AM
Thanks @Amit Gujarathi, that solution worked. I'm worried that this approach might update target record twice, which would not be performance friendly.
I have one more question:
my staging table contains field last_discovered, which is filled from data stream action. However, IRE does not update target record last_discovered field, even if target record is updated. I have created property glide.identification_engine.skip_updating_source_last_discovered_if_older as true/false and set it to true, but it does not helped, (cache flushed).
Has anyone managed to get it working? My use case is that external source contains more records with same identification value (SN), and different last_discovered dates. I want to differentiate between valid and obsoleted records based on values in this property, and it should be done automatically via IRE (via last_discovered).