The CreatorCon Call for Content is officially open! Get started here.

Conditions for reference tables for UI Actions

irfanshaik
Tera Contributor

Hello,

 

I am trying to apply condition on a UI action to show/hide the button. But the condition only works for default fields on the form and not for the fields that i've added by dot walking from reference tables

 

For instance, in this form, first_name is a field on the table where as vehicle_model is dot walked from another table - 

 

irfanshaik_0-1708305967664.png

 

This condition works well to show/hide the button -

 

irfanshaik_1-1708306022885.png

 

But this doesnt work - 

 

irfanshaik_2-1708306056956.png

 

I've tried doing 

 

current.getValue("vehicle_model") != 'Test';
current.getValue("case_id.product_features.vehicle_model") != 'Test';

 

1 ACCEPTED SOLUTION

Nice, then you can change the condition of the UI Action to this:

current.case_id.product_features.vehicle_model.getDisplayValue()  != 'Test';

 

Let me know if it works!

View solution in original post

11 REPLIES 11

James Chun
Kilo Patron

Hi @irfanshaik,

 

You should be able to use the dot-walked field for your UI condition.

Are you sure you are using the correct field names?

Also, have you tried debugging via printing logs?

 

Thanks

I think i am using the right field names. These are the details - 

 

first_name - 

 

irfanshaik_0-1708307319584.png

 

 

vehicle_model - 

 

irfanshaik_1-1708307370186.png


can you tell me how to debug via printing logs please ?

Can you verify the type of 'vehicle_model' field? Is it a reference field? If so, you would need to dot-walk once more. e.g. 

current.getValue("case_id.product_features.vehicle_model.name") != 'Test';

 

Otherwise, try printing out some logs from the Script section of the UI Action.

Something like:

 

gs.info("Value of vehicle_model is " + current.getValue("vehicle_model") );
gs.info("Value of case_id.product_features.vehicle_model is " + current.getValue("case_id.product_features.vehicle_model") );

 

Thanks

Vehicle Model is just a string type field in the table Product Features

gs.info didnt work for me or current.getReference("vehicle_model").getDisplayValue();

but gs.addInfoMessage worked - 


 

gs.addInfoMessage('First Name: ' + current.getValue('first_name'));
gs.addInfoMessage('Vehicle Model: ' + current.getValue('vehicle_model'));
gs.addInfoMessage('Vehicle Model Dot Walked value: ' + current.getValue('case_id.product_features.vehicle_model'));

 

 

This gives me -

 

irfanshaik_3-1708311475735.png

 

It confirms that there is some issue with the full field name - case_id.product_features.vehicle_model as its not able to fetch the value

Just not sure what the issue is. This is the schema map - 

irfanshaik_1-1708311262584.png

You go from Case Id to Product Features to Vehicle Model

irfanshaik_2-1708311366194.png