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 

Add custom field from Accounts custom field & Relation to Accounts layout page using web service

** How to add custom field from Accounts custom field & Relationship to Accounts layout page using web service

Hi,
   I am unable to find a way of showing the custom field from Accounts custom field and relationship to my Account layout Page by using web service call. 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...   Can someone please help me in this....


Thanks in Advance.....



Raj_SRaj_S
//**Add custom field from Accounts custom field & Relation to Accounts layout page using web service

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.

Help Needed. It's really Urgent!

Thanks!



Raj S