3

I've enabled "Set Audit Fields upon Record Creation" permission on a permset (as per help page).

Inserting it via:

sfdx force:data:bulk:upsert -s MyNS__Some_Record__c -f invs.csv -i Id -w 5

Getting:

INVALID_FIELD_FOR_INSERT_UPDATE:Unable to create/update fields: LastModifiedDate. Please check the security settings of this field and verify that it is read/write for your profile or permission set.:LastModifiedDate --

2

It sure looks like the Bulk API doesn't currently support "Set Audit Fields upon Record Creation" at the moment based on experimental results. I suspect that's an oversight. I'll ask.

0

@dzh - You need two levels of setup for this to work and you have done only one.

  • User Interface Setting - This is org level setup needed before you give permission to Profile or Perm set
  • Profile or Perm set permission - After enabling User Interface setting now go ahead and add the permission to the profile or Permset

If you skip step 1 and do the step 2, although you add the permission in profile/permset the audit fields are not editable. I faced the same issue before checking out the documents

https://help.salesforce.com/articleView?id=000334139&language=en_US&type=1&mode=1

3
  • Thanks, but that does not answer anything. First setting just hides second one - you can't add that permission before enabling globally. Just tried same steps on a fresh scratch org and no bueno. – dzh Sep 17 '19 at 4:03
  • Tried with adding setting for profile as well as permset (which took way longer than needed - can't change sysadmin profile of default user) - that didn't help at all... – dzh Sep 17 '19 at 4:18
  • Data point: In early 2020, I just successfully used the bulk API (through the Python "Simple Salesforce" package) to upsert Task records with LastModifiedDate and CreatedDate set to dates in the past after getting my user permissions right. (That said, I'm having trouble with ActivityDate making bulk loads fail.) – k.. May 8 '20 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.