[SalesForce] Issue with checkbox initialization in Visual Workflow

Below is a simplified flow to illustrate the problem I am facing.
Issue with checkbox initialization in Visual Workflow

In above flow Screen [dscA] has a checkbox named [chk1] which has default value of FALSE. In the record create step this is assigned to a field of checkbox type on custom object.

This works perfectly fine if screen dscA is visited as result of Decision dAB. But if flow progresses through route B and never touches Screen dscA, the record create step throws an error: "UPSERT — UPSERT FAILED — ERRORS : (INVALID_TYPE_ON_FIELD_IN_RECORD)…"

I have tried to use formula to detect if chk1 is null and assign false but it doesn't work.

  • ISNULL({!chk1}) / ISBLANK({!chk1}) in flow formula throws error invalid parameter
  • {!chk1} == null / {!chk1} = null always results in false
  • Assigned chk1 to a boolean variable but that too returns error
  • FastCreate with assignment too throws the same error.

Any suggestions on avoiding error on Record Create step? This is a representation of a large flow I am facing issue with. It has many checkbox fields so I would like to avoid putting a decision for each checkbox to check it's value before assigning to Record create.

Thank you for your time.

–possible solution–
Continuing my trials I figured, using below formula and using that for record create step works. But would still like to know if there is a better way. Thanks

IF({!chk1}==TRUE, TRUE, FALSE)

Best Answer

Instead of setting default values on the Screen element, you can have an Assignment block at the start of the flow that sets default values for all your variables, and then jump into the screens.

Related Topic