Function openCrmDocument not working in service.

lock
push_pin
done
Answered
3

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

22 Dec 2023 | 09:20 AM

All Replies (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.

4 Jan 2024 | 08:13 AM

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

4 Jan 2024 | 01:16 PM

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, "*");
   }

 

5 Jan 2024 | 10:01 AM

Add reply