How can I link a checkbox to a user field that fills in a user that checked it?

  • 0
  • 1
  • Question
  • Updated 4 years ago
  • Answered

I'd like to have a checkbox that, when checked by a user, fills out a 'user' field with the person that checked it.

I tried doing it with a rule that changes the value of a user field with the current user when the checkbox = checked. But obviously when the form is updated, the value changes...

I'm not a code wizard, so please help if you can!


Thank you

Photo of Barnee

Barnee

  • 0 Points

Posted 4 years ago

  • 0
  • 1
Photo of Drew

Drew

  • 522 Points 500 badge 2x thumb
Change your rule logic a little bit:

When the record is saved

and [checkbox field] has been changed to 'checked'

change [user] field to current user. 
Photo of Barnee

Barnee

  • 0 Points
Hi Drew, Thank you for your reply!

Will this solve the problem: if somebody else edits the form then saves it while this checkbox is checked, it will change the value of the user field?

I should clarify what I'm actually trying to do. I'm essentially just trying to create an electronic signature, so somebody can 'approve' the form, and have the form record who approved it.
Photo of Drew

Drew

  • 522 Points 500 badge 2x thumb
it will solve your first issue, yes.  if the checkbox is ALREADY checked when another user opens the form and then saves, it will not change the name unless they un-check it, then save, then re-open and re-check the box.  Typically what I do in these scenarios is put in a form rule that makes the checkbox read-only when there is a value in the user field.  In that way, a form can only be "signed" once.
Photo of Barnee

Barnee

  • 0 Points
Great! Thank you for confirming! I would have tested myself, but I currently have nobody to help me test it.

I will use this and I'll let you know if I run into any problems!

Thank you for your help
If your goal is to log who Approved, then there is a much more solid way to log who approved.  Forms Rules sometimes act up or don't fire and if the checkbox is checked using grid Edit, then Form Rules to not apply.

I suggest using a Text Multiple choice field with choices like Approved and Approval Withdrawn and Rejected.

Set that field to log the changes, so that the field will log the Who, the date and the value of the change.



Then use a formula to parse out from the most recent update the field.



Here are the three formuals to extract out the value, the date and the name of who did the update.

  Most recent value (formula text field type)

Trim(Right([my update field],"]"))




Date of most recent update (this needs to be a formula date field)

ToDate(Left(Right([my update field],"["),9))




Who did the most recent update (formula text field type)

Trim(NotLeft(Left(Right([my update field],"["),"]"),9))