Auto Populate User Information in InfoPath with Claims Based Authentication – Part 1 of 3

I left part 1 of this 3 part series off with me getting an error (Log ID: 5566) when the form is published and accessed via a browser.

Part 2 of this series, I’ll go over how to resolve this error in InfoPath.

This post has step by step instructions.  Fair warning!!, this is a long one.

Let’s go back to designing InfoPath form.

1. In the Rules window, under Run these actions, click Add, and select Set a field’s value

2. In the Rule Details window, in the Field section, select the FieldSelectorIcon icon

3. Verify that Main is selected, and expand dataFields until you see strCurrentUser

4. Select strCurrentUser, and click OK

SelectstrCurrentUser

5. In the Rule Details window, in the Value section, select the FormulaIcon icon

6. In the Insert Formula window, click Insert Function… (This will open the Insert Function window)

7. In the Categories pane, select User

8. In the Functions pane, select userName, click OK

SelectuserName

9. The Insert Formula now has userName() listed, click OK

userName

10. The Rule Details window now has userName() as the value assigned to strCurrentUser, click OK

RuleDetailsUserName

11. In the Rules window, under Run these actions, click Add, and select Set a field’s value

12. In the Rule Details window, in the Field section, select the FieldSelectorIcon icon

13. Verify that Main is selected, and expand dataFields until you see Account ID

14. Select Account ID, and click OK

SelectAccountID

15. In the Rule Details window, in the Value section, select the FormulaIcon icon

16. In the Insert Formula window, click Insert Field or Group… (This will open the Select a Field or Group window)

17. In the Select a Field or Group window, verify that Main is selected

18. Expand the dataFields until you see strCurrentUser

19. Select strCurrentUser, and click OK

20. The Insert Formula window now has strCurrentUser listed, click OK

21. Click OK to close the Rule Details window

This is where assignment of strCurrentUser to AccountName takes place.

22. In the Rules window, under Run these actions, click Add, and select Set a field’s value

23. In the Rule Details window, in the Field section, select the FieldSelectorIcon icon

24. Change Fields from Main to GetUserProfileByName (Secondary), and expand queryFields until you see AccountName

25. Select AccountName, and click OK

SelectAccountName

26. In the Rule Details window, in the Value section, select the FormulaIcon icon

27. In the Insert Formula window, click Insert Field or Group… (This will open the Select a Field or Group window)

28. In the Select a Field or Group window, verify that Main is selected

29. Expand the dataFields until you see strCurrentUser

30. Select strCurrentUser, and click OK

31. The Insert Formula window now has strCurrentUser listed, click OK

32. Click OK to close the Rule Details window

RuleDetailsAccountName2

The confusing part is over, now I just need to populate the remaining fields.

33. In the Rules window, under Run these actions, click Add, and select Set a field’s value

34. In the Rule Details window, in the Field section, select the  FieldSelectorIcon icon

35. Verify that Main is selected, and expand dataFields until you see E-mail

36. Select E-mail, and click OK

37. In the Rule Details window, in the Value section, select the FormulaIcon  icon

38. In the Insert Formula window, click Insert Field or Group… (This will open the Select a Field or Group window)

39. In the Select a Field or Group window, change Main to GetUserProfileByName (Secondary)

40. Expand the dataFields until you see Value

41. Select Value, and click Filter Data

SelectValueAndFilterData

42. In the Filter Data window, click Add (This will bring up the Specify Filter Conditions window.)

43. In the Specify Filter Conditions window, change Value to Select a Field or Group…

44. In the Select a Field or Group window, select Name, and click OK

SelectName

45. In the Specify Filter Conditions window, change the last drop down to Type text…

46. Type WorkEmail, and click OK (This will return you back to the Filter Data window

FilterConditionsWorkEmail

47. The Filter Data window now has WorkEmail configured, click OK

48. Close the Select a Field or Group window by clicking OK

49. Close the Insert Formula window by clicking OK

50. Close the Rule Details window by clicking OK

RuleDetailsWorkEmail

51. Repeat steps 33 through 50 for the remaining fields

a. First Name = FirstName

b. Full Name = PreferredName

c. Manager = Manager

52. Let’s test our settings by previewing InfoPath form.

FormPreview2

Everything looks good at this point.  I’m still not ready to publish the form just yet.  I’ve been impatient in my testing and tried to see my progress.  Of course, after I published and tried to access via a Web browser, the dreaded error 5566 still has not gone away.  So, be patient.  We’re almost there.

Here are the rules I have on my form.

AllRuleActions

There are more steps to complete this, but this post is long enough as it is.  Let’s finish it up on Part 3 of this series.

Auto Populate User Information in InfoPath with Claims Based Authentication – Part 3 of 3

Learn more about Centric’s Portals and Collaboration Practice

Advertisements