How to force click "Check names" in a contact selector control - InfoPath Dev
in

InfoPath Dev

How to force click "Check names" in a contact selector control

Last post 09-11-2008 08:12 AM by nailbiter. 16 replies.
Page 2 of 2 (17 items) < Previous 1 2
Sort Posts: Previous Next
  • 09-10-2008 12:47 PM In reply to

    Re: How to force click "Check names" in a contact selector control

    Hello again.  Got sidetracked for a while and now I am back with this.  Per some changes below, this was the only way I could correctly autopopulate job titles in the repeating table in my browser-enabled form.  The one annoying behavior remaining is that with each row insert MY job title gets prepopulated (it then gets immediately overridden by the correct title based on the person entered in the control).  I’ve tried to clear the job title at different points within the method, to no avail.    Any ideas on how to overcome this?  Appreciate your insight.   To refresh your memory, I am invoking "getuserprofilebyname" from the "userprofileservice" web service.

    My main data source now looks like this (same structure as before, some items differently named):

    ContactSelector_Resources (repeating group)
      gpContactSelector
        Person (repeating group)
          DisplayName
          AccountId
          AccountType
      resource_title
      (...)

    Code: 

    public void InternalStartup()

    {

    EventManager.XmlEvents["/my:myFields/my:ContactSelector_Resources/my:gpContactSelector/my:Person"].Changed += new XmlChangedEventHandler(ContactSelector_Resources_gpContactSelector_Person_Changed);

    }

    (...)

    public void ContactSelector_Resources_gpContactSelector_Person_Changed(object sender, XmlEventArgs e)

    {

    if (!e.Operation.Equals(XmlOperation.Delete))

    {

    XPathNavigator secondaryDS = DataSources["GetUserProfileByName"].CreateNavigator();

    XPathNavigator secondaryRef = secondaryDS.SelectSingleNode("/dfs:myFields/dfs:queryFields/s0:GetUserProfileByName/s0:AccountName", NamespaceManager);

    XPathNavigator mainDS = e.Site.CreateNavigator();

    XPathNavigator mainRef = mainDS.SelectSingleNode("my:AccountId", NamespaceManager);

    secondaryRef.SetValue(mainRef.Value);

    DataSources["GetUserProfileByName"].QueryConnection.Execute();

    secondaryRef = secondaryDS.SelectSingleNode(@"/dfs:myFields/dfs:dataFields/s0:GetUserProfileByNameResponse/s0:GetUserProfileByNameResult/s0:PropertyData[s0:Name = ""Title""]/s0:Values/s0:ValueData/s0:Value", NamespaceManager);

    XPathNavigator jobtitle = mainDS.SelectSingleNode("../../my:resource_title", NamespaceManager);

     

    if (secondaryRef != null)

    {

    jobtitle.SetValue(secondaryRef.Value);

    }

    else

    {

    jobtitle.SetValue(string.Empty);

    }

    }

    }

     

  • 09-11-2008 08:12 AM In reply to

    Re: How to force click "Check names" in a contact selector control

    I am all set.  The missing piece was to simply add a rule to the resource_title field, as follows:

    Condition: if DisplayName is blank 

    Set field value (resource_title) to an empty string

    ------------------

    Hilary, special thanks to you for your invaluable guidance. 

     

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