Need to autopopulate the value in Change Request table based on a reference variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2024 09:54 AM
I have a situation where I need to set a choice field (doesnt have to be a choice, can be free text as well) to yes or no based on which configuration item is chosen. As an example - if someone selects an application that is marked as a SOX Compliant app as the configuration item the change is based upon, I need the "Is SOX?" field to auto-populate to "yes" or "No" based on the value of that field in the actual config item record. please see screenshots.
is this something that I should do in flow designer? or can I do this simply within the change record?
     
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2024 01:23 PM
Hi @cameron8
As per your screenshots, Is Sox is a mandatory field so you can write onChange Client script on Configuration item Field and get yes/no from CI Record.
1. If CI Value is empty then make isSox to None.
2. Once you set the isSox value from script
- Make it read-only so that that user cannot update manually(This is as per your requirement)
Is "Sox Application Specific" field available on all the cmdb tables or specific tables?
- If on specific tables then use GlideAjax to get that Value.
- If on All the cmdb tables then you can use getReference() in your client script( Not a good practice)
getRefernce is not considered best practice because It brings the complete record details but we only need one, You can go with GlideAjax Approach.
Adding few links below, Try and let us know if you're stuck.
https://www.servicenow.com/community/developer-forum/glide-ajax-not-working/m-p/1381985
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2024 01:59 PM
"sox application specific" is on the CMDB Application Table, possibly on others but for sure just on the appl table. as far as the script is concerned, how would you go about writing the onchange script to trigger off the CI field? any examples of how you'd do it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2024 11:43 PM
Please check the links I provided, those are similar use cases.
https://www.servicenow.com/community/developer-forum/glide-ajax-not-working/m-p/1381985
Try and let us know if you're stuck.
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2024 08:31 AM
I'm admittedly useless when it comes to writing scripts in servicenow is why I ask. pretty in the dark.
script includes: