function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jacqueline DoanJacqueline Doan 

Strange formula issue in flow: if statement returning null values

I'm working in Visual Workflow. I'm trying to generate a date via formula using an if function. My 'then' and 'else' statements are virtually the same, varying only by adding one month to a calculated date.

However, when my formula returns true on my 'if' statement, the 'then' statement gives me the correct date. When my formula fails my 'if' statement, the 'else' statement is blank.

Here is my formula:

IF(
{!NextPaymentDue}-{!SelectedCharge}<=0,

DATE(YEAR({!NextDueDate}),MONTH({!NextDueDate})+({!Days}/30)+1,DAY({!NextDueDate})+MOD({!Days},30)),
DATE(YEAR({!NextDueDate}),MONTH({!NextDueDate})+({!Days}/30),DAY({!NextDueDate})+MOD({!Days},30))
)

Successfully generates a date of 11/1/2014 when:
nextPaymentDue= 100
SelectedCharge = 150
Days=30
Next Due Date = 9/1/2014

Returns null when:
nextPaymentDue= 300
SelectedCharge = 150
Days=30
Next Due Date = 9/1/2014

Any ideas?
Blessy Voola 4Blessy Voola 4
Hi,

I have gone through your code and it appears strange to me as well.
what you could do is try

IF(
{!NextPaymentDue}-{!SelectedCharge}<=0,

DATE(YEAR({!NextDueDate}),MONTH({!NextDueDate})+({!Days}/30)+1,DAY({!NextDueDate})+MOD({!Days},30)),
DATE(YEAR({!NextDueDate}),MONTH({!NextDueDate})+({!Days}/30)+0,DAY({!NextDueDate})+MOD({!Days},30))
)

I have just added +0 in else clause.

Thanks!