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

Nintex Forms Managers name into people picker

Jump to solution

Is there anyway to specify either the current users, or a person selected in a people picker, Manager is a people picker field on a form?

 

From what I can see it doesn't look like the default value for people picker fields will let you use the 'userProfileLookup' runtime function which would be perfect.  The default value also will not let you use workflow variables for some reason?

 

Does anyone know an easy work around to get that working?

 

P.S.
I can easily populate a calculated field with a users manager, this question is specifically about populating a people picker field with this value.  We have numerous employees that report to multiple people so we'd like to allow the employees to change the specified manager if needed.

 

Thanks.

Labels: (2)
Reply
21 Replies
Highlighted
mlauer
Nintex Newbie

Re: Nintex Forms Managers name into people picker

Jump to solution

Hi Nick,

look at the article Developing against the new people control in Nintex Forms from Tom Shirley. I use this api to populate a People Picker Control with the manager name of another People Picker Control in the form.

http://walkingthestack.com/2014/04/08/developing-against-the-new-people-control-in-nintex-forms/

Best Regards

Manfred

0 Kudos
Reply
nhurst1369
Nintex Newbie

Re: Nintex Forms Managers name into people picker

Jump to solution

I don't see exactly how you can use those functions to return the manager?  I see how you can set the people picker, but can you use the search function to find the manager?

Also how would you get it to run when the form is loaded and again if the people picker field is changed?  The article only talks about running it on form load. 

Thanks. 

0 Kudos
Reply
mlauer
Nintex Newbie

Re: Nintex Forms Managers name into people picker

Jump to solution

Hy Nick

In the form settings You have to include the following javascript files in the advanced section:

  1. SPServices from https://spservices.codeplex.com/
    You’ll need to make a slight adjustment to extend the NWF$ object, see http://thechriskent.com/2013/08/08/use-spservices-in-nintex-forms-2010/
  2. FillPeoplePicker.js as seen attached

In my Form I have to People picker controle, one with css class antragsteller and default value 'Current User', another with css class 'manager-control'. When the form is loaded, the manager of the current user will populated to the control manager-control. If you delete the name in the first control, the manager name will also be deleted. When You enter a new name in the first control, the manager name will populated to the manager-control.

Best Regards

Manfred

Reply
Automation Master
Automation Master

Re: Nintex Forms Managers name into people picker

Jump to solution

Here is a pretty good link on how to use Javascript to accomplish this: Nintex Forms: Automatically populating the new people picker control - Wow, So SharePoint, Much info...

0 Kudos
Reply
Automation Master
Automation Master

Re: Nintex Forms Managers name into people picker

Jump to solution

You asked for an easy solution, and although the Javascript isn't terribly complicated, maybe you could use this as an alternative:

1) Use a calculated field as you mentioned - this was really easy.    Next to the calculated field have a check box that says "Change Manager".


2) If they click on the check box, hide the calculated field using a simple built in rule.

3) Have a rule that displays a People Picker from which they can now select a new manager.

You should very easily be able to determine which manager they want to use within the workflow by simply seeing if the checkbox is selected or not.

Thanks

0 Kudos
Reply
nhurst1369
Nintex Newbie

Re: Nintex Forms Managers name into people picker

Jump to solution

Thanks to both of you for the information and alternatives!  Yeah since the javascript solution also requires SPServices I'd really rather stay away from that from a long term maintainability standpoint.  This will be the method that we publicize to our site owners to use so I want to keep it as simple and maintainable as I can.  So I think we'll go with the checkbox method.

The fact that you can't use rules to set field values has probably been the biggest complaint we've had as we switch from InfoPath to Nintex forms.  Hopefully it's a feature that is coming soon!

0 Kudos
Reply
Not applicable

Re: Nintex Forms Managers name into people picker

Jump to solution

Hi Nick ,

What the guys suggested above is actually fine? I did use their solution it works.

Javascript is the only option to get the user profile information on the Nintex Forms if you want them editable

Check the link  https://community.nintex.com/docs/DOC-1222?sr=stream#comment-1295

NWF$('#' + varManager).val(GetUserProperty(data,"Manager"))

this will get Manager value

If you want the information about someother user account, then replace the ajax url with

"/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountname=@v)?@v=%27" + useraccountname + "%27"

useraccountname is the domain/account of the user form whom you need the information

0 Kudos
Reply
Automation Master
Automation Master

Re: Nintex Forms Managers name into people picker

Jump to solution

Great to hear and glad to help, I'd mark this one as resolved.

0 Kudos
Reply
john_luangci
Nintex Newbie

Re: Nintex Forms Managers name into people picker

Jump to solution

Hi All,

This is also something that we are trying to do. An interesting thing I learnt recently from Anthony Sopkow is that you are "actually able to pass a value from a formula control over to a custom JavaScript function from within the calculated field". Re: Using Nintex Form Runtime Lookup Function to populate a textbox

This gave me a thought that we can use the runtime function together with the new people picker api to:

  • make use of the runtime function called userProfileLookup to get the manager of a the user from my first people picker and run a custom javascript function whilst passing the manager value into the function. 2014-12-15_1437 - JohnLuangco's library
  • use the new people picker api to populate the second people picker field for the manager by attaching a client ID javascript variable name to the field so that it can be located by the custom function 2014-12-15_1438 - JohnLuangco's library

Custom JavaScript Function (Replace PS with your own domain)

function setManager(value){

    var processedUserName = value.replace("PS\\","");

    var ins = new NF.PeoplePickerApi('#'+ manager_id);

    ins.search('PS\\'+processedUserName).done(function (data) {

    ins.add(data[0]);

  });

}*/

This seems to work well, however I notice that the formula control will call the javascript function twice which then causes the manager to be populated twice in the people picker. Does anyone have any suggestions on how to prevent this?

Thanks

John

Reply