cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ArafatTehsin
Resolver I
Resolver I

Pass context on multiple screens

Hi folks

 

My scenario is this (understanding of the scenario is super important for you to answer)

 

I have X screens;

 

a. Main Screen

b. Summary Screen

c. A Screen

d. B Screen

c. C Screen

 

Main Screen 

 

This screen has got a gallery which is bound to one of the entities in CDS called Job. 

 

Upon clicking of any item of the job, I am navigating it to the Summary screen. I have written this in OnSelect method of the Gallery.

Set(JobItem,GalleryJobList.Selected);
Navigate(Summary,ScreenTransition.Cover,JobItem);

 

 

Summary Screen

 

Some labels are bound to some of the properties of JobItem context variable which is passed to it by Main screen. 

 

This screen has a DropDown which is bound to a local collection that contains DisplayName and ScreenName. Upon clicking of this, my app should navigate to the appropriate selected item's screen (which it is doing perfectly fine). However, I want to pass the context JobItem OnChange / OnSelect of the Drop Down. When I try to navigate without context variable, it does not give me any error. However, when I try to pass the same (or any new) context variable, I get this error;

 

Context variables cannot be used here. Context variables can only be bound to a single, specific screen.

 

How do I fix this?

 

Please note that I do not get this error when I add the same code on OnSelect of a button on the same Summary screen.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @ArafatTehsin ,

Do you want to pass variable by using navigate function?

Did you use this formula?

Set(JobItem,GalleryJobList.Selected);
Navigate(Summary,ScreenTransition.Cover,JobItem);

If so, the reason why you met this problem is that navigate function could only pass context variables , not global variables.

While using Set function will create a global variable, not a context variable.

The right syntax of navigate should be like:

NavigateScreen [, Transition [, UpdateContextRecord ] ] )

The function about creating  context variables should be inside navigate function, not pre-defined.

Try this formula:

Navigate(Summary,ScreenTransition.Cover,{JobItem:GalleryJobList.Selected})

 

Here's a doc about this function for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-navigate

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
WarrenBelz
Super User
Super User

Hi @ArafatTehsin ,

I know this may not be the answer for reasons you have not specified, but why cannot you use a Global Variable?

Hi @WarrenBelz 

 

I just tried with the Global variables and the behavior is same, buggy. 

Thanks @ArafatTehsin ,

Your subject was "Pass context on Multiple screens", which a Global Variable is much better at doing without the sort of parameter management you need with Context Variables.

It seems your issue may be deeper in what is happening when you use the Variable and how you are using it.

So what it is that you are passing that is not working as expected and how are you trying to use it?

Apologies on the confusing subject line but I have explained my scenario in the post. If you have got any specific question to understand this then please let me know. I can shorten it in 3 lines for you.

 

I have a Drop Down control. I have defined a Navigate(ScreenName,Transition) defined in OnSelect or OnChange method of a the drop down control. It works great. However, I want to pass a context variable with that navigation method. It gives me an error as explained above. Why is that? Why I can't pass the context variable on Navigate function in OnSelect or OnChange of a drop down where I can pass the same in Button's OnSelect? 

No problems @ArafatTehsin ,

I did not pick up the importance context of that bit.

I have just done a couple of tests here and passed a Context Variable perfectly to another screen on the OnChange of a drop-down.

Maybe do another drop-down with just the Navigate and Variable code and put a label on the screen to see if it arrives.

Hi @ArafatTehsin ,

Do you want to pass variable by using navigate function?

Did you use this formula?

Set(JobItem,GalleryJobList.Selected);
Navigate(Summary,ScreenTransition.Cover,JobItem);

If so, the reason why you met this problem is that navigate function could only pass context variables , not global variables.

While using Set function will create a global variable, not a context variable.

The right syntax of navigate should be like:

NavigateScreen [, Transition [, UpdateContextRecord ] ] )

The function about creating  context variables should be inside navigate function, not pre-defined.

Try this formula:

Navigate(Summary,ScreenTransition.Cover,{JobItem:GalleryJobList.Selected})

 

Here's a doc about this function for your reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-navigate

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (972)