+ Start a Discussion

Insert record via Flex

I'm trying to use the code below to insert a new ViewTime (custom object) record into Salesforce. Currently I'm getting a "Cannot access a property or method of a null object reference" when I try to set ANY of the properties. I've even commented them out and tried to set just one at a time but none of them will accept a value. Apparently I'm instantiating the SObject incorrectly, but the code below is what I've found in all of the examples that I could find online. Am I missing an import?


                   var vidView:SObject = new SObject('ViewTime__c');
                   vidView.Name = _config.clipId + new Date().toString();
                   vidView.observationVideo__c = _config.clipId;
                   vidView.User__c = _config.userId;
                   _conn.create( [vidView],
                             new AsyncResponder(
                                function handleSaveResult():void {
                                    log.debug("view saved");