Accessing DataSource via Web Service - Error when no matching results - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Accessing DataSource via Web Service - Error when no matching results

Last post 06-30-2014 02:51 AM by donstephen. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 06-27-2014 07:24 AM

    • MikeH
    • Not Ranked
    • Joined on 06-11-2014
    • Posts 3

    Accessing DataSource via Web Service - Error when no matching results

    Hi All,

    Any advice/suggestions would be much appreciated on the following issue I am experiencing.

    Overview:

    I am trying to get a count of the matching WinAccounts from a datasource via a Web Service. So a user opens the form, they click Get Count, the form accesses a datasource and finds how many matches there are for the current form user.

    If there is a match then a count is successfully returned which is great - exactly what I want. However if there are no matches, an error is displayed. It needs some kind of error handling for the event that there are no matches.

    Error:

    The query cannot be run for the following DataObject: GetContact
    InfoPath cannot run the specified query.
    The SOAP response indicates that an error occurred on the server:

    Server was unable to process request. ---> Failed to Get Contact for User1 ---> Failed to Get Contact for User1 ---> Failed to get contact details for User1
    ---> Failed to get contact details for User1

    Details:

    I have 1 field called Count.

    I have 1 DataConnection called GetContact. This is a RECIEVE connection using a webservice. The DataSource has 2 columns, ID and WindowsAccount

    I have 1 button on the form called 'Get Count'.

    I have 3 rules on the button Get Count as follows:

    Set query field for web service to current form user

    • Set a fields value: WindowsAccount (a query field on GetContact Data Connection) = userName()

    Execute Query

    • Query using a data connection:GetContact

    Get Count

    • Set a fields value: Count = count(ID)
  • 06-29-2014 04:11 PM In reply to

    Re: Accessing DataSource via Web Service - Error when no matching results

    Hi Mike,

    The logic seems right so I'm not sure what's causing the problem. Do you by any chance have other query related actions to the current user which should only run if there is a returned value for the userName()? If so then you should disable these rules from running by adding a Number of occurrences type of condition.

    Regards,

    Don Stephen Lambatin / Support Engineer
    Qdabra Software
  • 06-30-2014 01:49 AM In reply to

    • MikeH
    • Not Ranked
    • Joined on 06-11-2014
    • Posts 3

    Re: Accessing DataSource via Web Service - Error when no matching results

    Thanks for your reply.  I've created a simple test form which has no other data connections/controls/rules/etc. and it is still happening.  The error appears if it can't find a matching user account.  If if finds one it returns the count successfully. 

    If I take out the Get Count rule, if still errors at the Execute Query rule, so it's at the point of query that it errors (if there is no match).

  • 06-30-2014 02:51 AM In reply to

    Re: Accessing DataSource via Web Service - Error when no matching results

    Hi Mike,

    Thank you for that. I'm now seeing what the issue here is. For some reason, the GetUserProfile method will return this error for accounts that that do not match or have no permissions. Perhaps you would need to use another method for checking the accounts. After a quick check, I was able to find a thread in MSDN for checking SharePoint group members here. Hope I'm able to point you toward the right direction.

    Don Stephen Lambatin / Support Engineer
    Qdabra Software
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.