General Technical Discussions for Service

Get Involved. Join the Conversation.

Topic

    Adey Khader
    Addin Query issue
    Topic posted July 20, 2017 by Adey KhaderRed Ribbon: 250+ Points 
    80 Views, 1 Comment
    Title:
    Addin Query issue
    Content:

    Hi Everyone, 

    We have a new addin to create addresses for the customers. this addin acts exactly as the out of the box address field and it saves the data into the address fields in the database. We are facing a real issue with that:
    So what have recognized is that: 
    1- Sometimes for no specific reason the query that we use to grab the countries times out and returns an exception even though it is working most of the time. IF that happened the textbox that will contains the current customer address info will populate empty and the State will not populate.
    2- I can't use the dataload event, it never fires and if I will call my contact from there it will never work!!
    3- I focused on preventing the query from timing out as attached in this email. I created a do while logic with try catch. I also was able to find some timing out code to increase the time out time.
     
    Attached are 3 files.
    Hint: 
    IGLOBALCONTEXTEXTENSIONS includes the time out code after extended.
    WorkspaceAddin.cs includes the way that I am calling my contact. 
    APRHelper is where the query and the do while logic. 
    Image:
    Document:

    Comment

     

    • Scott Harwell

      What exactly is the exception that you are getting?  Is it simply a timeout, or something specific?  Does the request actually run for the full 10 minutes that you have set in your client binding?  Since you are performing synchronous operations, is your UI locked during the request process?

      It seems somewhat expensive to perform an object query for all of the states every time that the workspace loads.  Are you performing an object query so that you can use WPF bindings to load the list?  Is your helper loading outside of your workspace add-in to cache these values, or are you performing the same query every time that your addin loads in a workspace?  

      A couple of things to try without knowing more about the timeout...

      • Switch from an object query to a tabular query and then create the Country objects from the tabular results in the add-in if you need to bind to an observable list of that object type.
      • Use a GetValuesForNamedID operation, which might be quicker than a ROQL query.
      • Try moving some of your methods to async processes and enable the UI of your addin once the country data is loaded from the other thread.
      • Have a helper add-in that loads this data at the global level on console load so that you don't have so many API hits for the same data for all agents at this customer.