Show/Hide a Button Widget based on "State" field on Form Widget

F_bio Gon_alves
Tera Expert

Hi SNC,

I have a customized Service Portal Page where I had a button to take me to another page.
Now, bellow this button widget I have the Form Widget that shows me specific fields from a selected table. One of those fields is "state" and I would like to show/hide de Button Widget based on this "state" field present on Form Widget.

Any ideas on how to access the Form Widget "state" field value on the Button Widget?

Thanks in advance.

Fábio Gonçalves

3 REPLIES 3

Gurpreet07
Mega Sage

Hi Fabio,



The batter option is to create a UI Action on related table. If you still need to create UI Action on portal side then you could follow below approach...


Server Code :


data.hideButton = true;


if(data.table == 'tableName' && data.f._fields.state.display_value == "Choice Display Value"){


data.hideButton = false;


}



HTML Template:


<button   ng-hide="data.hideButton">


Hi Gurpreet,



Thanks for your answer.
But I am afraid I didn't quite understood the part "data.f._fields.state.display_value == "Choice Display Value"". My Server code contains the following:


"


data.hideButton = true;


if(data.table == 'dmn_demand' && data.f._fields.state.display_value == "Screening"){


data.hideButton = false;


}
"



But that doesn't seem to work. The button is always missing once I add this condition, even when the state = Screening.



Any ideas on what I might be doing wrong?




Thanks,



Fábio Gonçalves


mahi6
Tera Contributor

hello gurpreet,

can you please explain this in details how to use.