Hide related entities based on value


Hi Ram Prakash,

You can create an event trigger and use this method(https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/formcontext-ui-navigation/setvisible) to achieve this.

My test:

Parent entity: Department

Child entity: Employee

Based on A Yes/No type field in Department named showRelatedEntity to show or hide Employee navegation.

I create an on load event with the below code:

function onLoad(executionContext){
	var formContext = executionContext.getFormContext();
    var showRelatedEntity = formContext.getAttribute("cr5a6_showrelatedentity").getValue();
    //console.log(formContext.ui.navigation.items.getAll());
	formContext.ui.navigation.items.get("nav_cr5a6_Department_department_employee_rela").setVisible(showRelatedEntity);
}

Result:

When showRelatedEntity is ‘Yes’:

Otherwise:

BTW, if you don’t know the parameter in formContext.ui.navigation.items.get(parameter) method, you could console.log(formContext.ui.navigation.items.getAll()) first and in that you can get it:



Source link

Latest articles

Related articles

Leave a reply

Please enter your comment!
Please enter your name here