Use lookup with current user and user field

  • 2 January 2018
  • 9 replies
  • 19 views

Badge +1

Hi All,

Here my context, i have a list which contains agent / manager and in another form i have to retrieve the manager of my current user and after i would ike to store the manager in a column. When I do a lookup i have no value.

lookup("Agent_Manager","Agent",usr_demandeur,"Manager")

and usr_demandeur is a variable : if(DemandePourUnAutreAgent,NomDemandeurUser,{Common:CurrentUser})

When i display my values in my list i have for example 1;#SPAdmin and for my curent user is something like i:0#.w|domainspadmin is there a way to do a lookup and retrieve the manager ?

Thanks a lot :-)


9 replies

Userlevel 5
Badge +14

it should work...

When i display my values in my list i have for example 1;#SPAdmin

do you mean it's a value of 'NomDemandeurUser'?

how do you get/populate this value?

is Agent field in Agent_manager list of type people or group?

Badge +1

Hi Marian,

Thanks for your help, It's a people field

Regards

Userlevel 5
Badge +14

I'm not sure, do you answer first or second question?

could you post some examples what do you experience and what's your list fields and form controls setup?

what forms platform and version are you on?

Badge +1

Hi Marian,

I have a list called "Agent_Manager" with two columns :

  • Agent : User field with only people authorized 
  • Manager : User field with only people authorized 

I have a Nintex form for access request, i have created a column  ManagerUser which is a user field, in my  form il would like to store automaticcaly in the column "ManagerUser" the manager of my current user or the manager of the field NomDemandeurUser if a check box is selected.

I hope you, I'm clear :-)

I'm in a SharePoint OnPremise environment with the last version of Nintex, my form is a responsive form not a classic.

Thanks a lot

Userlevel 5
Badge +14

I have a Nintex form for access request, i have created a column  ManagerUser which is a user field

sadly, you will not be able to populate ManagerUser form control of type people or group with runtime functions such as  lookup().

to populate people or group type of control you will have to use javascript (or an inline functions/formulas as default value in NEW mode). that's generally for 'classic' form. for responsive forms an equivalent should have been a 'set value' type of rule, unfortunately as of now, it is not yet supported on people or group controls.

you could use lookup() function just to display user's manager within calculated control value. however, calculated value control can not be connected to a people or group list field and so store in list item.

so you have to decide what's more suitable for your case.

Badge +1

Ok, so I was trying to do something impossible :-) I can see two solutions may be :

  • change the type of my field ManagerUser in text, so I can I do this ?
  • do an update of my element in my WF, I tried also this solution but I didn't manage to to this ?
Userlevel 5
Badge +14

yeah, both options are valid. the decision may depend on what's further usage of the field.

since you already have stored relation user-manager in separate list, maybe you do not need to store user's manager in list item at all. you can always dynamically look it from either from form or workflow.

Badge +1

My client would like to be able to filter in SharePoint view according this field. Thanks for your help

Userlevel 5
Badge +14

I'm not sure how experienced are your user, but likely simple text field will be best option for you.

there are some limitations on defining a filter condition on people or group field in list view.

Reply