cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Get Work Order Id with ModelDrivenFormIntegration in embedded canvas app when app loads.

Hi Power Apps Community,

My issue is that I could not get the value of Work Order Id or name of WorkOrder Entity entity in my canvas app.

I created a New tab in WorkOrder View Form and embedded a new canvas app in it. I used this tutorial https://aaronkgumbs.com/2021/07/24/how-to-enable-modeldrivenformintegration-for-existing-canvas-apps....

After using above url, We can get ModelDrivenFormIntegration Entity in canvas app.

I am using a PCF component in canvas app and I have to send WorkOrder ID in PCF component property like this.

Screenshot 2021-12-03 at 5.04.39 PM.png

According to this MS Documentation https://docs.microsoft.com/en-us/powerapps/maker/model-driven-apps/embedded-canvas-app-add-classic-d... We can get any record of the table using ModelDrivenFormIntegration.Item.accountnumber. In my case I have to use msdynworkorderid. But I am not able to get the correct record of data.every time it is giving null value.

After doing some research, it seams as the ModelDrivenFormIntegration control has not been initialised yet when app loads.

So i check this blog which shows 2 possible solutions https://carinaclaesson.com/2020/05/30/exploring-the-modeldrivenformintegration-control-in-embedded-c...

Add a timer or set the formula on the RefreshData property of the ModelDrivenFormIntegration control.

Both solutions doesn't work and Used formulas are also giving Errors.

 

Looking forward to your solution / advice.

Many thanks,

Dhruvil

1 ACCEPTED SOLUTION

Accepted Solutions
PowerAddict
Super User
Super User

Hi @Anonymous , 

 

Are you suggesting that you are not getting the value of a column of a related table? If so, suggest looking up the contextual record first and then using it to fetch the related table's column value(s). 

 

On the app OnStart, I always do this:

Set(gblRecord, LookUp(Table, GUID = ModelDrivenFormIntegration.Item.GUID))

Then get the related table's value like this:

Set(gblRelatedTableValue, gblRecord.RelatedTable.Column)

Here is a blog I have on everything related to embedded canvas apps: https://thepoweraddict.com/everything-you-need-to-know-about-embedded-canvas-apps/ (Post #3).

 

Let me know if this helps. 

 

---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

 

Thanks!

Hardit Bhatia

Microsoft Business Applications MVP

Microsoft Certified Trainer MCT

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

View solution in original post

10 REPLIES 10
PowerAddict
Super User
Super User

Hi @Anonymous , 

 

Are you suggesting that you are not getting the value of a column of a related table? If so, suggest looking up the contextual record first and then using it to fetch the related table's column value(s). 

 

On the app OnStart, I always do this:

Set(gblRecord, LookUp(Table, GUID = ModelDrivenFormIntegration.Item.GUID))

Then get the related table's value like this:

Set(gblRelatedTableValue, gblRecord.RelatedTable.Column)

Here is a blog I have on everything related to embedded canvas apps: https://thepoweraddict.com/everything-you-need-to-know-about-embedded-canvas-apps/ (Post #3).

 

Let me know if this helps. 

 

---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

 

Thanks!

Hardit Bhatia

Microsoft Business Applications MVP

Microsoft Certified Trainer MCT

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

Anonymous
Not applicable

Hi @PowerAddict 

Thanks for your suggestion.

I don't want to get data from related tables. I need to retrieve the data of current work order data in which I have added my canvas app.

In simple way, I only want to show the Work Order display name in my Canvas app.

Screenshot 2021-12-16 at 11.29.58 AM.png

Instead of ```abcd``` I need to print WorkOrder Name(Text) which is ```00507```

 

EDIT: I also tried formulas suggested by you but they started giving me formula errors.

Screenshot 2021-12-16 at 11.34.47 AM.png

 

Thanks!

PowerAddict
Super User
Super User

That should just be this:

LookUp('Work Orders', 'Work Order' = [@ModelDrivenFormIntegration].Item.'Work Order').'Work Order Number'

Replace 'Work Order Number' with the column name for work order number. Let me know if this doesn't work. 

 

---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

 

Thanks!

Hardit Bhatia

Microsoft Business Applications MVP

Microsoft Certified Trainer MCT

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

Anonymous
Not applicable

I tried your formula but it started giving these errors in the formula itself. 

  1. The function 'LookUp' has some invalid arguments.

  2. Incompatible type. We can't evaluate your formula because the context variable types are incompatible with the types of values in other places in your app.

Screenshot 2021-12-16 at 4.40.43 PM.png

PowerAddict
Super User
Super User

Well, I assumed column names. You need to replace 'Work Order' with whatever the name is of the GUID column on the Work Orders table and replace 'Work Order Number' with whatever the name is of the work order number column. Let me know if this helps. 

 

---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

 

Thanks!

Hardit Bhatia

Microsoft Business Applications MVP

Microsoft Certified Trainer MCT

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

Anonymous
Not applicable

I am also facing the same problem

Anonymous
Not applicable

I tried this solution by replacing 'Work Order' with msdyn_workorder. I checked this form here.

But the result is the same. For reference, I am adding the Canvas app here.

msdyn_workorder EntityType 

 

 

Anonymous
Not applicable

I tried this solution by replacing 'Work Order' with msdyn_workorder. I checked this from here https://docs.microsoft.com/en-us/dynamics365/customer-engagement/web-api/msdyn_workorder?view=dynami... .

But the result is same. For reference I am adding Canvas app here.

Anonymous
Not applicable

I tried @PowerAddict 's suggested blog and compared the canvas app with my canvas app and I managed to make it work by adding a Work Order Table in Canvas app.

Screenshot 2022-01-05 at 12.45.28 PM.png

Now i can get current work order record in the canvas app using this formula 

 

 

ModelDrivenFormIntegration.Item.'Work Order Number'

 

 

Thanks @PowerAddict,

It was very useful blog https://thepoweraddict.com/everything-you-need-to-know-about-embedded-canvas-apps/.

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,573)