conditional visibility on an unsaved record

  • 1
  • Problem
  • Updated 4 years ago
I have a popup form for a "contact availability" record. The contact has a custom field "is teacher". I want to show a "room" field on the popup only if the contact is a teacher. This works find on records that have already been saved. I can set the visiblity condition to only show the room field with the related contact has the "is teacher" field checked.
But on a new record, the related contact's "is teacher" field shows up as unchecked.... so the visiblity condition hides the room instead of showing it
I assume that the true state of the related contact's is teacher field is only available after the record has been saved.
So as a way around this... is there any way to decide in javascript which of 2 custom popups to open ?
Photo of ktyler

ktyler

  • 9,244 Points 5k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Moshe Karmel

Moshe Karmel, Champion

  • 8,646 Points 5k badge 2x thumb
You can add a render condition that "created date != null" and that way your logic will only run on existing records...
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Somthing else you said Ken made me curious.  Why do you have 2 popups? If I get your use case,  you can have one popup that includes conditional display of the room field if the 'is teacher' flag is set.  This will happen real time,  so on new records when the flag defaults off,  as soon as the flag is turned on,  the room field appears.   I don't think you need 2 flags.