Hi,
I have a requirement where I want to open Pdf file attached in the notes entity in new window using JS.
Regards,
Shoaib Khan.
Hi,
I have a requirement where I want to open Pdf file attached in the notes entity in new window using JS.
Regards,
Shoaib Khan.
Hi ShoaibKhan:
Please try the following code. I create an onload event to test:
function onLoad(executionContext){
var formContext = executionContext.getFormContext();
//your noteId
var noteId = "{aedf1d1d-10c7-d38a-b40a-d47f83729910}";
var result = Xrm.WebApi.retrieveRecord("annotation", noteId).then(
function success(result) {
var file = {fileContent:result.documentbody,fileName:result.filename,fileSize:result.filesize,mimeType:result.mimetype};
Xrm.Navigation.openFile(file,{openMode:1})
},
function(error) {
console.log(error.message);
}
);
}
P.S. There is something wrong with Insert Code, so I directly paste here.
It would open a new window to show it:
Reference:
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,214 Most Valuable Professional
nmaenpaa 101,156