We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

how to display alert message when filed value changes

Govardhan
Kilo Contributor

hi All

i am trying to display an alert message in incident form ,i have configuration item filed when user selects "redbird"option in configuration item filed .i have to pop up a alert message ..saying that "you have selected "redbird as your choice".can any one help ...?

12 REPLIES 12

Sanjeev Kumar1
Kilo Sage

var x = g_form.getValue('field_name')


if(x == true)


{


alert('you have selected redbird as your configuration item');


}


this gives alert when ever i select some value on the filed ,i want it when specific option is selected


for example :there are 3 options:A,B,C


if i select A then only i should get the alert message.if i select B or C i dont want alert message


Try this work for only *ASSET-IBM



function onChange(control, oldValue, newValue, isLoading, isTemplate) {


    if (isLoading || newValue === '') {


          return;


    }



    //Type appropriate comment here, and begin script below



  var popup='*ASSET-IBM';



  var ci=g_form.getDisplayBox('cmdb_ci').value;


  if(ci==popup)


  {


  alert("Selected CI is= "+ ci);


  }



}




Thanks


Pradeep D J


PS - Please mark Helpful, Like, or Correct Answer if applicable.