print values on form using business rule

Shivani Khedek1
Giga Contributor

I have written a business rules on a custom task table, which should print error messages on form if any of the mentioned field value is not given.

for example, i have a field 'owner ' on which i have written a business rule which should mark state to closed complete if value in owner field changes. Along with this implementation I want an error message to be displayed on form below owner field that 'error assign owner'.

I have tried implementing:

gs.addErrorMessage('Form Error Message Text');

gs.addErrorMessage(gs.getMessage("Choose approval or rejection"));

gs.addErrorMessage('Choose approval or rejection');

g_form.addErrorMessage('This is an error');

current.approval.setError('Choose approval or rejection');

current.approval.setDisplayValue('Choose approval or rejection');

current.approval.setValue('Choose approval or rejection');

 

can someone help me to print values on form using business rule?

 

thank you,

Shivani.

 

13 REPLIES 13

Afifa1
Kilo Expert

Hi Shivani,

Can you please elaborate your requirement?

 

Regards,

Afifa

SaiRaviKiran Ak
Giga Guru

g_form won't work in business rule.

 

If you want to add error message then you can try gs.addErrorMessage("Give required message here");

i want to display a message on form .. gs.addE.. does't print message inside form. I tried implementing it but still message is not displaying inside of form

Hi Shivani,

So if field is not populated you want to show the message? Do you want to show an alert or show field message besides the field.

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader