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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
gotters
Resolver I
Resolver I

saveAsTriggered not firing for Save As in Embedded

The SaveAsTriggered event is not firing for me when embedding a report.

 

Even in the playground I cant get it to fire.

Is there something obvious that I am missing?

 

Try the following code in playground:

https://playground.powerbi.com/en-us/dev-sandbox

 

// Embed a Power BI report in the given HTML element with the given configurations
// Read more about how to embed a Power BI report in your application here: https://go.microsoft.com/fwlink/?linkid=2153590
function embedPowerBIReport() {
/*-----------------------------------------------------------------------------------+
| Don't change these values here: access token, embed URL and report ID. |
| To make changes to these values: |
| 1. Save any other code changes to a text editor, as these will be lost. |
| 2. Select 'Start over' from the ribbon. |
| 3. Select a report or use an embed token. |
+-----------------------------------------------------------------------------------*/
// Read embed application token
let accessToken = EMBED_ACCESS_TOKEN;

// Read embed URL
let embedUrl = EMBED_URL;

// Read report Id
let embedReportId = REPORT_ID;

// Read embed type from radio
let tokenType = TOKEN_TYPE;

// We give All permissions to demonstrate switching between View and Edit mode and saving report.
let permissions = models.Permissions.All;

// Create the embed configuration object for the report
// For more information see https://go.microsoft.com/fwlink/?linkid=2153590
let config = {
type: 'report',
tokenType: tokenType == '0' ? models.TokenType.Aad : models.TokenType.Embed,
accessToken: accessToken,
embedUrl: embedUrl,
id: embedReportId,
permissions: permissions,
settings: {
panes: {
filters: {
visible: true
},
pageNavigation: {
visible: true
}
}
}
};

// Get a reference to the embedded report HTML element
let embedContainer = $('#embedContainer')[0];

// Embed the report and display it within the div container.
report = powerbi.embed(embedContainer, config);

// report.off removes all event handlers for a specific event
report.off("loaded");

// report.on will add an event handler
report.on("loaded", function () {
loadedResolve();
report.off("loaded");
});

// report.off removes all event handlers for a specific event
report.off("error");

report.on("error", function (event) {
console.log(event.detail);
});

// report.off removes all event handlers for a specific event
report.off("rendered");

// report.on will add an event handler
report.on("rendered", function () {
renderedResolve();
report.off("rendered");
});
}

embedPowerBIReport();
await reportLoaded;

// Insert here the code you want to run after the report is loaded

await reportRendered;

// Switch to edit mode.
report.switchMode("edit");

// Insert here the code you want to run after the report is rendered
// report.off removes all event handlers for a specific event
report.off("saveAsTriggered");

// report.on will add an event listener.
report.on("saveAsTriggered", function (event) {
console.log(event);
});

// Select Run and then select SaveAs.
// You should see an entry in the Log window.

console.log("Select SaveAs to see events in Log window.");
1 ACCEPTED SOLUTION
gotters
Resolver I
Resolver I

Figured it out. I needed to modify the embed config to include
settings: {
useCustomSaveAsDialog: true
}

Then you do need to use your own Save As Modal but then at least the saveAsTriggered will fire!

View solution in original post

2 REPLIES 2
gotters
Resolver I
Resolver I

Figured it out. I needed to modify the embed config to include
settings: {
useCustomSaveAsDialog: true
}

Then you do need to use your own Save As Modal but then at least the saveAsTriggered will fire!

Anonymous
Not applicable

Hi @gotters ,

 

I am so glad that you could solve your issue by yourself. Please kindly Accept your workaround as the solution. More people will benefit from it. 

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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.

Top Solution Authors