Forum Discussion

Lee_SGilmore's avatar
Lee_SGilmore
Qrew Cadet
7 years ago

Trying to make the Current User the default in a field that uses a Standard Record Picker

Starting off with the obvious, if I were to use a User Field as a Key Field and then create a relationship, there would be a way to default the user to the Current User. Sadly, I'm using the Employee Badge Code as the Key Field in the table causing my users to have to pull up a record picker each time they want to assign themselves to a Purchase Order as the one initiating it. I'd love to find a creative way around this. Anything come up in the past like this?
  • Lee,


    If the originator of the purchase order is always the one assigned to it, then you could just refer to the record owner field.


    If you want to have the option of assigning someone else then you could set the default �assigned to� person within the button used to create the purchase order. Within a formula URL field you can dictate values of any fields that you want. Look at the formula for a bottom created in a parent record when a relationship is created as an example. All of those buttons set the �related � to the value of the record ID# of the parent record.

    Just add an additional �&_fid_=� & URLEncode([current user email address]) into the formula.
  • Forrest has an interesting solution but to launch the Add Purchase Order with a formula field you would need to have the users go to a table, say a single record table which has this formula field, so that is an extra click. 

    An alternative is to set up a Sync table and Sync across a copy of your employee file to another table in the app, filtered on where userid is not blank.  Set the Key field of the Sync table to be the userid. 
    Then on the Purchase orders table make a field called [Current User] with a formula of

    User()

    and make a relationship back to Employees Sync, and and lookup the badge # of the current user.

    Then set a form rule that when the bade # is blank, change the badge # to that lookup, and uncheck the checkbox so it fires all the time.
  • This is interesting because I am requiring that they use a specific Add New button anyway (the one that you helped me build that auto assigns the next sequential PO number). If I understand correctly, you're showcasing how you can assign the Current User's e-mail address to the field. I'll play around with this and see if I can get it working.

    For now, I have just a report established returning only the Current User so when they use the drop down to select an Employee Name, they only see their name as a choice. It's not automatic but it's good enough to get them started as I learn the URL coding. Thanks again for taking a look at this!
    • ForrestParker's avatar
      ForrestParker
      Qrew Cadet
      Lee, it sounds like you could convert your "Assigned To" field into a formula User field and just refer to the Created By field.  

      Since you are only allowing the user to choose his/her self then it sounds like ever purchase order is assigned to the person that creates it.  

      If this is not the case, and you want to be able to modify who it is assigned to, then you will need to set up the current user as the default user through the formula url field like I suggested above.