cancel
Showing results for 
Search instead for 
Did you mean: 
kelliganp
Nintex Newbie

Populate fields based on Current User

Jump to solution

Hi Folks,

I have an issue that should be obvious but I do not see this issue handled in another post.

I am useing Nintex Fomrs 2016 (on-prem) and the form is classic.

My form should auto-populate based on {Common:CurrentUser}.

Fields to populate (based on a list in another site within the site collection) are...

  • Last Name
  • First Name
  • Employee ID
  • User ID
  • Email
  • Phone
  • Area/Section

 

If the form needs to be submitted on behalf of another user, then the current user will select that other employee from a list lookup control that already seems to be working correctly.

Once the form is submitted, we want to lock down the fields so that they cannot change, and of course, they should NOT auto-populate again when the form is opened by another user.

We are getting the curernt user to show up in a calculated control with the following formula:

userProfileLookup(Current User, "PreferredName")

Hopfully someone out there has done this or can point me in the right direction.

 

Thanks and regards,

Patrick Kelligan

Labels: (1)
0 Kudos
Reply
15 Replies
rameshmusham
Nintex Newbie

Re: Populate fields based on Current User

Jump to solution

Can you send the configuration screenshot of one of the field you are prepopulating based on the lookup or current user.

0 Kudos
Reply
kelliganp
Nintex Newbie

Re: Populate fields based on Current User

Jump to solution

Hi @rameshmusham,

 

Sure. Below is the configuration of the last name control that I am trying to auto-populate. All of the other controls are configured similarly.

 

2019-06-05_13-03-03.png

0 Kudos
Reply
rameshmusham
Nintex Newbie

Re: Populate fields based on Current User

Jump to solution

I don't know why you are using Javascript instead of built in Runtime Funtion to get the lookup values from other list "lookup()" in calculated column. 

 

You can add a rule (Formatting) on the fields that should be locked (disabled) other than new form and write a condition as not(Is New Mode) and select Disable.

 

You can also update the calculated field userProfileLookup(Current User, "PreferredName") to Recalculate only on new mode need to be YES , Edit mode-No, View Mode-No and this applies to all the auto populated columns (if you use runtime function lookup()).

0 Kudos
Reply
kelliganp
Nintex Newbie

Re: Populate fields based on Current User

Jump to solution

Thanks for the reply @rameshmusham,


@rameshmusham wrote:

I don't know why you are using Javascript instead of built in Runtime Funtion to get the lookup values from other list "lookup()" in calculated column. 


Because do not know how to do what you are suggesting. If I use the following...

lookup("/ASP/PMO/AdminWebDB|tbl_Westerners","ID",????,"LastName")

...what do I put in the "value to filter on" argument (assuming I am using the other arguments correctly)? I suspect it should be something from the current user calculated field output but I am not sure how to configure it.

 


@rameshmusham wrote:

You can add a rule (Formatting) on the fields that should be locked (disabled) other than new form and write a condition as not(Is New Mode) and select Disable.


Yes, I understand how to lock down the controls with formatting rules. My concern was more with keeping the controls from auto-populating again after the from has been submitted again. It looks like you adressed that in the final sentence of your reply. I will look that over and see if I can make it work.

 

Thanks and Regards,

Patrick

0 Kudos
Reply
rameshmusham
Nintex Newbie

Re: Populate fields based on Current User

Jump to solution

You mentioned in the subject based on current user, so i thought you are using the current user to filter on the list and you have something that similar to current user/dropdown list (other employee) that you are filtering on the other list.

 

Can you tell me based on what value are filtering and which column you are fitlering to prepopulate the values.

0 Kudos
Reply
kelliganp
Nintex Newbie

Re: Populate fields based on Current User

Jump to solution

Hi @rameshmusham,


@rameshmusham wrote:

You mentioned in the subject based on current user, so i thought you are using the current user to filter on the list and you have something that similar to current user/dropdown list (other employee) that you are filtering on the other list.


Yes, that is the rub. I prefaced with "Current User" because for years I have tried to use things like the Web Request control to access LDAP but to no avail. I even sat down with some of the Nintex folks at two different conferences (Las Vegas and San Diego) but we were unable to get it to work. The closest we could come is by accessing the {Common:CurrentUser} feature. I Use current user as part of the List lookup control when requesting "on behalf of" successfully so I natually go there with this other train of thought. If there is a better way to do this other tan current user, I am definatly willing to try other things.


@rameshmusham wrote:

Can you tell me based on what value are filtering and which column you are fitlering to prepopulate the values.


Well, I have not figured it out on the initial auto-populate but here is how we are doing the list lookup part.

The list lookup config is as follows with "jsvar_EmployeeLookup_LLU" as the Client ID JavaScript variable name.

LLU Config.png

The calculated value control for the Last Name, by example, is configured as follows with Client ID JavaScript variable name of jsvar_LastName_CAL.

LN CV.png

 

Now, the code that runs this process is as follows...

function() {
	if (NWF$('#'+ jsvar_EmpID_CAL).val())
	{
		NWF$('#'+ jsvar_EmpID_TXT).val(NWF$('#'+ jsvar_EmpID_CAL).val());
		NWF$('#'+ jsvar_LastName_TXT).val(NWF$('#'+ jsvar_LastName_CAL).val());
		NWF$('#'+ jsvar_FirstName_TXT).val(NWF$('#'+ jsvar_FirstName_CAL).val());
		NWF$('#'+ jsvar_MI_TXT).val(NWF$('#'+ jsvar_MI_CAL).val());
		NWF$('#'+ jsvar_Section_TXT).val(NWF$('#'+ jsvar_Section_CAL).val());
		NWF$('#'+ jsvar_DateOfHire_DTE).val(NWF$('#'+ jsvar_DateOfHire_CAL).val());
		NWF$('#'+ jsvar_Phone_TXT).val(NWF$('#'+ jsvar_Phone_CAL).val());
		NWF$('#'+ jsvar_EmployeeEmail_TXT).val(NWF$('#'+ jsvar_EmployeeEmail_CAL).val());
		NWF$('#'+ jsvar_Gender_CHO).val(NWF$('#'+ jsvar_Gender_CAL).val());
		NWF$('#'+ jsvar_PassportNumber_TXT).val(NWF$('#'+ jsvar_PassportNumber_CAL).val());
		NWF$('#'+ jsvar_PassportExpiration_DTE).val(NWF$('#'+ jsvar_PassportExpiration_CAL).val());
		NWF$('#'+ jsvar_SupervisorEmail_TXT).val(NWF$('#'+ jsvar_SupervisorEmail_CAL).val());
	}
}

let me know if this answers your questions or if I left anything out.

Thanks and regards,

Patrick

 

 

 

 

 

 

 

 

 

 

0 Kudos
Reply
rameshmusham
Nintex Newbie

Re: Populate fields based on Current User

Jump to solution

Can you please take a look of the attached use case document and let me know are you trying to achieve the same scenario or not.

View solution in original post

0 Kudos
Reply
kelliganp
Nintex Newbie

Re: Populate fields based on Current User

Jump to solution

Thanks for the use case @rameshmusham!

I have looked it over and first, the not(Is New Mode) is cool! I did not know how to use that. Thanks!!

The overall princilpe is what I need to accomplish. I have a snag however.

Your list called TestB coresponds to my tbl_Westerners.

The paths for my lists are as follow:

  • ListA: /ASP/dev/T1
  • ListB: /ASP/PMO/AdminWebDB/Lists/tbl_Westerners

In your use case, the fomula you create references ListB assuming it will be colocated in the same site. Is there a way for me to reference this in another site within the same site collection?

 

Also, just to satisfy my curiosity, there is a point in the formula where you use single quotes as opposed to double quotes. Is there a reason for this?

 

Thanks and Regards,

Patrick

0 Kudos
Reply
kelliganp
Nintex Newbie

Re: Populate fields based on Current User

Jump to solution

..also, I just tried the following formula to try and reach the other site and it did not work.

if(cv_CurUserPreferredName && isNullOrEmpty(llu_Western_Employee),lookup("/ASP/PMO/AdminWebDB|tbl_Westerners","LastName","FullName",cv_CurUserPreferredName,'FirstName'),lookup("/ASP/PMO/AdminWebDB|tbl_Westerners","LastName","FullName",parseLookup(llu_Western_Employee),'FirstName'))

Do you see any issues with my syntax or typos I maght be missing?

0 Kudos
Reply