In Sale开发者_运维百科sforce I have an account. On that account I have a couple of fields that are populated from the PHP SDK after some processes run in the background. The PHP SDK updates a field on certain conditions, when that happens I also would like to lock down that field to read-only. Can I do this from the PHP SDK?
You want your "lock" on database (or in this case - on Salesforce) level, not on the PHP SDK level. Because otherwise malicious user will just grab Data Loader or Excel Connector and go on with his update bypassing your lock ;)
Try out the Salesforce Validation Rules or (if your logic is complex) a "before update" trigger.
Example validation rule could look like:
condition:
AND(
ISPICKVAL(PRIORVALUE(Type),"Technology Partner"),
ISCHANGED(Type),
$Profile.Name <> "System Administrator"
)
error message to be displayed:
After Type has been set to "Technology partner" only Administrators can modify this field.
This is just a starting point, feel free to experiment and fine-tune. You can also disable this rule after migration.
Check out the Validation Rules functions help page or intro to Validation Rules for more goodies. The ISCHANGED() function should be especially useful for you.
精彩评论