0

Try to test remote objects in visualforce from a prechat form. Get a status :POST 200 but the record does not actually get inserted. enter image description here

<!-- Remote Objects definition to set accessible sObjects and fields -->
<apex:remoteObjects>
    <apex:remoteObjectModel name="ifttt__IFTTT_Event__c" jsShorthand="ifEvent" fields="Id,Name,ifttt__Message__c,ifttt__Type__c">
    </apex:remoteObjectModel>
</apex:remoteObjects>
 <input type="submit" value="Request Chat" class="form-control" id="prechat_submit" onclick="createEventForSF();"/>

 <script type="text/javascript">
    function createEventForSF() {
        var ct = new SObjectModel.ifEvent({
            Name: 'TEST',
            ifttt__Message__c: 'Event from Chat',
            ifttt__Type__c: 'Equipment'});
        ct.get('Name');
        ct.get('ifttt__Message__c');
        ct.get('ifttt__Type__c');
        ct.create();
    } 
    </script>

Any idea what I could be doing wrong?

  • 1
    Can you maybe add the request and response payloads as text? – Adrian Larson Aug 7 '17 at 19:03
0

Found the answer. The profile for the site.com site the PreChat form was being hosted on did not have create access to object I was trying to insert.

| improve this answer | |
  • You should accept this answer, so that others know this question has been answered. – battery.cord Aug 7 '17 at 20:45
  • Cant accept your own answer for two days after oc is posted. – Allen Mann Aug 7 '17 at 22:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.