Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Displaying Field Message For Variables in the Catalog

michaelrodway
Tera Contributor

I would like to set a Field Message on a catalog variable.


However I am not having any luck doing so.

I am able to get the value, set mandatory, visiblity.

I tried what was posted in the following link:

How to display error message next to a variable in the Service Catalog

Here is my code in the Catalog Client Script:

function onSubmit() {

    //Type appropriate comment here, and begin script below

  var assetInStock = g_form.getValue('asset_in_stock');

  alert ("asset in stock: " + assetInStock);

  g_form.showFieldMsg('asset_in_stock',"... Asset in Stock Message",'error');

  return false;

}

Does anyone have any other suggestions?

Regards,

Mike

7 REPLIES 7

ProbirDas
Tera Expert

I don't see anything wrong with the script. Just to be sure, is the variable name "asset_in_stock" correct? Does the alert function return correct value?


Probir,



Yup, the variable returns a proper value...



Regards,


Mike


randrews
Tera Guru

try changing the message to just test.. i   am worried about control characters in your message text...



also i tend to put these in a policy... set the conditions when it should appear in the true box.. then set a clear message in the false...