Problem with sforce.apex.execute

I’m converting the following onclick javascript to a Skuid javascript snippet, and am getting an “Uncaught TypeError” at execute. Any ideas on how to resolve this?

Salesforce Button:

{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}<br>var originalValue = this.value;<br>this.value = "Processing...";<br>var request = new Object();<br>request.Action = "view";<br>request.AttachmentId = "{!ATT_EXP__Attachment__c.Id }";<br>request.UserAgent = navigator.userAgent;<br>debugger;<br>var attachmentURL = sforce.apex.execute("ATT_EXP.AttachmentsController","GetViewSignature",{JSONrequest:JSON.stringify(request)});<br>this.value = originalValue;<br>window.open(attachmentURL); 


Skuid Snippet:

var params = arguments[0], $ = skuid.$; models = skuid.model.map(); var attachmentId = models.Attachment_view.getFirstRow().Id; var originalValue = this.value; this.value = "Processing..."; var request = new Object(); request.Action = "view"; request.AttachmentId = attachmentId ; request.UserAgent = navigator.userAgent; var attachmentURL = sforce.apex.execute("ATT_EXP.AttachmentsController","GetViewSignature",{JSONrequest: JSON.stringify(request)}); this.value = originalValue; window.open(attachmentURL);

Brayden,

Where does ‘navigator.userAgent’ originate?  I don’t see it defined in your script.

Thanks,

Bill

Its defined by the browser. When I use console log to view the “request” variable, it appears correctly.

Brayden,

Do you have a reference on the Skuid page to the ajax resource?

/soap/ajax/29.0/apex.js



Thanks,

Bill

That’s what it was! Thanks for helping me resolve this.

-Brayden