+ Start a Discussion
kminevkminev 

Extend Sobject in flex SFDC

Hi,

 

I've been trying to extend Sobject class in flex actionscript 3 code, but so far no success.

 

I have my custom object for example MyObject__c and I would like to have a class MyObjectVo extends Sobject

in flex so I can have strongly typed object for faster development in my code instead of having to have hard coding the properties.

 

Any ideas, a code sample will be exteremly helpful.

 

Here is what I've got:

 

 package com.seventicks.timesheet.model.vo
{
    public class TimesheetVo
    {
        public var type:String = "Timesheet__c";
        public var Activity__c:String;   
        public var ActivityType__c:String;
        
        public function TimesheetVo()
        {

        }    
    }
}

Best Answer chosen by Admin (Salesforce Developers) 
arunkarunk

Hi,

 

The only example i have seen of something like this had a function getSObject() would be something like this

 

function getSObject():SObject

{

  var obj:Object = {};

obj.type =  "Timesheet__c";

obj.Activity__c = this.Activity__c;

obj.ActivityType__c = this.ActivityType__c; 

  return new SObject(obj);