Getting Started with Process Builder – Part 66 (How to fix FIELD_INTEGRITY_EXCEPTION error)

Getting Started with Process Builder – Part 66 (How to fix FIELD_INTEGRITY_EXCEPTION error)

Last Updated on April 15, 2019 by Rakesh Gupta

Process Builder is a way of automating business processes. It is an upgraded version of the Workflow Rule. Whenever a user creates a process, the system automatically creates a Visual Workflow – and a Flow Trigger (which is now deprecated) – to call the Flow. Creation of the Flow happens behind the scenes; and therefore, a user does not need to interact with these ‘shadow’ (behind the scenes) Flows. Process Builder is a powerful tool for system administrators and developers to implement business processes without writing code. However, with great power comes great responsibility  If a user starts creating a new process for each requirement – or creating processes without understanding Salesforce limitations – then, a user may encounter many issues, either in future or, during testing/deployment phase.

In my last post Getting Started with Process Builder – Part 65 (Resolve ALL_OR_NONE_OPERATION_ROLLED_BACK  Error), I discussed how to solve ALL_OR_NONE_OPERATION_ROLLED_BACK error by adding all the required fields to Process Builder action. 

This article goes one step further; it explains another common error   FIELD_INTEGRITY_EXCEPTION Error. The article shows – (1) why errors could occur; (2) how to identify errors (by using a system generated fault email/debug log); and, finally, (3) how to solve the problem.

Business Use case

Donna Serdula is working as a System administrator at Universal Containers (UC). UC implemented Case Management a year ago in Salesforce. Serdula has a requirement from her manager that, as soon as a Case gets created without assigning it to an account, then auto assign such Cases to a Low Priority queue.

What is FIELD_INTEGRITY_EXCEPTION Error?  

A user mostly encounters a FIELD_INTEGRITY_EXCEPTION error when he populates a lookup field with the wrong Id

For example, while creating a contact via Process Builder if, in the place of AccountId, a user passes an Opportunity record id, then, the user will encounter FIELD_INTEGRITY_EXCEPTION error.

Create a contact
Create a contact

Below, I will show you how to avoid getting a FIELD_INTEGRITY_EXCEPTION Error while using the Process Builder.

First, I will create a case by passing the wrong ID (may be an account ID) for a Low Priority queue. 

This will generate a FIELD_INTEGRITY_EXCEPTION error because you are only allowed to pass valid User or QueueID for a case owner. 

Next, I will show you how to identify the root cause behind FIELD_INTEGRITY_EXCEPTION error followed by a way to solve it. 

Let us create a Process that generates a FIELD_INTEGRITY_EXCEPTION error

There are few possible solutions for the above business scenario, but we will use the Process Builder and Custom Label to solve it. Follow the instructions below to create a Process for the above business requirement

1. To solve the above business requirement, first must create a Queue as shown in the following screenshot:  

Low Priority Queue
Low Priority Queue ID

2.  Click on Setup | Build | Create | Custom Labels
3. Click on New Custom Labels, it will open the new window for you. Now create a new custom label to store the queue ID (Low Priority) Id, as shown in the following screenshot:

Custom Label - To store Queue Id
Custom Label – To store Queue Id

4.  Our next task is to create a Process Builder on the Case object to update the case ownership if the case is not associated with an account. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder
5.
 To create a new process from scratch, click on the New Button available on Process Management page. A popup will appear where you must enter the Name (Use
Update case ownership to Low Priority queue as name)API Name and Description as shown in the screenshot below: 

Define Process Properties
Define Process Properties

6. Click on Object node to add object and then select Case object. For the entry criteria, Select only when a record is created, as shown in the screenshot below. Once done, click on the Save button.

Evaluation Criteria
Evaluation Criteria

7. The next task is to add Process Criteria. To do this click on Add Criteria, then enter NameType of action and set filter conditions as shown in the following screenshot.

  •  [Case].AccountId Is null Boolean True
Process Criteria
Process Criteria

8. The next step is to add an Immediate action to the Process, to update the case ownership. First, add an immediate action to update the case ownership to Low priority queue, as shown in the following screenshot:

Choose a Custom Label
Choose a Custom Label

–> If you don’t know about custom Label and how to use it in Process Builder, then you must read this article Getting Started with Process Builder – Part 60 (Just say no to hard-coded ID)

Once you’re done click on Use this Formula (#5) button. Add one more row to associate new case with account record, At the end, Update Records action should look like the following screenshot: 

Update Records - Update case ownership
Update Records – Update case ownership

9. Once done, click on the Save button, it will redirect you to Process canvas. Finally, the Process will look like the following screenshot

 

Don’t forget to activate the Process by clicking on the Activate button.

It’s time to test the Process

Create a case record with no account associated with it, as shown in the following screenshot:

Once you’re done, click on the Save button. Boooommmm, you encounter FIELD_INTEGRITY_EXCEPTION error, as shown in the following screenshot:

–> As mentioned earlier, the reason behind the error is, we are updating Case record ownership to a Low Priority queue, but we are actually passing Opportunity ID instead of queue ID. 006W00000070lzHIAQ is the Id of an opportunity record. 

Resolve FIELD_INTEGRITY_EXCEPTION error

To fix the FIELD_INTEGRITY_EXCEPTION error in a Process Builder or a Flow, you have to pass the correct Id for a lookup field. As we are using Custom Label to pass Queue Id, now we will update the custom label with correct ID for the Low Priority queue. 

Perform the following steps to solve the FIELD_INTEGRITY_EXCEPTION error in a Process:

1.  Open the Developer Console and then run the following query to get the Id for Low Priority queue

select id, Name from group where DeveloperName ='Low_Priority' and Type = 'Queue'

It should look like the following screenshot 

–> Another way to get the queue Id from the queue url

https://rakeshistom-dev-ed.my.salesforce.com/p/own/Queue/d?id=00GW00000013bKB&setupid=Queues

2. Click on Setup | Build | Create | Custom Labels
3. Open Low Priority Queue ID Custom Label by clicking on the Name, that you have created a moment back. Then click on the Edit button and update the correct Queue Id there, as shown in the following screenshot:

4. Once done, click on the Save button. 

–> If you are using Process Builder to dynamically pass the Id (Like [Account].Id or something like this) then update your Process. At the end, you have to make sure that you are passing correct id through the lookup field. 

It’s time to test the Process

Create a case record with no account associated with it, as shown in the following screenshot:

Create a new case
Create a new case

Once you’re done, click on the Save button. Notice that, Case is created and assigned to the Low Priority queue by the Process. 

Proof of concept
Proof of concept
Technical Editor and Proofreader: - Munira Majmundar

–> Book I have published recently http://wp.me/p1wpoE-2wK

If you have feedback, suggestions for posts or need more information about Salesforce online training program running by me. Say hello and leave and message to me!

2 thoughts on “Getting Started with Process Builder – Part 66 (How to fix FIELD_INTEGRITY_EXCEPTION error)

  1. Would this apply to the “FIELD_CUSTOM_VALIDATION_EXCEPTION” error as well? If not, do you have a blog post about that coming out soon? 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.