Auto populate user name and associated company field

  • 30 April 2021
  • 5 replies
  • 499 views

Badge +2

Hello Nintex Community! 

 

I am looking for some help to pull and auto-populate a field. In the form we are building there is a field for user name (text field) and company (drop down). In the default value for user name we are using the Context function to get "Current display name". In the company field I want it to auto-populate the company based on the user's name. Both these fields are read-only fields as we don't want users to adjust the company name field. 

 

The requirement is to have a user login and every time they fill out a new form they can see their name and company but not be able to change those fields. 

 

I am using the new responsive designer to build the form. 

 

Thank you for your help!


5 replies

Userlevel 1
Badge +6

Is the information you want to populate from the person who submits the form? If so, this is pretty easy. I just create a rule and use the user profile service to get the required information:



Here is the full text for the function for the work phone value:



  • userProfileLookup([Context].[Current user email],"WorkPhone")


You can then make the fields on the form read only. This site has all of the fields you can pull from the user profile service: 


http://www.techrobbers.com/2019/07/sharepoint-user-profile-fields-with.html

Badge +2

Thank you David for the quick response! 


I should have probably mentioned this in my post but unfortunately the user accessing the form is an external user. We are adding them to our internal tenant to access the form so we don't have a lot of information that we can pull from their User Profile.


 


However I did use the concept you suggested in your rules section. I used the following rule to build out the logic.


1. IF: "Form Is New" ..... is Yes


2. AND User name.... *enter user name*


3.Then: Company Name.... Value.....  companyABC


4. Else: Company Name... Value..... *blank*/companyDEF


 


It works great for our needs and really simplified our process.


Thanks again 🙂 @David-

Badge +2

@David- 


Hi David - I was using the "is New Mode" to test the form today and for some reason my rule no longer works. Does the "is New mode" only for when I first use the form??? Do I need to add more to the rule?? 


We know the user will use the form multiple times throughout the week, so is the form still "new" when they fill out the form over and over again? 

Userlevel 1
Badge +6

Yes, "new mode" is the first time you create the new item in the list. Once it is saved, it is no longer considered new.

Userlevel 1
Badge +6

Yes, the is New Mode is only on the first time the form is created and before it is submitted. If you want it to update on either new or edit, there is a condition for that as well.

Reply