Set Person Picker as Previous Section Value - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Set Person Picker as Previous Section Value

Last post 09-09-2018 08:04 AM by Trapperj. 20 replies.
Page 1 of 2 (21 items) 1 2 Next >
Sort Posts: Previous Next
  • 05-30-2017 06:36 AM

    Set Person Picker as Previous Section Value

    Hi all!

    First off, thanks for a great forum - you guys helped me pick up Infopath in a matter of days! However, I've been banging my head against my desk for a while trying to figure out this one thing.

    It seems like a simple idea - create a repeating section with a list of fields that the user fills out, with an option to "add another list item" below the form. If the user clicks on this, an additional item appears below the first with the same fields from the previous section. Some of those fields would be repeated from the info the user filled out in the first section.

    I was able to do this by going into my "Repeating Section Properties" and editing the default values for my string text fields to contain formulas like "../preceding-sibling::my:SharePointListItem_RW/my:Portfolio", and this works fine for text fields. However, I can't seem to figure out the formula needed for people pickers.

    I know there are three parts to each person picker (AccountId, AccountType, and DisplayName), and I feel like my formulas should be working, but they're not. I feel like I've tried every possible combination of "@'s", "my:'s", and colons!

    The latest formula I came up with (which doesn't throw an error, but doesn't return anything) is "../preceding-sibling::my:SharePointListItem_RW[1]/my:DataProvidedBy/@pc:Person/@pc:DisplayName". Is this simply not possible?

    Thanks!
    -Nate
  • 06-05-2017 08:31 AM In reply to

    Re: Set Person Picker as Previous Section Value

     Oh, it should be possible. And your formula looks right. Does it not work in preview & in the browser? Drag the people picker group onto your form as a repeating table so you can check and see if the values are getting set.... Or if the person group even exists by default in a new row.

    Hilary Stoupa

  • 06-20-2017 10:37 AM In reply to

    Re: Set Person Picker as Previous Section Value

     

    Hilary Stoupa:

     Oh, it should be possible. And your formula looks right. Does it not work in preview & in the browser? Drag the people picker group onto your form as a repeating table so you can check and see if the values are getting set.... Or if the person group even exists by default in a new row.

     Dear Hilary,

    first of all... Thank you SO MUCH for constantly helping everyone with their issues with Infopath, I ran into some problems while teaching myself how to use Infopath and most of the time, you've provided the answer already. However, I am now facing the same issue as ntfrueh and after hours of trying, I still can't manage to automatically copy the name from the people picker to the next section when adding it. I've tried all possible formula variations... any chance you can help me with this topic?

    I'd greatly appreciate it! Br, Johannes

     

  • 06-20-2017 11:10 AM In reply to

    Re: Set Person Picker as Previous Section Value

    I'd be happy to help you - any chance you can attach a copy of your template (or a test template) to a reply under the options tab?
    Hilary Stoupa

  • 06-20-2017 03:14 PM In reply to

    Re: Set Person Picker as Previous Section Value

    Thank you so much. The field I'm trying to set the default value (name) for is under "Name". "Buchungscode Airline" has the same functionality - I've already tried the preceding sibling formula on this field and it's working perfectly. The other issue I'm currently running into is to auto populate the date only from "Datum & Uhrzeit Abflug" to "Datum & Uhrzeit Ankunft" when the field is changed. It does work with date AND time, however, I've got no clue how to make that happen for the date only...

  • 06-21-2017 08:27 AM In reply to

    For the People Picker, try the attached (save the file locally, right click, select design to open in design mode, then preview). Instead of using default values, I added rules to the repeating group. However, this is a SharePoint List form, and I recall some issues with setting people pickers via rules in those - If I remember correctly, it worked on a new form, but not when I edited. This was a while back, and that bug may have been fixed. For the date time issue, I think the problem with just setting the date is that both fields are date time fields. I don't think you'll be able set just the date. If you set just the date portion of a date time field via a rule, you'll get a validation error....
    Hilary Stoupa

  • 06-21-2017 02:29 PM In reply to

    Re: Set Person Picker as Previous Section Value

    I still can't get it to work, tried to play around with the formulas a bit but there's still no result. Thanks a lot for the effort tho - really appreciate it. Until now I didn't know about the functionality to add rules to new sections, so it wasn't for nothing... I learned something new at least :-)

  • 06-21-2017 04:21 PM In reply to

    Re: Set Person Picker as Previous Section Value

    Maybe try removing the index ([1]) from the formulas. I just created a test form on one of my SharePoint sites for a list there and this worked as anticipated. It also worked in preview....
    Hilary Stoupa

  • 06-22-2017 06:32 AM In reply to

    Re: Set Person Picker as Previous Section Value

     Still can't get it to work unfortunately. I'll keep on trying and will post my feedback in case I've found a solution! As always, thanks a lot for the effort.

  • 06-22-2017 09:51 AM In reply to

    I found the problem! Incorrect XPath - there was an "@" in front of the people picker fields that did not belong there. Try attached copy.
    Hilary Stoupa

  • 06-26-2017 05:40 AM In reply to

    Re: Set Person Picker as Previous Section Value

    It works! Thank you so much for finding a solution, Hilary. There's only one new issue now: With the added rule, every time I'm editing an existing record the name field is emptied when the form is loading. I've changed the formulas to

    preceding-sibling::my:SharePointListItem_RW[1]/my:Name/pc:Person/pc:DisplayName
    preceding-sibling::my:SharePointListItem_RW[1]/my:Name/pc:Person/pc:AccountId
    preceding-sibling::my:SharePointListItem_RW[1]/my:Name/pc:Person/pc:AccountName

    but this also doesn't solve the issue... any more ideas?

  • 06-26-2017 08:02 AM In reply to

    Re: Set Person Picker as Previous Section Value

    So - you are saying when you re-open an existing item to edit, the people picker appears blank? Or am I misunderstanding? I want to see if the same issue exists in my test form - for some reason I have a vague recollection of something similar with InfoPath Browser forms (not just list forms).
    Hilary Stoupa

  • 06-27-2017 01:44 AM In reply to

    Re: Set Person Picker as Previous Section Value

     exactly. When I'm editing an existing item, the people picker is blank and I need to re-enter the name...

  • 06-27-2017 02:55 PM In reply to

    Re: Set Person Picker as Previous Section Value

    Got it - yep, same thing happens on mine. So - here's what worked for me. On the rule on the repeating group (my:SharePointListItem_RW), add a condition to only run the rule if the DisplayName field is blank. I think when the form loads in the browser to edit, the rules on the repeating group are executing, setting the first instance to blank, which then impacts the following instances.
    Hilary Stoupa

  • 07-01-2017 07:54 AM In reply to

    Re: Set Person Picker as Previous Section Value

     Sorry, I didn't find any time until now to complete the form. Your solution works perfectly now! Thank you so much Hilary. Really appreciate it.

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