- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2022 10:44 AM
Hi ,
I need to update the Used For field value to Environment field . This should be in cmdb_ci_server table.
On this table we have different classes . All the classes should also get updated in Environment , when Used For field is Inserted or Updated.
How to implement this
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2022 05:09 AM
Hi,
Do like below...
In Filter condition modify like below
used for changes
or
environment changes
In script change like below
if(current.used_for.changes())
{
current.environment = current.used_for;
}
if(current.environment.changes())
{
current.used_for = current.environment;
}
I hope it will be helpful, if so please mark my answer as correct and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2022 11:39 AM
First, you could create a business rule to synchronize the values of Environment with the values of Used For, and this could technically be a simple business rule, but your values would have to be identical and I believe out of the box they are not identical. Thus you would need to either make it so the values are identical in both fields, or (preferably) script the values on each condition (note, you'd need to update this script if you add or change what values are available).
That said, my recommendation would be to consider this as a one-off data migration and data model change instead, moving all of the data in a big bang to Environment, enabling Environment and removing Used For from the User Interface, and just considering it a new attribute that you need to populate. There would be some short term change management involved, since your users may be populating and reporting the Used For field today, but it might be a better choice to take the hit all at once rather than prolonging the use of the Used For field, which is now considered deprecated.
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
03-02-2022 10:11 PM
Hi Paul,
Yes Business Rule works fine.
expecting something like automate through data source and schedule job . Is that possible? .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2022 10:18 PM
Hi
If you want to update for the new records which are going to be created then "Business rule" is the perfect choice and it works automatically no need of any manual intervention.
Where as "schedule jobs" and "data sources" will run at certain point of time, which wont reflect the details in "Environment" field immediately after inserting the data into "Used for" field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2022 10:30 PM
Hi Raghu,
I setup already Business Rule during insert/update the field .
I need to update the existing data to be updated.