1

I created a small application used for tracking cases assigned to me (this is a personal project used only by me), and recently I have added the ability to reactivate cases. The problem is when I reactivate a case it is still assigned to me, I know I can pass the ixPersonAssignedTo or sPersonAssignedTo but I don't know who it is since I only pull down case number and title.

Will I have to pull down more information before reactivating the case to determine the resolver, or is there a special argument I can pass to reactivate the case back to the resolver?

The application is written in C# and uses the XML API.

Here is the code I'm hoping to use to work around this.

public static string[] ReactivateCases(string username, string password, string url, Dictionary<string, string> cases)
{
    System.Collections.Generic.List<string> errors = new System.Collections.Generic.List<string>();
    UBR.Products.TimeTrakker.Client.Lib.FogBugz.FBApi fb = new UBR.Products.TimeTrakker.Client.Lib.FogBugz.FBApi();
    UBR.Products.TimeTrakker.Client.Lib.FogBugz.FBApi.Url = url;
    try{
        fb.Login(username,password);
    }catch(System.Exception){
        throw new LogonFailedException("Logon Failed while getting cases");
    }
    foreach(KeyValuePair<string,string> _case in cases)
    {
        System.Collections.Generic.Dictionary<string, string> args = new System.Collections.Generic.Dictionary<string, string>();
        args.Add("ixBug", _case.Key);
        args.Add("sEvent", _case.Value);
        args.Add("ixPersonAssignedTo",GetCaseResolver(_case.Key,fb));
        try{
            fb.Cmd("reactivate",args);
        }catch(System.Exception ex){
            errors.Add("Case " + _case.Key + ": " + ex.Message);
        }
    }
    fb.Logout();
    return errors.ToArray();
}

public static string GetCaseResolver(string casenumber, UBR.Products.TimeTrakker.Client.Lib.FogBugz.FBApi fb)
{
    XmlNodeList nodes = fb.XSearch("ixBug:\"" + casenumber + "\"","ixPersonResolvedBy");
    XmlNode node = nodes.Item(0);
    return node.InnerText;
}
flag
Please contact us directly to hash this out. I'm sure we can figure it out. – Rich Armstrong Aug 4 2010 at 14:05
For posterity: tester101 confirmed that he got this code working in an email exchange we had. – Bradford Aug 24 2010 at 13:21
The working code is a simple workaround that makes a separate call to the API to retrieve the resolver, it is not the ideal solution to the problem since it involves two transactions instead of one. – Tester101 Sep 20 2010 at 16:12

1 Answer

1

It would be easiest to enable the Workflow Plug-in and make it so that the case reactivates back to the resolver automatically. Is that an option?

link|flag
Not sure how to do this. I don't have control over FogBugz so I can't make any changes. I think normally when using FogBugz the case is automatically assigned back to the resolver, but doing it through the api assigns it back to me. – Tester101 Aug 3 2010 at 13:51

Your Answer

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