Based on the documentation
LastSyncDate can be used as a safeguard to ensure that when someone else modified Apex Class in SFDC you do not accidentally overwrite those changes using your older local version.
Tooling API documentation states following about
When you deploy a MetadataContainer, this value is compared with the LastModifiedDate of the underlying Apex class. If LastSyncDate is older than LastModifiedDate, the deployment fails with an error.
If I am reading it right then I shall include (set)
ApexClassMember every time when I deploy that
ApexClassMember as part of
However if I specify any value of
LastSyncDate and then I always get this error message:
Unable to create/update fields: LastSyncDate. Please check the security settings of this field and verify that it is read/write for your profile or permission set.
Obviously this tells that I am trying to update the field which can only be Filtered or Sorted, but other than directly setting LastSyncDate on ApexClassMember I can not figure out any other way to provide LastSyncDate as part of my deployment package.
(Using SOAP version of Tooling API v28)
Here is the sequence of steps (ignore the syntax):
//assuming I have created ApexClass previously and now have its Id, let’s call it “
- Create Metadata container (this gives us
- Instantiate ApexClassMember like so
member = new ApexClassMember ()
- Post ApexClassMember to SFDC
I am sure I am doing something wrong, but cannot figure out what this may be. Extensive googling did not return any examples of LastSyncDate usage in any shape or form.
Any hints will be very much appreciated.