- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2020 11:53 PM
Hi,
if you are using OOB None option then it's value is empty string
you can use that to compare
updated script below
function onLoad() {
if (g_form.getValue('install_status') == '')
{
if (g_user.hasRoleExactly('ecmdb_admin'))
{
g_form.setValue('install_status', 2);
g_form.setValue('operational_status', 10);
}
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2020 12:36 AM
Hi Ankur
In fact this is a correct answer.
unfortunately, I made a mistake. If I create a new Windows or Linux Server the "Status = Installed". I cannot check this value for this is a quite normal status. The default values should only be for new created Windwos or Linux Servers. So the question would be:
How can I check if it concenrs a new created record. So
If "New Record" {
g_form.setValue('install_status', 2);
g_form.setValue('operational_status', 10);
}
Can you help me with this?
Greets
Wim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2020 12:37 AM
Hi,
something like this
if(g_form.isNewRecord()){
g_form.setValue('install_status', 2);
g_form.setValue('operational_status', 10);
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2020 02:29 AM
Thank You Ankur
This is working great.
With a test on a role (hasRoleExactly) I was able to implement it for a specific group of users.
Greets
Wim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2020 02:30 AM
You are welcome
Happy learning
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader