Quantcast
Channel: CRM Development Forum
Viewing all articles
Browse latest Browse all 888

Display word document attached to a record in new window.

$
0
0

Hello ,

How to display the annotation in a window on ribbon button click. My requirement is to display the profile uploaded as annotation in a record on ribbon button click. Below is the code i have used to get the annotation. I'm not getting how to display the content in a window. Alert is diplaying the content in decrypted format.

function popup()
{
 var serverUrl = Xrm.Page.context.getServerUrl();
//debugger;
    var GUIDvalue = Xrm.Page.data.entity.getId();
    // Creating the Odata Endpoint
    var oDataPath = serverUrl+"/XRMServices/2011/OrganizationData.svc/";
    var retrieveReq = new XMLHttpRequest();
    var Odata = oDataPath + "/AnnotationSet?$select=DocumentBody,FileName,MimeType,ObjectId&$filter=ObjectId/Id eq guid'" + GUIDvalue + "'";
    retrieveReq.open("GET", Odata, false);
    retrieveReq.setRequestHeader("Accept", "application/json");
    retrieveReq.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    retrieveReq.onreadystatechange = function () { retrieveReqCallBack(this); };
    retrieveReq.send();
}
function retrieveReqCallBack(retrieveReq)
{
    if (retrieveReq.readyState == 4 /* complete */)
    {
 var retrieved = this.parent.JSON.parse(retrieveReq.responseText).d;
var n = retrieved.results.length;
var fd10 = retrieved.results[0].FileName;
var dc12 = retrieved.results[0].DocumentBody;
alert(dc12);
            // logic
        }
}


Thanks and Regards. Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.



Viewing all articles
Browse latest Browse all 888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>