- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-01-2020 06:52 AM
Hello all,
Currently there is a Integration through which we are only updating and inserting the new CI's and not updating the existing CI's which are created by discovery or manually added.
Now we have a requirement , if for the some CI's some fields are empty(which are present in the database integration) then that integration should update those fields in the Particular CI.
Below is the Onbefore Script:
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
if(action == "update" && source.u_bios_serialnumber == target.serial_number && target.discovery_source != "ABC Integration")// for only updating the ones created by this integration
{
ignore=true;
}
else if(action == "insert" && source.u_operation_system == 'Red Hat Enterprise Linux Server' ||source.u_operation_system =='Oracle Linux Server'||source.u_operation_system == 'SUSE Linux Enterprise Server' ||source.u_operation_system == 'Linux')//Only to insert Linux Servers
{
ignore = false;
}
else
{
ignore = true;
}
})(source, map, log, target);
What changes can be made in the above script to fulfill the requirement.
Also can we use Reconciliation Rules to achieve this ?
Thanks in advance!!
Regards,
Mahak
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2020 06:26 AM
So why not move to the new IH-ETL feature so you can use the Reconciliation rules.
If you are on Orlando, you could use the new IH-ETL feature to import data via IRE, and then Reconciliation rules to add the logic of what data source that can update what CI class and attributes. You can even put in a condition to say if blank is empty then allow this source to update.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2020 06:55 AM
It's free. I hope you take the time to read the post and look at the free training for it. It's not hard to get up and running.
If you have to use the transfer map, then I would suggest updating the maps to use IRE. This way you can still use Reconciliation rules. Example on how to do this can be found below link.
https://community.servicenow.com/community?id=community_article&sys_id=e7202b51dbc4585c13b5fb24399619fa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2020 07:54 AM
Hello Patrick,
I have completed the "Use Integration Hub ETL to Import data" course from now learning Platform.
That was awesome.
But I have few queries regarding that:
Can you please help me:
1. In our instance at present "com.glide.integration_studio" is not installed so we need to install it right before using this ?
2.Are there any impact of using this on the Discovery or something else?
3.In the traditional approach that is Transform i have built some Field Map scripts and On before script to fulfill some requirements:
for ex:
->In our source table name field has extra string attach to it like @abc.com so we need to remove them before importing it into the target table.
->Also in the Discovery source field of Target table we need to dynamically set the value "ABC Integration" in all the records created by this integration .
->Also the name of the OS which is present in Source table has different naming convention than that in the CMDB tables so we are using the field map script to update those as per the choices available so this will not create any new choices with different naming convention.
->How can we set the coalesce field?
->Lastly we want only the new records to be created /updated by this integration and existing records should be updated even though their serial number which is our coalesce field matches.
How the above can be done through Integration Hub?
And their is a condition that if the existing records have any field which is empty then only that field should be updated not the whole which can be done through reconcilliation rules.
Many thanks in advance!!
Regards,
Mahak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2021 11:35 AM
I concur. The original suggestion from
You can even put in a condition to say if blank is empty then allow this source to update.
Unfortunately this is not true because the filter condition applies to the source record, not the target record. So if you are trying to, for example, set the assigned_to value of a target record to that of the source record, but only if the existing assigned_to value is empty, Reconciliation rules won't let you do this using the Filter conditions.
In traditional transform maps you could simply use the basic script of the transform map to do this. Just check the target record and conditionally map the value if the current value is nil(). But since all of the IntegrationHub ETL functionality is in place to create that final payload passed to IRE, we don't yet know what the target CI is to even ask that question.
Now, there may be some facility in the Robust Transform Engine that would allow you to do this, but it doesn't seem to me that anything like that is available in the IntegrationHub ETL application.
The opinions expressed here are the opinions of the author, and are not endorsed by ServiceNow or any other employer, company, or entity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2021 11:36 AM
You can even put in a condition to say if blank is empty then allow this source to update.
I was thinking along these same lines. Unfortunately this is not true because the filter condition applies to the source record, not the target record. So if you are trying to, for example, set the assigned_to value of a target record to that of the source record, but only if the existing assigned_to value is empty, Reconciliation rules won't let you do this using the Filter conditions.
In traditional transform maps you could simply use the basic script of the transform map to do this. Just check the target record and conditionally map the value if the current value is nil(). But since all of the IntegrationHub ETL functionality is in place to create that final payload passed to IRE, we don't yet know what the target CI is to even ask that question.
Now, there may be some facility in the Robust Transform Engine that would allow you to do this, but it doesn't seem to me that anything like that is available in the IntegrationHub ETL application.
If I'm missing something please let me know!
The opinions expressed here are the opinions of the author, and are not endorsed by ServiceNow or any other employer, company, or entity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2020 05:16 AM
So just doing target.whatever field is not going to work since the map is not doing a gliderecord lookup of the table/record. target.fieldname is just saying, I want to take whatever source value and map it to target.field ..
If you are on Orlando, you could use the new IH-ETL feature to import data via IRE, and then Reconciliation rules to add the logic of what data source that can update what CI class and attributes. You can even put in a condition to say if blank is empty then allow this source to update.