Infopath 2013 Rule - Set Field Value based on another field - InfoPath Dev
in

InfoPath Dev

Infopath 2013 Rule - Set Field Value based on another field

Last post 07-11-2017 07:47 AM by Hilary Stoupa. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 02-18-2016 07:45 AM

    Infopath 2013 Rule - Set Field Value based on another field

    I've searched for an answer to this likely simple task, but as a newbie I get lost in reading possible solutions. Basically what I want is VLOOKUP functionality. I've attached the xsn file (the most current iteration) In my IP form I have a drop-down field that calls to a secondary data source, a Sharepoint list called Cyberstone Classes and Teachers. This list has 3 columns: ID / Course / Teacher. What I would like to happen - in the form the user will select a course from the drop-down (easily done); I then want another form field to auto-populate with the corresponding teacher from the secondary list (my problem). In my best attempts I will get a teacher name to fill in automatically, but not the correct name, and that name doesn't change when I select a different course. On the Course field I have create an Action rule > Set a Field's Value. Here's where it gets messy for me. I've tried many different options but no luck so far. Some questions and things I've tried: * The teacher field on the main form - should it also be a drop down box, or just a text field? Does it matter? My attached example has both, just to try them out. * Setting the rule details - when setting the Field and Value I've been clicking the symbols to the right of the field (Xpath and Fx) and then going into Advanced View which allows me to select the data source. Should both items go back to the secondary data source (CyberStone Classes and Teachers)? And if so - do I select from the Query Fields or the Data fields? I've tried many combinations, with no success. * On the main Rule panel - Do I need to set a condition? And if so, what would I set that to? * I have read other posts about setting the filters. This totally loses me. Thanks for any help.
  • 02-18-2016 08:09 AM In reply to

    Re: Infopath 2013 Rule - Set Field Value based on another field

     In the Cyberstone Classes and Teachers list in SharePoint, is the Teacher column a lookup to another list? Or is it just a text field?

    In general, I think the rule you currently have on the Course field is close. You need to add a filter to indicate which teacher you want - I'm attaching a screenshot. The first value in the filter is the ID from the Cyberstone Classes and Teachers list. That is because in your Course dropdown, the value field is the ID - so the Course field in your form will be storing a number. The field we compare to in the filter is the Course field in the main data source.

    We are saying:
    In this list of many rows, called Cyberstone Classes and Teachers, I want the Teacher from the row where the ID is equal to the selected Course in my form.

    Does that make sense? 


    Hilary Stoupa

  • 02-18-2016 08:35 AM In reply to

    Re: Infopath 2013 Rule - Set Field Value based on another field

     Thanks! That worked!  Setting those filters is tricky - it seems a rabbit hole of clicks to get to the correct filter-setting window.  Your answer made sense - but I will need to study it carefully to be able to replicate it with other scenarios.

     Many thanks! 

     (Oh, and the teacher column is just a text field)

     

  • 02-18-2016 11:14 AM In reply to

    Re: Infopath 2013 Rule - Set Field Value based on another field

    You also asked about query vs. data fields - sorry, I didn't answer that. We use query fields to return only specific information from the data source. So - in the data connection we were looking at, you could set the query Teacher field to "John Smith" and then add another rule to run the query. Only data with the Teacher = John Smith would be returned. The returned data is in the data fields. Hope that helps!
    Hilary Stoupa

  • 07-06-2017 10:13 AM In reply to

    • Rehan
    • Not Ranked
    • Joined on 07-05-2017
    • Posts 2

    Re: Infopath 2013 form unable to auto populate current user details

    In my Infopath Form I wanted to Auto Populate current user information in SharePoint 2013. I followed directions from this blog: https://blogs.technet.microsoft.com/anneste/2011/11/02/how-to-create-an-infopath-form-to-auto-populate-data-in-sharepoint-2010/ I created a data connection receiving information from UserProfilebyname web service in SharePoint. https://portal.company.com/_vti_bin/UserProfileService.asmx?WSDL The data connection was created successfully. I'm using SharePoint 2013 with Calims Based Authentication and Infopath 2013. Since InfoPath form server doesn't understand claims based in SharePoint 2013, all web applications are windows claims, hence I use secure store and pass credentials as NTLM and also, Disable loopback check. Followed instructions by https://blogs.technet.microsoft.com/rajbugga/2013/08/07/infopath-sharepoint-200720102013-configuration-and-troubleshooting/ Then I added a field to the form called LastName and entered the properties of the field and using the Insert Formula I created the following default value Value[Name = "LastName"] When i'm preview the form it populate correct current user LastName but when I published the form, In the browser its not populating correct current user LastName instead its showing SharePoint "Farm Admin" details. Please help me figuring out the issue. Thanks, Rehan
  • 07-07-2017 12:17 PM In reply to

    Re: Infopath 2013 form unable to auto populate current user details

    Well - that's because you are using secure store in your UDCX. :) However, this should work w/out that. Create a simple test form. Add a data connection to the user profile service (set it to NOT run on load) and drag all the query and data fields onto your form so you can see the values. Add a button that runs the query. Add a calculated value that displays the result of the "userName()" function, so you can see what is returned by that function. Then publish it up and open it in the browser. This gives you a chance to figure out what you need to set the query field to in order to successfully get back your user profile info.
    Hilary Stoupa

  • 07-10-2017 10:21 AM In reply to

    • Rehan
    • Not Ranked
    • Joined on 07-05-2017
    • Posts 2

    Re: Infopath 2013 form unable to auto populate current user details

    Thanks for the quick reply. As per your instructions i created Simple Test List with three columns (LastName, FirstName, UserName) and added new data connection to the user profile service(I did not use secure store this time and did not set rule on form load), added button instead and set the rules on the button click. Also drag all the query and data fields onto the infopath form. When i'm previewing the form on button click it populates current user infomation but when I published the form, In the browser its throws below querying data source error: "An error occurred querying a data source. Click OK to resume filling out the form. You may want to check your form data for errors. Hide error details An error occurred while trying to connect to a Web service. An entry has been added to the Windows event log of the server. Log ID:5566 Correlation ID:a8f4039e-2dd2-6006-b15f-2c541921967f" I checked the log with above correlation ID. It records below error: The following query failed: GetUserProfileByName. Type: DataAdapterException, Exception Message: The remote server returned an error: (500) Internal Server Error. Server was unable to process request. ---> Attempted to perform an unauthorized operation. The remote server returned an error: (500) Internal Server Error.) a8f4039e-2dd2-6006-b15f-2c541921967f Try resolving thru below blogs: https://social.technet.microsoft.com/Forums/ie/en-US/de207777-f042-4673-bc21-c3a8ca3d4a5b/an-error-occurred-while-trying-to-connect-to-a-web-service-infopath-2010-sharepoint-2010?forum=sharepointgeneralprevious https://blogs.msdn.microsoft.com/russmax/2012/08/17/want-to-call-sharepoint-2010-web-services-within-browser-based-infopath-2010-forms/ non of these helps.. Any suggestion would greatly appreciated?
  • 07-11-2017 07:47 AM In reply to

    Re: Infopath 2013 form unable to auto populate current user details

    This is a SharePoint 2013 site, right? Is your server up-to-date on it's patches? I've got 2013 ShP sites with 2013 InfoPath browser forms that have no issues w/ the user profile service (once loopback check is disabled) but I'm not really sure what to suggest you try next... can you admin deploy a form and see if you get a different result?
    Hilary Stoupa

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