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
  • 1
    Can you maybe add the request and response payloads as text?
    – Adrian Larson
    Commented Aug 7, 2017 at 19:03

1 Answer 1

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.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .