cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MJohnson-Fisher
Frequent Visitor

Power Apps not setting variables/form modes correctly

Hello,

 

I am trying to set a variable to change the form mode of my forms within Power Apps. I’ve been attempting to get each mode to work for over 12 hours. Help!

 

more specifically, I am using a variable in the DefaultMode property of my multi screen form. If the link that is used to navigate to the app contains just the form name, I’d like the form to be in edit mode/new mode. If there was an ID parameter passed then I’d like the form to be in view mode. 

 

OnStart : if(Param(“DeepLink” = “XYZForm”), Navigate(scrn_XYZFormPart1), If(Param(“DeepLink” =“ABCForm”), Navigate(scrn_ABCFormPart1))

 

Then the OnVisible property of the form screen is set to If(!IsBlank(Param(“ID”)), UpdateContext({varFormData: Defaults(XYZFormSource)}))


The Item property of the form is set to lookup the ID in the SharePoint list which is the data source. 

I’m not sure how to get my variable to update accordingly. It pulls the data from the data source but the form is in ViewMode and my new form doesn’t display. 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @MJohnson-Fisher :

Please try:

OnStart :

If(
Param("DeepLink")="XYZForm",
Navigate(scrn_XYZFormPart1),
Param("DeepLink")="ABCForm",
Navigate(scrn_ABCFormPart1)
)

Then the OnVisible property of the form screen is set to 

If(
!IsBlank(Param("ID")),
UpdateContext({varFormData: Defaults(XYZFormSource)})
)

 Best Regards,

Bof

View solution in original post

3 REPLIES 3
VijayTailor
Resident Rockstar
Resident Rockstar

Hi @MJohnson-Fisher ,

you can try with a global variable instead of a Local variable (I can see you are using UpdateContext).

So Instead of Local, you can use the Global variable
Local - UpdateContext({varFormData: Defaults(XYZFormSource)});

global - Set(varFormData: Defaults(XYZFormSource))

Thanks,

Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."-Vijay

 

Good morning,

 

Unfortunately it isn’t working when I use Set either. 

Hi @MJohnson-Fisher :

Please try:

OnStart :

If(
Param("DeepLink")="XYZForm",
Navigate(scrn_XYZFormPart1),
Param("DeepLink")="ABCForm",
Navigate(scrn_ABCFormPart1)
)

Then the OnVisible property of the form screen is set to 

If(
!IsBlank(Param("ID")),
UpdateContext({varFormData: Defaults(XYZFormSource)})
)

 Best Regards,

Bof

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (33,960)