• Baldeep Hira
  • 0 Points
  • Member since 2008

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 0
Hi Everyone,

I'm trying to use Salesforce metadata API with flex toolkit, not sure if the metadata API is fully supported and tested with flex toolkit (drop dated Feb 22, 2008)?  First off, the compiled as3Salesforce.swc library does not contain required metadata classes like CustomObject, CustomField, etc.  I figured this might be a linking problem in sample Salesforce.mxml file, as it contains no examples for metadata API.  To work around this problem, I've included the source files under toolkit/sdk/src into my flex project.  When I try to create a custom object using Connection.createObject(customObjectArray, asyncResponder) I get the following runtime error:
  context = (null)
  detail = (null)
  faultcode = "soapenv:Client"
  faultstring = "Must specify a {http://www.w3.org/2001/XMLSchema-instance}type attribute value for the {http://soap.sforce.com/2006/04/metadata}metadata element"
My flex code looks like this:
var cf:CustomField = null;
var co:CustomObject = new CustomObject();
co.fullName = DashboardMdl.OBJECT_NAME;
co.label = DashboardMdl.OBJECT_LABEL;
co.pluralLabel = DashboardMdl.OBJECT_LABEL + "s";
co.description = "Custom object for storing SfDash dashboards.";
co.deploymentStatus = DeploymentStatus.Deployed;
co.enableActivities = true;
co.sharingModel = SharingModel.ReadWrite;

cf = new CustomField();
cf.label = "Name";
cf.type = FieldType.Text;
co.nameField = cf;

var coArray:Array = new Array();

  new AsyncResponder(function (result:Object):void {
    trace("something created, perhaps Custom object!!!.");
  }, sfFault)
Has anyone tried using metadata API with flex toolkit?  Any suggestions?

Thanks in advance,
Baldeep Hira