Verification Condition for Querying Database - InfoPath Dev
in

InfoPath Dev

Verification Condition for Querying Database

Last post 04-19-2016 11:48 AM by Hilary Stoupa. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 04-15-2016 01:10 PM

    Verification Condition for Querying Database

    Not sure if this is possible, I do not have the option to modify code in InfoPath, but I am able to query SOAP database to get user information, which is working beautifully but for certain users it does not work. The problem that I have run into, is that some of the members of active directory have a different domain than what the people picker chooses before the query is run.

    For example: John Smith

     I select John Smith on people picker and set the account name of data query field to NT-DOMAIN/jsmith (from account ID tab). 

     An error message pops up stating that the user does not exist.

     I look up the user John Smith on AD and his domain is actually DOMAIN/jsmith. 

     

    Is there a way to first query with NT_DOMAIN, check to see if there would be an error, and if so, then query with DOMAIN instead? Like an If-else query with: If query data for NT_DOMAIN/jsmith does not exist, else query data for DOMAIN_jsmith. Then proceed with the rest of the rules.

    I have tried playing around with the settings but it seems there is no way to change the action of query for data. Maybe I have been looking at it with tired eyes and there is actually a simple solution. Ideally, I do not want the user to get a pop-up if the user does not exist, instead the form is smart enough to re-query with  other domain and then continue filling out the form.

    Looks like 80% of the users on AD are configured with the correct domain, but there are those few that have the other domain name. 

     

    Thanks!

    Aaron

  • 04-15-2016 02:05 PM In reply to

    Re: Verification Condition for Querying Database

    I don't have good news - out of the box, if the query fails, InfoPath is going to return an error message to the user. Did you develop the SOAP web service (I'm assuming that is what you mean by SOAP database)? Maybe the web service could be modified to just take user name and not include domain? Then you could use a substring-after formula to set the web service query field to just the user name.
    Hilary Stoupa

  • 04-15-2016 02:17 PM In reply to

    Re: Verification Condition for Querying Database

    Yeah, I meant the SOAP Web service. Unfortunately I only have read only access. Would there be a way to automatically close or disable the error message? I have already tried querying with the substring-after formula to just pull the user and it errors out on the ones that have a different domain. I just want to slap the people who set up AD users for not being consistent.
  • 04-15-2016 03:16 PM In reply to

    Re: Verification Condition for Querying Database

    No, sorry if I was unclear. Out of the box in InfoPath, the error will display. You can add code (or use qRules) to execute the query and handle for errors that way.
    Hilary Stoupa

  • 04-18-2016 05:32 AM In reply to

    Re: Verification Condition for Querying Database

    Thank you Hilary!

    Could someone point me in the direction of  what kind of code I would need to use? Basically what I need is a way to query the database, check for an error (invalid user because of domain), if error is produced, then query with other domain. After determination of which domain is valid for the users, the rest of my rules execute.

    I will request access on my network to be able to use code in InfoPath which shouldn't be a problem, just may take a few days. I have experience coding in Java, but not C or VBasic.

     

    Thanks,

    Aaron

  • 04-19-2016 11:34 AM In reply to

    Re: Verification Condition for Querying Database

    Does anyone have ideas about code that will query with one domain, if the user is not found, then try another?

    I was thinking a try-catch block would work but I am still waiting for VB access on my network. I have tried searching around and I can't find anything similar to what I am asking.

  • 04-19-2016 11:48 AM In reply to

    Re: Verification Condition for Querying Database

     This post has a code sample that shows how to execute a web service query:

    http://www.infopathdev.com/forums/t/10879.aspx

    So - you can execute your query and catch any exceptions. If there is an exception, you can set the query field to the user name with the other domain and try again. 


     

    Hilary Stoupa

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