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
Raj_SRaj_S 

How to create a Custom Field (Text Area ) in Accounts using Web service call.

Hi,
   Right now I am using Developer edition (trial) and i want to create custom field (Text Area) in Accounts section using a web service call. Can anyone help me in this. Thanks







Raj S
dkadordkador
The docs are probably your best place to start.  The sample code we provide is in Java, but hopefully you'll be able to translate as necessary to C#.

http://www.salesforce.com/us/developer/docs/api_metapre/index.htm
SuperfellSuperfell
see http://www.pocketsoap.com/weblog/2008/05/1811.html, change the fieldType line as needed.
Raj_SRaj_S
Thanks so much!

Actually i have created custom field in my Account page using web service API call and i am able to see that newly added custom field in

Account Custom Fields & Relationships but not in my Account Page.

So can You please tell me why i am not able to see that newly added field on my existing accounts and new account page.


               Thanks again!



Raj S

SuperfellSuperfell
because you need to add it to the page layouts.
Raj_SRaj_S

Thanks! for your reply but how can i add it to my page layout by using web service call. Since i don't want my clients to add it manually i want to do it by using web service call.
SuperfellSuperfell
you can add it via the metadata api, just like how you added the field, see the metadata api docs.
Raj_SRaj_S
Thanks!




Raj S
Raj_SRaj_S
hi simon,
          Actually i gone through metadata API but i am unable to find any way of showing the custom field from Accounts custom field and relationship to my Account layout Page using web service call. Lastly, i was trying to do something like this

MetaDataWebReference.LayoutItem layitem_obj = new Test_ExpocadProject.MetaDataWebReference.LayoutItem( )         layitem_obj.field = "Notice__c";
layitem_obj.behavior = Test_ExpocadProject.MetaDataWebReference.UiBehavior.Edit;
layitem_obj.page = "Account";
MetaDataWebReference.AsyncResult ar1 = metadatabinding.create(new MetaDataWebReference.Metadata[] { layitem_obj }]

Here Notice__c is my custom field, which is already there in my Accounts custom field and Relationship Page.

But these code is not working...

Your help is needed.

Thanks!



Raj S

Raj_SRaj_S
hi, I also tried to create a custom field in my Accounts page layout by

#region This is an unsuccessful try to create custom field in the Accounts Page layout.
            MetaDataWebReference.CustomObject co = new Test_ExpocadProject.MetaDataWebReference.CustomObject();
            co.fullName = "Account__c";
            co.deploymentStatus = Test_ExpocadProject.MetaDataWebReference.DeploymentStatus.Deployed;
            co.deploymentStatusSpecified = true;
            co.enableActivities = true;
            co.sharingModel = Test_ExpocadProject.MetaDataWebReference.SharingModel.ReadWrite; //**null: Must specify a sharing model value for the Custom Object
            co.sharingModelSpecified = true;
            co.label = "Account Object";
            co.pluralLabel = "Account Objects";
            MetaDataWebReference.CustomField cus_field1 = new Test_ExpocadProject.MetaDataWebReference.CustomField();
            cus_field1.label = "Auto Number";
            cus_field1.fullName = "Account.Auto_Number__c";
            cus_field1.description = "This is the Auto generated field";
            cus_field1.displayFormat = "{0}";
            cus_field1.externalId = true; //Set this field as the unique record identifier from an external system.
            cus_field1.externalIdSpecified = true;
            cus_field1.startingNumber = 10;
            cus_field1.populateExistingRows = true;
            cus_field1.populateExistingRowsSpecified = true;
            cus_field1.startingNumberSpecified = true;
            cus_field1.type = Test_ExpocadProject.MetaDataWebReference.FieldType.AutoNumber;

            co.nameField = cus_field1;

            MetaDataWebReference.UpdateMetadata updatemetadata = new Test_ExpocadProject.MetaDataWebReference.UpdateMetadata();
            updatemetadata.metadata = co;
            updatemetadata.currentName = "Account__c";

            MetaDataWebReference.AsyncResult[] ar = metadatabinding.update(new Test_ExpocadProject.MetaDataWebReference.UpdateMetadata[] { updatemetadata });
            #endregion


But Again failed to do so......

Actually i am able to add my custom field to my Accounts  custom field and Relationship by using web service call but i am not able to add that custom field from my Accounts  custom field and Relationship to Accounts Page Layout by using web service call.

Can you please help me out in this. It's really Urgent!

Thanks!



Raj S

GingaCodeMonkeyGingaCodeMonkey

Hi Raj,

 

Where you able to resolve your issue?

If so, would you mind adding a sample bit of code that does this. As I am in the same boat, with not much of an idea of how to continue on this path.

 

Any help would be great thanks.

 

Adrian