You need to sign in to do that
Don't have an account?

Create audit field is enable though i m not able populate the data in Audit field
Hi all
i m doing the exercises to populate the data form one salesforce package to another salesforce package
both packages have same object and same fields now i want to Query data from old package and put in to new package's objects
i m doing this exercises through apex and create audit field permission is enable and then also i m getting error "Field LastModifieddate is not editable"
bellow is the code for reference
List<OLDPKG__Customobj__c> lst = new List<OLDPKG__Customobj__c>();
List<NEWPKG__Custonobj__C> Newlst = new List<NEWPKG__Custonobj__C>();
lst = [select all fields from OLDPKG__Customobj__c];
for(OLDPKG__Customobj__c ab : lst )
{
NEWPKG__Custonobj__C atta = new NEWPKG__Custonobj__C(); atta.put('LastModifiedDate',a.LastModifiedDate);
atta.put('LastModifiedById',a.LastModifiedById);
atta.put('IsPrivate',a.IsPrivate);
atta.put('IsDeleted',a.IsDeleted);
atta.put('Description',a.Description);
atta.put('CreatedDate',a.CreatedDate);
atta.put('CreatedById',a.CreatedById);
Newlst.add(atta);
}
if(Newlst.size() > 0)
{
insert Newlst;
}
Hello Amar,
Exception is due to some standard fields like LastModifiedDate, LastModifiedById, CreatedDate , CreatedById are in uneditable by default.
Salesforce may avail it on request.
Thanks,
Hi,
Because of that i have enable the create Audit field feature and intersting thing is that if i m inserting data through Data lodar it allows me to insert the data in LastModifiedDate, LastModifiedById, CreatedDate , CreatedById fields bt through apex its not respecting the ceate audit field features
Experts, want some help on this ??how do i accomplish this in apex..??
Waiting for ur response..
Salesforce does provides some key to partners which allows such thing from the API.