- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-16-2019 10:37 AM
Can some one help me with on change client script ,
Requirement is on incident if i select a CI i need to alert the user if the CI's status is test ( we have CI's status where it can be on test , dev or prod ) if they select the CI with status test we need to alert the user
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (newValue == ''){
alert('Are you sure ');
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-16-2019 10:47 AM
Use blow client script and update as per your CI status field values
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var ci = g_form.getReference('cmdb_ci');
if(ci.install_status == '1'){
alert('CI status is TEST');
}
//Type appropriate comment here, and begin script below
}
Regards,
Sachin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-16-2019 10:46 AM
helllo kam
Actually if you want to give a user alert msg after select ci if the ci is of test
just use this below code
function onChange(control, oldValue, newValue, isLoading, isTemplate)
{
if (isLoading || newValue === '')
{ return; }
if (newValue =="test")
{
alert('You new value is test');
}
if (newValue =="prod")
{
alert('You new value is prod');
}
}
Please mark this answer as correct/helpful .If your work will be done ny this code...
Thankyou
Yash.k.agrawal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-16-2019 10:47 AM
Use blow client script and update as per your CI status field values
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var ci = g_form.getReference('cmdb_ci');
if(ci.install_status == '1'){
alert('CI status is TEST');
}
//Type appropriate comment here, and begin script below
}
Regards,
Sachin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-16-2019 10:47 AM
Hi,
Try using something as below.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var getci=g_form.getReference('cmdb_ci',getcistatus);//considering cmdb_ci is CI field on form which is a reference field
alert('CI selected is '+getci);
function getcistatus(getci)
{
var cistats=g_form.getValue(getci.status);
alert('Status for selected CI is '+cistats);
}
}
Thanks,
Jaspal Singh
Hit Helpful or Correct on the impact of response.