You need to sign in to do that
Don't have an account?
Ashmi Patel
Field is not writeable...what can i do with this error
this is my code.....
trigger FixCreator on Case (before insert) {
for (Case newCase : Trigger.new) {
if (newCase.SuppliedEmail != null) {
User trueCreator = [SELECT Id FROM User WHERE Email = :newCase.SuppliedEmail ORDER BY LastLoginDate DESC LIMIT 1];
newCase.CreatedById = trueCreator.Id; } } }
NEED HELP
trigger FixCreator on Case (before insert) {
for (Case newCase : Trigger.new) {
if (newCase.SuppliedEmail != null) {
User trueCreator = [SELECT Id FROM User WHERE Email = :newCase.SuppliedEmail ORDER BY LastLoginDate DESC LIMIT 1];
newCase.CreatedById = trueCreator.Id; } } }
NEED HELP
CreatedByID, CreatedDate etc. are known as the Audit Field which you can not update, insert using DML in APEX. You need to contact salesforce support for enabling Audit Fields. Audit Fields are generally used while migrating history data from third party system to salesforce with legacy dates.
Thanks
i hop it helps you
hnkuuu very much......
:)
Things changed. You doesnt need to contact Salesforce support any more. Just check following administrative setting from User Interface Settings
"Enable "Set Audit Fields upon Record Creation" and "Update Records with Inactive Owners" User Permissions"
Once you enable this, create a permission to allow edit audit fileds and assign that permission set as you required.
Thanks & Regards
Sri