Auto-populated variable in catalog item won't allow a field message

Jake McC
Tera Contributor

On a catalog item, I have a URL type variable (Field B) which auto-populates using the functionality within the variable as follows:

Dependent question - "FieldA"

Reference - "cmdb_table_notrelevant"

Dot walk path - "fieldontable"

 

The requirement is to have the help text of Field B dynamically alter based on the chosen option in Field A.

 

I thought to do this via on onChange Client Script tied to Field A. After having looked into it I have found that you cannot manipulate help text via scripting, so I decided to instead delete the help text on Field B and replicate it using g_form.setFieldMessage(). The problem is that whilst the auto-populate is populating Field B from the choice chosen in Field A via the auto-populate, my client script is being overwritten, meaning I cannot set a field message (I have tried g_form.clearValue(), this did not work).

 

The only option I could think of was to potentially auto-populate the field as part of my client script? If anyone has a better solution to this it would be much appreciated, many thanks.

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Jake McC 

yes please use onChange client script + GlideAjax to populate and also use logic.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

nemamuskan
Tera Contributor

Hello @Jake McC,

 

I have a better way I think which could help you which is please create the Onchange Client script for the (Field B) and use it like this based on your condition and value dynamically by using if and else as required.

 

g_form.showFieldMsg("fieldB","THIS IS MESSAGE");
 
Hope my solution helps your problem statement. If you need any help with this please post here.

If my response helped please mark it correct and close the thread so that it benefits future readers.

 

Thanks and Regards,

Muskan