0

I have the following validation rule for a Custom Object:

AND(ISPICKVAL( transp__SFT_Trip__r.transp__SFT_Status__c, "Encerrada") , $Profile.Name != "Administrador do sistema")

It only let the admin user change this record when the field of the Trip Object is "Encerrada".

The problem is when another user (which is not the admin) updates the Trip status to "Encerrada" because the system also updates the Custom Object. It was working fine until days ago.

It seems that Salesforce has changed their logic for Validation Rules to get the new value of the field. I want this validation to get the old value of trip status and not the new one.

  • So, you are saying that it doesn't let them update trip status to Encerrada now and it used to? Did you make any other changes or add a Process Builder to the org that might be causing the update to the child object? – Daniel Hoechst Feb 25 '15 at 23:46
  • I don't think so. It has always updated the other object. The only thing that came up in my mind was Salesforce update. – Airton Gessner Feb 26 '15 at 11:41
0

For validation rules I would use "<>" and not "!="

AND(
ISPICKVAL( transp__SFT_Trip__r.transp__SFT_Status__c, "Encerrada") , 
$Profile.Name <> "Administrador do sistema"
)

Give that a shot!

0

If I understand it right, when the value in the picklist is Encerrada, only system admins should be able to update that record. You can add one more condition to check if that picklist value was not updated in the current transaction by a non admin.

AND( !ISCHANGED(transp__SFT_Trip__r.transp__SFT_Status__c), ISPICKVAL( transp__SFT_Trip__r.transp__SFT_Status__c, "Encerrada") , $Profile.Name <> "Administrador do sistema" )

  • That would work only if Salesforce allow to use ISCHANGED and PRIORVALUE functions with relationship's field, but it's not possible. – Airton Gessner Feb 25 '15 at 19:33

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.