Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I want to create a number field in sales force by using metadata api in c#. for this i got some example on net, those example are for creating text data type field. from these examples i created a function to create number field type in sales force. but as i run that function i got error that length is not specify for custom data type number. for all other data type like formula, text, date, date time my code work fine. but for number type i got error for length.

please guide me on that.

my code for number data type

C#
 cf.fullName = measureObjectName + "." + measureAttribute.FieldName;
 cf.label = measureAttribute.FieldLabel;
 cf.description = measureAttribute.Description;
 cf.inlineHelpText = measureAttribute.HelpText;
 cf.length = measureAttribute.Fieldlength
 cf.scale = measureAttribute.DecimalPlaces;
 cf.precision = measureAttribute.Fieldlength
 cf.required = measureAttribute.IsRequired;
 string fieldType = measureAttribute.DataType.ToLower();
 cf.precisionSpecified = true;
 cf.scaleSpecified = true;
 cf.lengthSpecified = true;
 cf.requiredSpecified = true;

 if (fieldType == "currency")
     cf.type = Spyrel.FieldType.Currency;
 if (fieldType == "number")
     cf.type = Spyrel.FieldType.Number;
 if (fieldType == "percent")
     cf.type = Spyrel.FieldType.Percent;

AsyncResult r = _metaBinding.create(new Metadata[] { cf })[0];


Thanks

Rohit Sharma
Posted
Comments
[no name] 21-Aug-12 15:12pm    
You might be better off asking in a SalesFarce forum.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900