Loading

Process Builder internally stores User or Queue ID value in OwnerId field

Data pubblicazione: Oct 13, 2022
Descrizione
Consider a process on Case object that triggers on every Case create and executes a record update action. (No criteria - just execute the action).

Record Update Action:
  • Action name: Update Case Owner
  • Record: [Case]
  • Criteria for Updating Records: No criteria—just update the records!
  • Set new field values for the records you update:
    • Field:Owner ID; Type: Queue; Value: TestQueue

Upon save, this process is saved as Flow with a RecordUpdate node that updates the Case object's OwnerId field with the queue ID corresponding to the queue NAME chosen in the process builder UI. The Queue Name to ID resolution happens during process SAVE time - NOT during process RUNTIME.

The process (or flow) definition now has an ID value (user id or queue id) hardcoded in it - this imposes a prerequisite on the production org to have the user/queue with the exact same ID for the process deployment from sandbox. 

If for any reason, the production org and the dev (or sandbox) org has the same queue/user names but with different IDs, the process would cause runtime errors in the production failing to identify the user or queue with that exact same ID.

In simple terms, if the process builder and queue deployed to Production using the change sets/ANT the same queue id copied over to the destination and it is unaffected by this issue but if it is created manually in the Production org with the same process builder name and queue name it will take a new queue ID as owner ID and disrupt the process.

Risoluzione

The simplest workaround is to clone the process in production org and activate the new version - this cloning would resolve the new queue ID corresponding to the queue Name in production org.

The best development practice is to move away from IDs being introduced in a flow definition

One of the approaches is to create a Custom Setting and drive the owner resolution via formula referencing the custom setting.

Example:
  • Create a Hierarchical Custom Setting called Default_Case_Owner__c
  • Create a custom field on the setting called ID_Val__c of type TEXT(18)
  • Now use the formula {!$Setup.Default_Case_Owner__c.ID_Val__c} to set the owner ID in the record update operation.
    • Field:Owner ID; Type: Formula; Value: {!$Setup.Default_Case_Owner__c.ID_Val__c}
  • After the process is deployed, just create/update your custom setting with the right ID value.
Numero articolo Knowledge

000383921

 
Caricamento
Salesforce Help | Article