Help on UI policy script to show a field message on specific field value

JC S_
Mega Guru

We have a business requirement to show a certain field message depending on the value of the Priority field.

For example field message A will be shown when Priority is 4 and it will show message B when Priority is 1.

How can we implement this?

1 ACCEPTED SOLUTION

Harsh Vardhan
Giga Patron

i would suggest you can use client script onChange() on priority to fulfill this requirement

ui policy always use to make field read only, mandatory and to make field visible.

 

if(g_form.getValue('priority')==1) 

{

g_form.addInfoMessage(' hey');

}

else if (g_form.getValue('priority')==4) 

{

g_form.addInfoMessage(' hey again');

}

View solution in original post

2 REPLIES 2

Harsh Vardhan
Giga Patron

i would suggest you can use client script onChange() on priority to fulfill this requirement

ui policy always use to make field read only, mandatory and to make field visible.

 

if(g_form.getValue('priority')==1) 

{

g_form.addInfoMessage(' hey');

}

else if (g_form.getValue('priority')==4) 

{

g_form.addInfoMessage(' hey again');

}

georgimavrodiev
Mega Guru

Hello JC,



If you insist to achieve your goal via UI Policy - then, You may create a UI Policy against the respective table and condition: Priority | is | 4 - Low (for example). Then, you may use the Script section and Run script while adding the following script point in 'Execute if true':

function onCondition() {
if(g_form.getValue('priority' == 4)){
        g_form.showFieldMsg('priority', "Message A", "info");   
    }
 
and this one in 'Execute if false':
 
function onCondition() {
g_form.hideFieldMsg('priority');
}
 
 
I believe you may use else if statements to add both the message in one UI Policy.
 
Hope this input will be of use to you!

 
Best Regards,
Georgi Mavrodiev
 
IT Consultant 
Do IT Wise Bulgaria
 
You may visit us in our Web Site: www.doitwise.com