Filling a reference field of a GlideModalForm from a value in the main form

SildemanD
Tera Contributor

Hello everyone. I have two related tables: one for the Site and another for the Room.

 

In Site I have the fields:
- Name (String)
- Description (String)

 

In Room I have the fields:
- Site (Reference to the Site table)
- Name
- Description

 

My goal is to create a UI Action in the Site form so that it opens a GlideModalForm, with the Room form in it, and registers the rooms when clicking on a button in the Site form.

 

The thing is that I can't insert the value of the Name field of the Site form into the Site field of the Room form. How do I make the modal capture the correct site and register the room in the corresponding site?

2 REPLIES 2

HIROSHI SATOH
Mega Sage

I think it's fine to add related lists OOTB to forms. Is there any particular reason for this?

 

HIROSHISATOH_0-1722755262362.png

 

The idea is to keep the user on the screen, inserting the rooms from a modal that, after saving the record in the modal, returns the user to the Sites screen. The behavior of the related lists is different.

 

If I can implement this functionality in this simple structure, I will replicate it for other relationships. I think this will be very good for the application's UX. The application I am building will control access to restricted rooms by registering access requests. A similar structure will be needed so that the access form allows multiple visitors to be inserted in the same request.

 

Another issue is that, when we use related lists, the lists are only displayed after the main form is saved. In the case of the access request form, it will be necessary to insert the list of visitors before even saving the request form.