People picker returning just my details - InfoPath Dev
in

InfoPath Dev

People picker returning just my details

Last post 12-14-2017 08:00 AM by darrenfloyd666. 11 replies.
Page 1 of 1 (12 items)
Sort Posts: Previous Next
  • 12-11-2017 05:58 AM

    People picker returning just my details

     Hi

     Thanks to Hilary Stoupa on here I managed to get the People Picker field to populate fields for the selected user, but now regardless of who I pick it returns my details? Department, Job Title etc.

     This is the formula I've got for the Job Title:

    xdXDocument:GetDOM("GetUserProfileByName")/dfs:myFields/dfs:dataFields/tns:GetUserProfileByNameResponse/tns:GetUserProfileByNameResult/tns:PropertyData/tns:Values/tns:ValueData/tns:Value[../../../tns:Name = "SPS-JobTitle"]

    and the formula for Last Name:

     xdXDocument:GetDOM("GetUserProfileByName")/dfs:myFields/dfs:dataFields/tns:GetUserProfileByNameResponse/tns:GetUserProfileByNameResult/tns:PropertyData/tns:Values/tns:ValueData/tns:Value[../../../tns:Name = "LastName"]

    I can't see where I'm going wrong?  

     

     

     

  • 12-11-2017 07:16 AM In reply to

    Re: People picker returning just my details

    You have to set the query field in your GetUserProfileByName data connection and execute the query. Are you doing that? I encourage you to put the query & data fields for that data connection on your form, temporarily, and add a button that queries it so you can try setting the query field manually and seeing the results.
    Hilary Stoupa

  • 12-11-2017 07:35 AM In reply to

    Re: People picker returning just my details

     Hi Hilary. No I haven't set the query field on the GetUserProfileByName data connection. Do you have a link to a blog on how to do it. I'm looking at the modifying the data connection with the Data Connection Wizard, but can't see where I could do that.

  • 12-11-2017 07:40 AM In reply to

    Re: People picker returning just my details

    https://sharepointisland.wordpress.com/tag/getuserprofilebyname/ is just one sample. You don't do this in the data connection wizard - but in rules on the form.
    Hilary Stoupa

  • 12-12-2017 06:06 AM In reply to

    Re: People picker returning just my details

    I noticed that I'd set up an earlier rule that was populating the fields with my details so I stripped them out. I'm sorta lurching towards a solution case now when I select a user it populates the Job Title with i:o# norgine\hjones, so it's returning results for the selected user, just not the specific details. Problem is I can't see where that rule is that's returning the results. I've looked at the Rule Inspector but I can't see where it is. I've attached the form, it's on the Change of Details view. Any help would be really appreciated.

  • 12-12-2017 07:12 AM In reply to

    Re: People picker returning just my details

    You have a rule under FormLoad that runs the query without setting the query field. If the query field isn't set, the GetUserProfileByName connection returns info for the current user. You have a default value for JobTitle that sets the field to AccountID for some reason. As I've suggested in the past, it would be better to use rules for this, not defaults. That's why, in the past, I have suggested you have a helper field (in this form, we'd used "SelectedAccount" - and set the default of the helper field to the account id from your people picker. Then put the rules to set the query field, execute the query, and set all the other fields on "SelectedAccount". We do this because we can't set rules on a people picker.
    Hilary Stoupa

  • 12-12-2017 07:42 AM In reply to

    Re: People picker returning just my details

     Thanks Hilary.

     Sorry to sound thick. I understand the theory of setting the rules on the helper 'SelectedAccount field. We do that because we can't set these Form Load rules on the other fields. I've set the default of 'SelectedAccount' to AccounID. What I can't figure out even with following the link you posted yesterday is how to set the query field in the Data Connection, When I click the Query for data rule all I get is the Action field and Data connection field as pictured?

     

      


  • 12-12-2017 08:02 AM In reply to

    Re: People picker returning just my details

    The rule type is set a fields value. You set the field, then you run the query. See attached, on the SelectedAccount field I've added rules for you. I also put the secondary data source on the form for you to help you see the values.
    Hilary Stoupa

  • 12-12-2017 08:04 AM In reply to

    Re: People picker returning just my details

     Thanks again Hilary for your help, I'll take a look!

  • 12-14-2017 07:59 AM In reply to

    Re: People picker returning just my details

    Right so I'm setting the Form Load rule on the SelectedAccount field. I'm setting the SelectedAccount field to the People Picker AccountName, but as soon as I preview my name is coming straight up. What am I doing wrong?

     

     


  • 12-14-2017 08:00 AM In reply to

    Re: People picker returning just my details

     


  • 12-14-2017 08:14 AM In reply to

    Re: People picker returning just my details

    Did you try the form I attached? Does SelectedAccount have a value when the form loads? I'd assume the rule to set the query field & run needs to go on the SelectedAccount field - so it fires when that value changes.
    Hilary Stoupa

Page 1 of 1 (12 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.