2

I am using the FogBugz API to integrate with another ticketing system. Following pseudo code outlines the process:

Foreach NewTicket in SystemX
{
    ReadTicketFromSystemX
    if ticket == new
        CreateFogBugzCase
    else if ticket == resolved
        ResolveFogBugzCase
    else
       Do nothing
}

So there could be a lot of tickets as this runs once every hour or so. The problem arises when there is a create and the linked resolve in the same batch. The create happens and a new fogbugz case is successfully created. Then it tries to do a search based on the unique ticket criteria (the other ticket has no knowledge of FogBugz of course) to find the case that was just created so that it can update it to resolved.

The search fails. If I wait a couple of minutes and run the resolve through again it successful finds the case and works as expected.

So I assume this has to do with the FullText indexing done in the DB not occurring fast enough so the search fails to find the newly created case. Is there anyway for me to find that ticket without relying on the search index to be updated? Anyway to allow me to just get a ticket where field = something?

The field I am doing a search on is the 'Computer' field. I am using this field to store the other system's unique ticket ID.

flag

1 Answer

1

Hi Kelsey,

There are two options that come to mind:

  1. Cache the index of each bug that is created within a single batch in a dictionary (key = SystemX's unique id, value = index of the newly created FogBugz case), and use that to find the bug should you need to resolve it within the same batch.

  2. Write a plugin which uses a query that doesn't rely on fulltext indexing:

CBugQuery query = api.Bug.NewBugQuery();
/* if the following line is omitted, only the cases the current
* user can see will be returned. permissions are still enforced
* on each CBug object returned */
query.ExcludeUnreadable = false;
//query.IgnorePermissions = true;
query.AddWhere("sComputer = @sComputer");
query.SetParamString("sComputer", SystemXUniqueID)
CBug[] rgBug = query.List();
link|flag
Your first option is what I was considering. I didn't know about the second option :) – Kelsey Nov 19 2009 at 16:47
edited this answer: the second option is a plugin, not an xml api call from an external script – adambox Jul 18 2010 at 14:43

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.