Validation based on Employee List - InfoPath Dev
in

InfoPath Dev

Validation based on Employee List

Last post 09-12-2011 02:54 PM by suehernandez. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 09-12-2011 09:37 AM

    Validation based on Employee List

    Hello,

     I am creating a form for employee testing and need to perform some validation. In the past we've had incidents of people not being able to recall their employee number, first name in last name and so on. I currently have a list of all those facotrs broken down and would like to make sure that the first name entered is the first name, last name entered is the last name and the employee number that is entered is really the correct employee number tied to that name. How can this be done? Thanks in advance.

     

     

    -Mike

  • 09-12-2011 02:54 PM In reply to

    Re: Validation based on Employee List

    I would think that the first step would be to call the GetUserProfileByName method of the UserProfileService.asmx web service.  This is a "Secondary Data Connection".  Once you get the User's Profile (by passing in a blank value, that gets the currently logged in user), you can compare the first and last name.  If you have imported it into your SharePoint Profile, you can get the employee ID as well, but let's say this comes from a list.

    It would be something like this:

    • Create 3 Fields, CurrentUserFirstName and CurrentUserLastName, and CurrentUserEmployeeID
    • Set up a Data Connection to a Web Service (are you using IP 2007 or 2010?).  Point at
      https://NameOfYourServer/path/SiteCollection/Site/_vti_bin/UserProfileService.asmx
    • Use the GetUserProfileByName method with a blank input parameter to get the Current User's information
    • On a Form Opening Rule, set the 2 fields
    • Next, set up another Secondary Data Connection to your SharePoint List where the Employee ID Information resides.
    • On a Form Opening Rule, set the CurrentUserEmployeeID field
      • Basically set the value equal to:
        EmployeeID[UserFirstName = CurrentUserFirstName and UserLastName = CurrentUserLastName]  (or you can compare by AccountName from the UserProfileService)
    • After you've set up all the fields to compare against, you will need to put data validation on the fields in the Form in which you want them to fill out (OR JUST FILL IT OUT FOR THEM) upon Form Load)
      • Add Rule - Validation
      • Condition:  If FirstNameField Is Not Blank AND FirstNameField Is Not Equal To CurrentUserFirstName  **
        ** In this case, capitalization counts.  Use "The Expression" in the first dropdown and specifically the translate function if you want case-insensitive
      • Screen Tip:  Whatever you want, such as "First Name does not match your profile"
      • Same thing for Last Name and Employee ID

    As I eluded to in the steps, instead of validating against the values, just Place the values in the fields in question for them.

    ----------------------------
    Sue Hernandez
    MCPD - SharePoint Technologies

    http://www.akgroup.com
    http://info.akgroup.com/blog-0
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.