Create Custom Recommendation on Form within Canvas Power Apps
Hello, everyone!
We know that Recommendations are created using Business Rules, but that only works on Model Driven Apps.
As a result, we’ll develop Custom Recommendations that are flexible and customizable to our needs and enhance our App.
This is how the Custom Recommendation looks,
Let’s start with a simple use case,
I want to set ‘Preferred Method of Contact’ field as Phone when User enters data within ‘Phone’ field within the App.
Step 1: Add an Edit Form in Canvas Power Apps where the Recommendation would be applied.
Step 2: Within Form properties,
- Click on Edit Fields
- Add Custom DataCard.
- Drag your Card below the DataCard where you need Recommendations.
Step 3: Within the Custom DataCard, enter necessary information that you like in your App and use below condition.
//Visible property on [Custom Card]
If(!IsBlank(DataCardValue3.Text) , true, false)
Step 4: For Apply button, I’m using context variables that sets true when click and remains until record is saved or the current screen is Active.
//OnClick [Button]
UpdateContext({varRecomPhone: true})
-----------
//OnClick [Back Button/Previous Screen]
Back();
UpdateContext({varRecomPhone: Blank()});
-----------
Step 5: For changing values in my combo box on field ‘Preferred method of contact’.
Note: Based on your requirement, this will change…
//DefaultSelectedItems [Control - combo box]
If(!varRecomPhone, [Parent.Default], {Value: 'Preferred Method of Contact (Contacts)'.Phone} )
That’s all.
Hope this helps you.