Home Home
  login

Gemini Community Support Site

This Gemini community support site can be used to find solutions to product issues. You can log in using Open Id, Google Profile and even Facebook. Feel free to ask a question or browse FAQs and documentation. Product tour videos are also available along with how-to videos demonstrating key Gemini capabilities.




GetFilteredIssues - multiple custom fields

custom-fields
Hello everyone!

I'm trying to do get all issues across all projects 
with 2 custom fields set at some specific value.
Here is my code. 
(btw I don't want to pass UserId and ProjectIds)

var projects = man.ProjectsService.GetProjects().ToList();
var projectIds = projects.Select(p => p.ProjectID.ToString()).Aggregate((m, n) => m + "|" + n);

var f = new IssuesFilterEN() {
    UserID = user.UserID,
    ProjectID = projectIds,
    CustomFields = new []{ 
                 new GenericEN { GenericKey ="SLA Active", GenericValue = "Activate"  },
                 new GenericEN { GenericKey ="SLA Status",  GenericValue = "Open"     }
               }
};

var issuesWithActiveSLA = man.IssuesService.GetFilteredIssues(f).ToList();
if (issuesWithActiveSLA.Count > 0) {
    Console.Out.WriteLine("aha got issues with SLA attributes!");
}

-----

Unhandled Exception: CounterSoft.Gemini.Commons.Rest.GeminiRestException: Exception has been thrown by the target of an invocation.
Input string was not in a correct format.
   at CounterSoft.Gemini.WebServices.BaseService.ThrowResponseException(WebResponse response) in ....\CounterSoft.Gemini.WebServices\BaseService.cs:line 189
   at CounterSoft.Gemini.WebServices.BaseService.ProcessResponse[T](String url, Object obj, RequestType requestType) in ....\CounterSoft.Gemini.WebServices\BaseService.cs:line 332
   at CounterSoft.Gemini.WebServices.BaseService.GetResponse[T](String url, Object o, RequestType r) in ....\CounterSoft.Gemini.WebServices\BaseService.cs:line 115
   at CounterSoft.Gemini.WebServices.IssuesService.GetFilteredIssues(IssuesFilterEN filter) in ....\CounterSoft.Gemini.WebServices\IssuesService.cs:line 99
   at ConsoleApplication1.Program.Main(String[] args) in ..\GeminiSLAEscalationMonitor\FirstGettingStarted\Program.cs:line 115

can anyone help please?
User84450
· 1
User84450
Replies (4)
helpful
0
not helpful

Can you please check the Gemini's system log for errors?


Mark Wing
· 9108
Mark Wing
helpful
0
not helpful

Input string was not in a correct format. 
 at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
 at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
 at CounterSoft.Gemini.DataProvider.xc0186e148e957052.x5ca7c882fdb86cb2(ICriteria& x055ea2922b1f58f0, IssuesFilterEN xb0f684c47236959a, List1 x858fc38c4382ab28, UserEN xfd92dbe2fa4bcb5a, String[] x812039d7b4c5fde8)
 at CounterSoft.Gemini.DataProvider.xc0186e148e957052.GetFilteredIssuesID(IssuesFilterEN ifeFilter, Int32[] closedStatus, UserEN user, List1 customFields)
 at CounterSoft.Gemini.Business.x95da312ae9372c2e.GetFilteredIssuesID(IssuesFilterEN ifeFilter, List`1 allCustomFields, UserEN user)
 at CounterSoft.Gemini.Business.x95da312ae9372c2e.x3ea65f25dee0cd51(IssuesFilterEN x24b748b5be295dcb, UserEN xfd92dbe2fa4bcb5a)
 at CounterSoft.Gemini.Presenter.IssuePresenter.GetFilteredIssues(IssuesFilterEN filter)
 at CounterSoft.Gemini.Web.Api.IssuesRestHandler.IssueFilter(RequestDetails rd)

Exception has been thrown by the target of an invocation. at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at CounterSoft.Gemini.Web.Api.RestHandler.GetResponse(RequestDetails rd, MethodInfo method)

from gemini logs


User84450
· 1
User84450
helpful
0
not helpful
 var projects = man.ProjectsService.GetProjects().ToList();
var projectIds = projects.Select(p => p.ProjectID.ToString()).Aggregate((m, n) => m + "|" + n);

var f = new IssuesFilterEN() {
    UserID = user.UserID,
    ProjectID = projectIds,
    CustomFields = new []{ 
                 new GenericEN { GenericKey ="4", GenericValue = "Activate"  },
                 new GenericEN { GenericKey ="5",  GenericValue = "Open"     }
               }
};

var issuesWithActiveSLA = man.IssuesService.GetFilteredIssues(f).ToList();
if (issuesWithActiveSLA.Count > 0) {
    Console.Out.WriteLine("aha got issues with SLA attributes!");
}

-----
I had to put the ID of the Custom Fields instead of the Field Name.
That solved the exception. Would have been nicer if I could simply pass the Name of the field though. 

User84450
· 1
User84450
helpful
0
not helpful

Thanks for the update. Glad all is well now.


Mark Wing
· 9108
Mark Wing