Forum Discussion

Jonathan_Gibson's avatar
Jonathan_Gibson
Qrew Cadet
6 months ago

Enable/disable creating a new record from a record picker? (not

I have a question about the "Create a new..." option shown on record pickers, and whether it can be disabled without restricting functionality anywhere else.

I have a two distinct record pickers on a form for choosing a related parent record. Each record picker is filtered using a different report and is shown only if the child record is in the appropriate status (either record picker A or B). Thus the user sees only the appropriate set of records to choose from depending on the child record's status.

However, since the record picker shows a "Create a new..." option, it is possible for a user to add a parent record from here but NOT set up the new parent record with the necessary criteria for it to show up in the same record picker. As a result, users are inadvertently creating duplicate records on the parent table when they go to choose a parent record and don't see the one that was recently created.

I don't want to change access settings for the parent table generally, and I don't want to change the requirements for adding a new record there, because not all records on the parent table should have the criteria that makes them show up on the record picker.

I just want to either disable adding a record from this specific form/record picker, or enforce criteria depending on the user having come from that form/record picker. Is this possible?

 

6 Replies

  • I don't believe you can dynamically control whether a user will see the Add parent button.  Of course, you can set the user interface to disable the Add parent button, which will also disable it on the record picker while still allowing them permission to create a parent. That does mean that you will have to give them a button somewhere to let them create a parent when there is a legitimate need. That may have to be on the homepage of the app because once you suppress the Add record button, it will no longer show on the Table homepage.

    One other option, however, is that you could use Formula Query on the parent record form to detect if the Parent record already exists. A formula Query can compare the input that the user has done on the unsaved Add Parent form with existing records in the database and thus you can dynamically put up a warning to the user so they know they are creating a duplicate and of course you could also have a form rule to abort the save.  Also, you can also set a field on the record as being unique or formula field is being unique, which would also have the effect of blocking the Save.  Blocking the Save after the user has done a bunch of data entry is not particularly friendly to the user, but that might be a last resort to prevent duplicates.

     

  • Thanks for the detailed response! Yeah, I experimented with adjusting the user interface, but in end decided it wasn't a good solution for now b/c I'm not sure who might be affected by a change like that on the sizeable team I've recently joined.

    I ended up adding a note to the child form visible in edit mode to say, essentially "If you create a parent record from this dropdown please make sure you fill out fields x & y" (ensuring the created record will show in the picker later).

    The formula query solution is intriguing though. So if I understand correctly I would set up a query to look for other records with the same value(s) in whatever field(s) on which I want to enforce uniqueness? I think I'm missing something, because how would this be different from just giving those individual fields a uniqueness constraint?

    Is it that I can allow a single field or subset of fields to be duplicated but not the full combination of fields?

    • MarkShnier__You's avatar
      MarkShnier__You
      Icon for Qrew Legend rankQrew Legend

      Well, the main difference by using a formula query as you may be able to detect the duplicate earlier and give a better user experience so the user knows earlier in the data entry process that they're about to create a duplicate. It also will allow you to better craft the error message. When you save the record and block the safety based on a unique field, the only control you really get over the messaging is what you name the field, which is said to be unique. So you can have a pretty long field name to work into the error message but not as much flexibility as if you detect it with a formula query and then make a Rich text field to put up an error message. 

      • Jonathan_Gibson's avatar
        Jonathan_Gibson
        Qrew Cadet

        Ah, of course! So they could see an alert immediately after entering a duplicate value in the name field (for instance) rather than potentially minutes later when they get to the end of the form and hit save.

        This makes sense and I'm grateful you took the time to relate the info. I've always found formula queries somewhat inscrutable and you've boiled them down nicely.

    • MarkShnier__You's avatar
      MarkShnier__You
      Icon for Qrew Legend rankQrew Legend

      OK. Feel free to post back if you have any trouble with the formula query syntax.