Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating Custom fields from Flex (Salesforce)
    text
    copied!<p>I'm trying to CREATE custom fields from flex, but I'm having hard time finding the correct syntax.</p> <p>Below is the piece of code that I'm using and it's resulting in error "<strong>sf:INVALID_TYPE INVALID_TYPE: null objects not allowed in create/update request</strong>"</p> <pre><code> var con:Connection = new Connection(); var lRequest:LoginRequest = new LoginRequest(); lRequest.username = username1.text; lRequest.password = password1.text; lRequest.callback = new mx.rpc.Responder(createFields, loginFault); con.login(lRequest); //CreateFields Method .... var externalIdField:CustomField = new CustomField(); externalIdField.label = 'ProductionId'; externalIdField.type = FieldType.ID; externalIdField._length = 18; externalIdField.externalId = true; externalIdField.unique = true; var customObjectVar:CustomObject = new CustomObject(); customObjectVar["type"] = "Account"; customObjectVar.addField(externalIdField); var objarray:Array = []; objarray[0]=customObjectVar; con.updateObject(objarray,new mx.rpc.Responder(saveresults,sfdcFailure)); </code></pre> <p>Tried below alternate way (as suggested by Simon), that too results in error </p> <blockquote> <p>"soapenv:Client Element {http://soap.sforce.com/2006/04/metadata}type invalid at this location"</p> </blockquote> <pre><code> var externalIdField:CustomField = new CustomField(); externalIdField.fullName = 'Account.ProductionId__c'; externalIdField.type = FieldType.STRING; externalIdField._length = 18; externalIdField.externalId = true; externalIdField.unique = true; var objarray:Array = []; objarray[0]=externalIdField; con.updateObject(objarray,new mx.rpc.Responder(saveresults,sfdcFailure)); </code></pre> <p>`</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload