0

I had a simple Flow that was working: if an Opportunity was updated then the Flow updated some values and then sent an Outbound Message. But then we tried to make it fancy, with some additional conditions. And now I get this error:

We can't save this record because the “Integration 
Outbound Message” process failed. Give your 
Salesforce admin these details. An Apex error 
occurred: System.NullPointerException: Attempt to 
de-reference a null object . nullPointerException: 

Has anyone seen this before? What does it mean?

I have a few questions.

Two branches both have the same outcome. Is there a way to group them together?

Why would the Opportunity not exist when the Outbound Message is called?

Here is the Flow:

Opportunity Flow

Decision Branch works correctly

Null pointer in Outbound Message

8
  • Null Pointer Exceptions typically mean that your logic has attempted to retrieve a record and assumed that it would exist when it doesn't, or it has not correctly set a variable or record value correctly. Unfortunately without being able to see what you're doing in the outbound message/flow we won't be able to provide you with any more detail than that. If you can't share it, then make sure you go through the Flow and double check any branching logic in it. Apr 4, 2023 at 20:34
  • Assume I have some decision branches that are like if "$Record.StageName IsChanged is true" then do an Outbound Message. Wouldn't the Opportunity (the record) have to exist if it passed that conditional? Or is it the conditional that is throwing the error, in which case, how could I see that for sure? Apr 4, 2023 at 20:46
  • The Decision element comes after some Actions that convert values on certain fields. I assume that the Opportunity is being passed to every action and then to the Decision block. Is that a bad assumption? Apr 4, 2023 at 20:47
  • It could potentially be those actions that convert the values. Have you enabled debug logs for a user and examined those? You're going to be able to see a lot more detail as to where the exception is being thrown if you do. Apr 4, 2023 at 20:48
  • 1
    It's useful, but you still need to run a debug log. Looking at the number of Apex Actions in that flow, it definitely appears that it will be being thrown within one of those, but the error isn't specific enough. The user that deployed the flow to the environment should have received a Flow Exception email which will have the exact action that is throwing the error as well if you can't set up a debug log. Apr 4, 2023 at 21:14

1 Answer 1

0

Debugging this type of problem means understanding the possibilities for a null pointer exception

First of all, it is occurring in either:

  • One of the Apex actions
  • Some other Apex class that is invoked by a database update done somewhere in the Flow (directly or indirectly)

If you can reproduce the issue, be sure to add yourself to the Apex Exception Emails list in your org. This will help pinpoint the error

Now, why would an Apex action fail?

  • It expects certain values to be passed in its request and the Flow is not passing them. Perhaps this is data-specific and the records in question are missing field values and the Apex action wasn't coded defensively to deal with that (or there is a bug in the Flow's marshaling of arguments to the Apex action

  • Alternatively, the Apex action has a bug. A comprehensive unit test can help uncover this.

  • Enabling the debug log and rerunning the flow is immensely helpful here - it will identify the line number in the Apex class that is failing

And what is a null pointer exception?

It means there's a line of Apex where an object has a null value and some operation is attempted on that null value. This could be something simple like

i = i + 1;   // where i is not initialized, i.e.. null

to all sorts of complexity

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .