2

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)
1

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.

0

The problem is that chk1 is never 'visited' and therefore its value is unobtainable. One way to fix this, is by assigning its value to an sObject variable, and (fast)create the record using this variable:

  • define the sObject variable
  • pass a default value to the field you want to fill later on (in case of route B, you won't fill this value so you want it pre-filled)
  • after both routes, assign the relevant screen values to the fields in the sObject variable
  • create the record using the sObject variable.

Hope this helps! It does absolutely not improve the readability of your flow, but it works!

  • Thank you. but like I mentioned the actual flow I am working on has about 20 such checkboxes and related different paths (total about 125 elements). It would be very difficult to manage different paths for each condition. – Custom Software Feb 5 '15 at 12:21

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.