
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2020 11:44 PM
Hi
If a new Linux or Windows Server is added, they have default values for the field
- Status = Installed
- Operational Status = Non-Operational
For users with the Role "ecmdb_admin" I wouldlike to change this in:
- Status = On Order
- Operational Status = Order
I did create a client script, but the check if the field "Status" is not filed does not work. In other words, every Windows or Linux Server that is opend is changed to the new defined values.
I did try
- if (g_form.getValue('install_status','')) {
- if (g_form.getValue('install_status','--None--')) {
This is the script:
function onLoad() {
//alert("Status will be set to On Order.");
if (g_form.getValue('install_status', ''))
{
if (g_user.hasRoleExactly('ecmdb_admin'))
{
g_form.setValue('install_status', 2);
g_form.setValue('operational_status', 10);
}
}
}
Solved! Go to Solution.
- Labels:
-
Orchestration (ITOM)
- 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 || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- 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 || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2020 11:53 PM
Hi,
One way to check for Null or None could be -
var v = g_form.getFieldNames();
for(var i =0; i<v.length;i++)
{ var currentVar = v[i];
var checkVar = g_form.getValue(currentVar);
if(checkVar == null). //specify none or any other check { g_form.setValue(v[i], ''); }
Regards,
Mamta
Please mark correct or helpful as applicable