Plugin Developer Discussion

Discussion for FogBugz Plugin developers

Unable to change the bug category when overriding OnCaseOpened

I'm trying to change the category of bugs submitted from scout so I've created a plugin that uses CPluginBugCommitEvents to handle the IPluginBugCommit methods. The body of my OnCaseOpened looks like this:

if( e.bug.ixPersonAssignedTo == 5 )
                e.bug.ixPriority = 1;
                e.bug.ixCategory = 2;
                e.bug.Commit( string.Empty, e.bug.ixPersonAssignedTo );

Hopefully I'm doing this correctly (as an aside, the only way I could figure out how to tell a bug was submitted by scout was to check if it was assigned to the scout user I created to receieve them). Anyway, what happens is the case is correctly set to priority 1 (which is what I'm after) but the category remains on bug.

Interestingly if I change the default category from the Settings table in the DB to 2 and try to set it to 1 in my plugin, then the case sticks with the category of 2. So it's as though my trying to change the category is being overriden by the default category.

Hope that makes sense!
John Conners Send private email
Friday, June 19, 2009
I have a case open to fix this, but for now what you need to do is set the ixStatus as well.  Basically you're setting the ixCategory, but the ixStatus still points to a status for the default category.  When we go to commit we check if they match and if not, we take the status's category since it is more specific.
David Fullerton Send private email
Friday, June 19, 2009
Thanks David, that makes sense and works perfectly. Much appreciated!
John Conners Send private email
Friday, June 19, 2009

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz