cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
aarshps Frequent Visitor
Frequent Visitor

Pass value to the embedded app from custom visual

Hi all,

 

I want to pass values to the embedded app from the custom visual used in my report. For eg. I want to raise an event when a click event occurs inside the custom visual so that I can take necessary actions in my embedding app.

 

For eg. I'll be having different player photos shown in a grid, 2 * 3 grid. So there will be a menu icon besides the photos of each photos. These menu icon are custom visuals. And when I click on these custom visuals, I will try to raise an event, or send a message to the parent window, i.e. the parent app where the page is embedded and take necessary actions in the parent app.

 

Necessary actions might be a popup with the player details like age, speed etc. How can I do this?

8 REPLIES 8
Moderator v-viig
Moderator

Re: Pass value to the embedded app from custom visual

Have you tried window.window.postMessage to send data from ifame into main window?

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

 

 

aarshps Frequent Visitor
Frequent Visitor

Re: Pass value to the embedded app from custom visual

Tried, but not working. Is there any other solution? Is the sandboxed iframe blocking these events?

Moderator v-viig
Moderator

Re: Pass value to the embedded app from custom visual

As far as I know, Power BI doesn't block such events since it's used for communication between main window and other custom visuals.

Can you share the code for furhter debugging?

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

SolomoN-ua Frequent Visitor
Frequent Visitor

Re: Pass value to the embedded app from custom visual

Hi,

 

same problem here.

 

In the other thread (link), you were saying that PowerBI uses iframe sandbox, maybe that is why postMessage is not working?

 

Regards,

Anatoliy

Moderator v-viig
Moderator

Re: Pass value to the embedded app from custom visual

Correct. Custom Visuals API loads visuals in an iframe.

 

Why do you want to use postMessage?

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

aarshps Frequent Visitor
Frequent Visitor

Re: Pass value to the embedded app from custom visual

Sorry for the late reply.

 

It is possible to achieve what I was trying to do. What I had in mind is I have a button on my Power BI report. When I click on the button, a popup appears in the application where my Power BI report is embedded. So I wanted the application to recieve an event trigger when the Power BI report button is pressed. This was achieved using a custom visual that I wrote. The visual simply passed a string value to the parent windows so that I was able to recieve the event.

Moderator v-viig
Moderator

Re: Pass value to the embedded app from custom visual

Thanks for the details.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

jwenger100 Frequent Visitor
Frequent Visitor

Re: Pass value to the embedded app from custom visual

Did you end up having to use postMessage to accomplish it?