cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jrybachek
Helper I
Helper I

Deep Linking to Record

Hello, 

 

I am trying to set up deep linking in my Power Apps following the video How to Migrate from App OnStart by Bulb Digital 

 

I have created an app StartScreen, LoadingScreen with OnVisible property of:

 

 

 

Set(
    isAppLoaded,
    false
);
If(
    IsBlankOrError(Param("ticketID")),
    Set(
        SelectedItemID,
        Value(Param("ticketID"))
    )
);
Set(varItemSelected, true);
Set(
    isAppLoaded,
    true
);

 

 

With a timer on the LoadingScreen and an OnTimerEnd property of:

 

 

If(varItemSelected,Navigate(OrderFormScreen), Navigate(Screen1));

 

 

And for the OrderFormScreen OnVisible property:

 

 

If(Not(IsBlank(SelectedItemID)), UpdateContext({varRecord:LookUp(PCSOrders, TicketNumber = SelectedItemID)}))

 

 

I have tried to enable the OnStart of the app and I cannot get that to show. Here is the screen I get when trying to load a specific record:

jrybachek_0-1656948351111.png

I appreciate any help you may be able to provide.

 

1 ACCEPTED SOLUTION

Accepted Solutions

@jrybachek ,

Try the same thing using the deep link - just put all the code on the Button

If(
   !IsBlankOrError(Param("ticketID")),
   Set(
      gblID,
       LookUp(
          PCSOrders, 
          TicketNumber = Param("ticketID")
       ).ID
    )
);
If(
   gblID > 0,
   Navigate(OrderFormScreen), 
   Navigate(Screen1)
);

and the Form Item

LookUp(
   PCSOrders, 
   ID = gblID
)

I also suggest you get away from using a Variable as the Item of a form - unless you update the Variable  -OnSuccess use

Set(
   varRecord,
   Self.LastSubmit
)

your form will not show the current state of the record. I use the gblID on every form I have and it works perfectly.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

View solution in original post

14 REPLIES 14
WarrenBelz
Super User
Super User

@jrybachek ,

I can see one immediate issue - your OnVisible code should be (note ! Not)

If(
    !IsBlankOrError(Param("ticketID")),
    Set(
        SelectedItemID,
        Value(Param("ticketID"))
    )
);

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

jrybachek
Helper I
Helper I

I made the suggested change and have the same error screen.

@jrybachek ,

That was the first obvious item I saw - the next one is your bracketing 

Set(
    isAppLoaded,
    false
);
If(
    !IsBlankOrError(Param("ticketID")),
    Set(
        SelectedItemID,
        Value(Param("ticketID"))
    );
   Set(
      varItemSelected, 
      true
   );
   Set(
     isAppLoaded,
      true
   )
);

The way you had it previously, varSelectedItem was always set to true.

So what I can see you are doing here is that if the incoming parameter ticketID exists, then

If(
   varItemSelected,
   Navigate(OrderFormScreen), 
   Navigate(Screen1)
);

navigate to the OrderFormScreen, otherwise (no parameter exists) navigate to Screen1

If you go to the OrderFormScreen

If(
   !IsBlank(SelectedItemID), 
   UpdateContext(
      {
         varRecord:
         LookUp(
            PCSOrders, 
            TicketNumber = SelectedItemID
         )
      }
   )
)

you then set varRecord (which I assume is the Item of the Order Form) to the TicketNumber in PCS Orders. If all of this is true, there is nothing wrong with the code above and it should work unless your issue lies outside of what you have posted.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

 

jrybachek
Helper I
Helper I

Unfortunately, same error. You are correct that the varRecord is intended to be the Item for the OrderForm. That was how it was configured before getting into deep linking. 

 

Of note, I am also getting a warning on the OrderFormScreen, of "Incompatible types for comparison: text, number" which is erroring on the TicketNumber = SelectedItemID. 

 

Really what it comes down to is that I am trying to get deep linking to work, whichever will work the best.

 

I appreciate your help!

@jrybachek ,

It would have been good to post that piece of information at the start - it may explain the issue if you have an invalid property for the record on your Form. Assuming the TicketNumber is a Text field (which from the error it appears to be), you need to change this

If(
    !IsBlankOrError(Param("ticketID")),
    Set(
        SelectedItemID,
        Param("ticketID")
    );

Note Value() turns the Variable into a number.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

jrybachek
Helper I
Helper I

I apologize for leaving that out. I have corrected that issue and still get the same error. 

@jrybachek ,

It has to be something else not included in your post as the code (now corrected) would simply open either Screen1 or the OrderFormScreen at the desired record. You could also possibly have a corrupt app. Try exporting it as a Zip package and then re-importing with another name. Also does it open if no opening parameter is used ?

jrybachek
Helper I
Helper I

It does open to Screen1 without a parameter. I believe it has something to do with variable varRecord as now I am unable to open the OrderFormScreen from Screen1 which was using varRecord to pass ThisItem from Screen1 to OrderFormScreen.

 

I will go through those steps to see what I can find

 

WarrenBelz
Super User
Super User

Hi @jrybachek ,

I use incoming parameters regularly in apps, so I will include my method in regard to your values - Variable

If(
   !IsBlankOrError(Param("ticketID")),
   Set(
      gblID,
       LookUp(
          PCSOrders, 
          TicketNumber = Param("ticketID")
       ).ID
    )
);

 then the Navigation

If(
   gblID > 0,
   Navigate(OrderFormScreen), 
   Navigate(Screen1)
);

Then the Form Item

LookUp(
   PCSOrders, 
   ID = gblID
)

This makes absolutely certain you have a record present to navigate to

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,235)