Conditional value for checkbox

Conditional value for checkbox

  

I have a person information form with a checkbox to indicate if the person is the primary contact of a family. I would like this box to be checked automatically if no other individual has been marked as the primary contact. In the Preparation I have an aggregate to select the primary contact, and I have an If condition right after that to check if the IndividualId input variable is equal to NullIdentifier(), and if so assign the IndividualForm.Record.Individuals.Primary_Contact variable  to the result GetPrimaryContact.List.Empty, which should be True if there is no other primary contact. But when I add a new person to a family that has no primary contact, the checkbox is still unchecked. What is the proper way to set the checkbox the way I want it to work?

try to assign the query that populate the form, not the form field itself..something like 

get....checkbox = ..

regards,

bb

Hi Geoff,

it would be much helpful if you could share the ER diagram. That way we can have a clear understanding of your issue.

Solution

Hi Geoff,

When you enter the web screen where the form for the person info is, to add a NEW person, I'm assuming you have the information that allows you to select other persons based on the family.

So, in your aggregate, if the result list is empty, you wants to give the default value of the IsPrimaryContact (I'll call the info as this) to true by default.

For what I understood, you are setting the FORM value.

And if so, this is the problem.

When the page is being rendered the first time, anything you set directly into a form will be overwritten when the form copy the info from the source.

So, to set a default value for an info in a form, set in the source record you are providing for the form, like the record of an aggregate or local variable you are giving to the form.

Hope this helps.

Cheers

Eduardo Jauch

Solution

Thanks, Eduardo!  A simple change from IndividualForm.Record.Individuals.Primary_Contact to GetIndividualById.List.Current.Individuals.Primary_Contact in the Assign task, and it it's working like a charm.