Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
RogerT
Frequent Visitor

Error in Q&A Embedded

We have a problem in our first try to embed Q&A dashboard feature.

Both the accessToken, embedUrl and the datasetIds are correct. We have checked it in the demo.

The error in console browser "uncaught exception: [object Object]" appears with the following code and only the default power bi dashboard loading icon is displayed.

 

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<script src="../Scripts/jquery-3.2.1.js"></script>
<script src="../Scripts/powerbi.js"></script>
<title>Try</title
</head>
<body>
<script type="text/javascript">
window.onload = function () {
 
var models = window['powerbi-client'].models;
            var embedConfiguration = {
                type: 'qna',
                tokenType: models.TokenType.Embed,
                accessToken: 'H4sIAAAAAAAEACWWxw6saA...',
                embedUrl: 'https://app.powerbi.com//qnaEmbed?groupId=540ae43e-40f5-4d8a-8f39...',
                datasetIds: '4f8a276f-1288-4747-87c2-94865...',
                viewMode: models.QnaMode.Interactive
            };
            var qnaContainer = $('#qnaContainer')[0];
            var qna = powerbi.embed(qnaContainer, embedConfiguration);
            qna.off("loaded");
}
</script> 
<div id="qnaContainer"></div>
</body>
</html>  

QAErrorReport.png
Any ideas?

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee

@RogerT

I've just tested with the datasetId, embed url etc from the demo, and below code works. In your code, you assign a datasetid '4f8a276f-1288-4747-87c2-94865...' to the datasetIds where I think an arrary is required, try to pass an array as ['4f8a276f-1288-4747-87c2-94865...'] instead.

 

<html>

<script src="jquery.js"></script>  
<script src="powerbi.js"></script>

<script type="text/javascript">
window.onload = function () {  

var models = window['powerbi-client'].models;

var config= {
    type: 'qna',
    tokenType: models.TokenType.Embed,
    accessToken: 'H4sIAXXXXX',
    embedUrl: 'https://app.powerbi.com//qnaEmbed?groupId=9166cf8d-d5fc-405e-bdc7-47e414da08fe',
    datasetIds: ['ea4ad17d-bd5b-4502-a7a2-1e92e4d09532'],
    viewMode: models.QnaMode.Interactive
};
 
// Get a reference to the embedded QNA HTML element
var qnaContainer = $('#qnaContainer')[0];
 
// Embed the QNA and display it within the div container.
var qna = powerbi.embed(qnaContainer, config);
 
// qna.off removes a given event handler if it exists.
qna.off("loaded");
 
// qna.on will add an event handler which prints to Log window.
qna.on("loaded", function(event) {
    Log.logText("QNA loaded event");
    Log.log(event.detail);
}); 
} 
 
</script> 
 
<div id="qnaContainer"></div>

</html>   

 

View solution in original post

1 REPLY 1
Eric_Zhang
Microsoft Employee
Microsoft Employee

@RogerT

I've just tested with the datasetId, embed url etc from the demo, and below code works. In your code, you assign a datasetid '4f8a276f-1288-4747-87c2-94865...' to the datasetIds where I think an arrary is required, try to pass an array as ['4f8a276f-1288-4747-87c2-94865...'] instead.

 

<html>

<script src="jquery.js"></script>  
<script src="powerbi.js"></script>

<script type="text/javascript">
window.onload = function () {  

var models = window['powerbi-client'].models;

var config= {
    type: 'qna',
    tokenType: models.TokenType.Embed,
    accessToken: 'H4sIAXXXXX',
    embedUrl: 'https://app.powerbi.com//qnaEmbed?groupId=9166cf8d-d5fc-405e-bdc7-47e414da08fe',
    datasetIds: ['ea4ad17d-bd5b-4502-a7a2-1e92e4d09532'],
    viewMode: models.QnaMode.Interactive
};
 
// Get a reference to the embedded QNA HTML element
var qnaContainer = $('#qnaContainer')[0];
 
// Embed the QNA and display it within the div container.
var qna = powerbi.embed(qnaContainer, config);
 
// qna.off removes a given event handler if it exists.
qna.off("loaded");
 
// qna.on will add an event handler which prints to Log window.
qna.on("loaded", function(event) {
    Log.logText("QNA loaded event");
    Log.log(event.detail);
}); 
} 
 
</script> 
 
<div id="qnaContainer"></div>

</html>   

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.