Autofill Fields based on Select Record Field

Hi there :slight_smile:

First, since this is my first post - I’m in love with the Corteza framework - very robust, customizable, and easy to use too.

I want to autofill some fields on the “Jobs” module I created - the person selects an “Account” and is it possible to autofill the address and other fields on “Jobs” with the data on the “Account” based on the selected “Account”?

Edit: Is it easier to make an automation to transfer the “Account” to a “Job” and copy the info to the “Job” while maintaining the selector field to link to the “Account”?

Thank you in advance for your time and attention,
Jorge Matias

1 Like

Hola Jorge,

Bienvenidos a Corteza :slight_smile:

So, if I understand correctly you want to autofill other fields based on an account selected? We don’t have a trigger for that particular UI interaction. However, you could put a button on the screen that triggers a workflow. For example, the button could have the label “Prefill address based on selected account”.

That workflow would have the following steps:

  1. A manual trigger with the record as a source
  2. A expression block to get the ID of the selected account
  3. A function block to do a lookup for that account
  4. An expression block to write the values you want to map from the account into the job
  5. A function block to save the record
  6. A prompt to redirect the user to the record page again, in edit mode (or maybe a prompt to refresh values on the screen - that might work as well).

Hope this helps :slight_smile:

Un saludo,

Lenny

2 Likes

Thank you for the complete and fast reply :slight_smile:

Would that duplicate the data on the database after we save the “Job”?

Thank you again for your time and kind attention :slight_smile:

Un saludo :smiley:
Matias

Hi Lenny,

I believe many users are eager to have an UI triggers like (“on page load”, on “on element focus” ). It would resolve numerous situations.

Currently, many of us either create a manual button or inject a JavaScript script and make an API call to execute the workflow, using a trick suggested by @Shmuel here: Corredor client script on page-load

Could you please consider adding this feature? It would greatly simplify our lives.

Thank you!

It all depends on what you want to do.

I would suggest you to map the data into the new record. So yes, it’s a copy of tye data. But, it’s a copy of that moment in time. So, it won’t change if the account data changes.

Let’s say you have an account with an address in Zaragoza. A job is created and the address is mapped to Zaragoza.

Now, a year later, the account’s address has changed to Madrid. Do you want the address on the job be updated to Madrid or should it stay as Zaragoza? I would suggest that it stays as Zaragoza, because that might be related to the description of the job. That description could me: “Diseña un cartel para las fiestas del Pilar”.

However, if you want to show Madrid, than you could just have another “record selector” type field. You could have multiple of those fields linking to the same module in one module, and you would only need to map the ID in each of them (except for the main one that is automatically filled when a child record is created from a main record).

Hope this helps.

(on my mobile, so please forgive any typos)

3 Likes

Hi,

I would like it to, but it was turned down because of security reasons. Don’t remember the exact reasons (it was quite a time ago) but yeah…

On github you can request features. Maybe there are specific UI interactions you want to make triggers for? You can add then to the request :slight_smile:

2 Likes

It looks like a good answer is here - Optimization of page load on record list - #12 by Lenny

Thank you @Lenny for the detailed guide :slight_smile:

Warm regards,
Matias