I'm looking for the most efficient way to accomplish the following: Stop Users via Validation from editing a record when a specific field is BLANK, but allow Process to edit the record at any time.
Another way of looking at it: What "user" does the Process Builder operate under?
Situation:
Accounts are created. A LOOKUP field exists that is BLANK at first (looks to object "Customer"). In 30-60 seconds, the record is supposed to allow a Process Builder routine to edit the record (but not users).
Is there a way to know Process Builder is the one trying to edit the record, so it can be allowed to bypass Validation?
A temporary field won't work(..?) because it would be set and cause the bypass to happen for anyone.
$User.UserType also appears to be useless here.
In pseudo-code:
and(
isblank( NeededField__c ),
$User.SystemOrHuman = "Human"
)
...... this would Validate (block) a human from touching the Record until the NeededField__c is populated.
UPDATE: Related to this - Does Process Builder Run as User or System?
A CLEARER USE CASE:
Accounts are created.
This causes a (custom object) Customer to be created, which links itself to the Account via Apex. No control over how this managed package does this.
We have a Process Builder that, when a new Account appears, sets a few values automatically on the Account, then Time Lapse, runs a Flow that links the Account to the Customer. We control this. This happens one minute later using "5 hours before Created Date" as the reference.
Due to that "one minute later" logic in the Process Builder, if you TOUCH the Account prior to the "one minute", it breaks the update and it never happens, ever. I want to allow the Managed Package to let it's Apex code run (typing this has made me realize it may technically be allowing Apex, not Process Builder, to bypass the Validation).