2

I have a screen flow with a Currency screen element.

I'm trying to set the default value with a formula. The formula will either have a value, or it won't.

enter image description here

If the result of the formula is null, the flow errors when I reach that page.

enter image description here

It looks like the result of the formula must be a non null value.

The formula I want to use:

IF(
  CONDITION, null,
  {!MyVar.My_Currency_Field__c}
)

The formula I have to use:

IF(
  CONDITION, 0,
  BLANKVALUE({!MyVar.My_Currency_Field__c}, 0)
)

Notice how I'm being forced to provide a value, in this case 0.

NOTE: this happens regardless of whether the currency field is required or not.

Is there a way to return a null value in a Currency flow formula?

This same behaviour doesn't seem to happen with a Number field, so it seems something specific to the Currency field.

4
  • Is that number field it doesn't occur for also denoted as required? Sep 3 at 0:31
  • 1
    @KrisGoncalves Whether it's required doesn't seem to matter. i.e. it happens in both scenarios. The number field doesn't have this problem, regardless of whether it's required or not. I've tweaked my question to call out the required parameter doesn't matter.
    – Nick Cook
    Sep 3 at 0:48
  • To make sure I understand, you need it to be NULL rather than 0?
    – Moonpie
    Sep 3 at 1:08
  • @Moonpie That's correct. I want it null in some circumstances.
    – Nick Cook
    Sep 3 at 2:21
3

I tried some simple tests in a sandbox. I created a simple Flow:

enter image description here

I made my Currency Flow Formula just be the value of a currency field on the object:

enter image description here

Then I set up my screen element like yours:

enter image description here

  • When the field on the object had a value - even zero - the Flow ran & the value showed in the screen element.
  • When the field on the object had no value, the Flow errored with a GACK like yours.

I created a new Number Flow Formula - just like the previous one, but Number instead of Currency:

enter image description here

I changed the Screen element to use the new formula instead.

The Flow ran the same for values in the object field. But this time when the object field had no value, the Flow ran and displayed an empty field in the Screen element:

enter image description here


A couple of different tests:

  • I made the Screen field be a Number field but used the Currency Formula...

    enter image description here

...and it did NOT error on a null field value.

Which tells me that a Currency Flow Formula can return a null value which can be used elsewhere in the Flow.

  • I also skipped the Formula and made the Screen Currency field look like this...

    enter image description here

...and it also handled a null object field just fine directly.


So although I could find nothing definitive in my searches, it seems that a Flow Screen Currency Field cannot handle a null formula, even though it can handle a null field directly.


The workarounds seem to be:

  • Change your Flow Formula to Number type and just use it in your Currency field Screen.
  • Add a Decision element to check your Currency Formula for a null value, then have two different Screen elements to display depending on the Decision: one that uses the Currency Flow Formula, and one that does not.
3
  • Stupid question, but what happens if Get_Assets is null?
    – Nick Cook
    Sep 3 at 5:39
  • Not a stupid question. That's a great question - I had it hard-coded to pull in one record that I was playing with. Let me go back and play around with it some more....
    – Moonpie
    Sep 3 at 11:11
  • I tested and the results were the same as just a null field: if Get_Assets finds no records.... A) When I had the Currency Screen Field using the Currency Formula I got the GACK; B) When I had the Currency Screen Field using the Number Formula it properly displayed the empty field.
    – Moonpie
    Sep 3 at 11:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.