Function openCrmDocument not working in service.
Hello,
we have a customer that uses the openCrmDocument function (which uses webtools) in order to open and edit S&M documents in the old service, but it seems like it stopped working after the latest update.
Now when i try to edit the document, the call succeeds but the document won´t open, the document becomes locked for editing in S&M aswell.
I tried this function in a onsite enviroment (Version 10.1.6) and it works as intended there.(The document is opening after pressing the button.)
This is the function i have been using to test.
openCrmDocument("Insert documentId here", "https://online4.superoffice.com/CustXXXXX");
function openCrmDocument(p_documentId, p_soUrl) {
var postData = {
"method": "SuperOffice.CRM.Web.AjaxMethods.Document.CheckoutAndOpenDocumentWithTrayApp",
"arguments": [p_documentId]
};
$.ajax({
type: "POST",
dataType: "json",
contentType: "application/json",
data: JSON.stringify(postData),
url: p_soUrl +
"/clientapi/sessionrequiredmethods/method?ajaxmethod=SuperOffice.CRM.Web.AjaxMethods.Document.CheckoutAndOpenDocumentWithTrayApp"
})
.done(function (result) {
// Success
console.log(result);
console.log("Api call success")
})
.fail(function (e) {
console.log(e);
alert(
"Failed to open document, This is most likley because you havent installed SuperOffice Webtools."
);
});
}
Let me know if ii can provide any more information.
Regards
Fredrik
Alles Antwoorden (3)
Hi Fredrik, checking application insight here I can not see any exceptions so need a bit more info, please open a support case.
Update - this is an internal API, not ment to be used by externals. We have changed how it works to fit our needs.
We solved it, case closed
And we understand that its used for internal use, but, since its the only way we can give a good user experience regarding working with files, we are willing to take that chance that it might break from time to time.
Regards
Pär Pettersson
Just a quick comment - if this is a screen used as a webpanel in the sales client, then using crossmessaging would make sure this works even with our changed behaviour for webtools:
function openCrmDocument(p_documentId, p_soUrl) {
var message = { "command": "openDocument", "arguments": p_documentId};
parent.postMessage(message, "*");
}