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

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 @dhruvildave , 

 

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 @dhruvildave , 

 

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

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

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

tkhandelwal
Frequent Visitor

I am also facing the same problem

dhruvildave
Helper I
Helper I

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 

 

 

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.

dhruvildave
Helper I
Helper I

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
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,862)