function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
adreameradreamer 

Metadata API: Creating a textarea custom field results in a string type of field in salesforce

Hi All,

 

I am using the Metadata API to add custom fields to a custom object.

 

The custom fields created should be identical in terms of field type to existing standard or custom fields in other standard or custom objects. For instance, I need to create a custom field that is of the same type as the Account Shipping Street.

 

The Account.ShippingStreet in salesforce is of type: textarea and length 255

 

When using the Metadata API to create a custom field of the same type, the field created ends up being of type: string and length 255, instead of type textarea.

 

I am using the deploy() method of the Metadata API so I create the package.xml file on the fly and deploy it. The <type> element in the file is textarea, and the <length> is 255.

 

Any ideas what I am missing here would be much appreciated.

 

Fernando

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
adreameradreamer

Sure.

 

My statement in the originl post: "I am using the deploy() method of the Metadata API so I create the package.xml file on the fly and deploy it. The <type> element in the file is textarea, and the <length> is 255. " was incorrect. The <type> element was text instead of textarea, so this is why it was creating a string instead of a textarea. 

 

Hope it helps.

 

Fernando

All Answers

adreameradreamer

Please disregard this. Sorted.

 

Thanks,

Fernando

 

_Prasu__Prasu_

Could you share the solution so that it can help other developers?

 

adreameradreamer

Sure.

 

My statement in the originl post: "I am using the deploy() method of the Metadata API so I create the package.xml file on the fly and deploy it. The <type> element in the file is textarea, and the <length> is 255. " was incorrect. The <type> element was text instead of textarea, so this is why it was creating a string instead of a textarea. 

 

Hope it helps.

 

Fernando

This was selected as the best answer
Bhaskar2013Bhaskar2013

I am able to create  TEXTAREA custom datatype using metadat api. But not able to set a length of 4000. It return with error message "WebService returned a SOAP Fault: null: Can not specify 'length' for a CustomField of type TextArea".

 

How to specify Text Area (Long) or Text Area (Rich)? SO that I can specify length? Please help me.

Bhaskar2013Bhaskar2013
Got it!..It should be specified as "LongTexArea" with VisibleLines.
adreameradreamer

Yes, that's right.

 

Cheers

Fernando

gaurav.sfdcgaurav.sfdc
We are calling metadata api via rest call using soap envlop (aysnchronus request). The problem we are facing is that we are able to create text field always but LongTextArea some times only, we do get OK response but in the org no LongTextArea gets created, however it shows postive result sometimes. But in case of text and other fields the response is always positive