2

This question relates very much to Unable to Set Created date even after enabling Set Audit Fields

However, my problem is specifically related to the Knowledge__kav SObject.

I'm trying to import existing knowledge articles into salesforce from a legacy system and for compliance reasons, I need to keep the same CreatedDate.

I've given the running user a permission set, which has the permission "Set Audit Fields upon Record Creation" enabled. When trying to set CreatedDate on Account and ContentVersion sobjects, it works fine, but not for Knowledge__kav.

I tried importing the data both via the API and via APEX. Via the API, the insert is successful, but the CreatedDate is overwritten with the current DateTime. A before insert trigger revealed that CreatedDate was null before insert. Via Apex, I get the error "FATAL_ERROR System.SObjectException: Field is not writeable: Knowledge__kav.CreatedDate"

I can't find any documentation stating that the behaviour of "Set Audit Fields upon Record Creation" is different for Knowledge__kav. Does anyone know?

3

The knowledge article Considerations and activation of 'Create Audit Fields' has a list of objects that are available for these kinds of updates, and unfortunately Knowledge Article isn't one of them.

Perhaps you could make use of a custom field somehow so that the data is still there?

3

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.