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
Jatin JainJatin Jain 

Set History tracking for Standard field in Custom Object in .Object file

Hi All,

I have a requirement of setting field history for one of the standard field in my Custom object. No doubt, I can clearly do it via Salesforce UI and not in .object file as we do for custom fields as mentioned below :

 

<fields>

<full name>XYZ</full name>

<trackHistory>true</trackHistory>

 

I want to do it in the object file itself so that whenever I use ANT to build it,it should be done automatically and need not be a configurable option everytime I built in on a new org

 

sebcossebcos

Hi Jatin Jain,

the metadata API does not include standard fields unfortunately but only CustomField:

http://www.salesforce.com/us/developer/docs/api_meta/Content/customfield.htm as you have already discovered using Eclipse IDE or ANT and the .object file.

I am assuming that you want to track the Name or the Owner field since CreatedBy/LastModifiedBy  cannot be tracked (even from the UI there seems to be no way of tracking those fields: which makes sense , you would not want to have an history record each time a record is edited).

You can use workflow updates to update another custom field with the standard field's content everytime the standard field to track is edited.

You can then make that csutom field trackable using the .object file in Eclipse.

Also, workflow is available in the Metadata API and in Eclipse, so that you can automate the org configuration process with ANT:

http://www.salesforce.com/us/developer/docs/api_meta/Content/meta_workflow.htm .

 

 

Niranjan GattupalliNiranjan Gattupalli
If you retrieve CustomObject using ant tool, the Object file conatins an entry for Standard Field Name. You can enable track history for Name field programatically as you wish.
 ****
<nameField>
        <label>Trip2 Name</label>
        <trackHistory>true</trackHistory>
        <type>Text</type>
    </nameField>


****

Thanks,
Niranjan
http://www.autorabit.com