Accessing Page Filters on a Web Service.

baqfishbaqfish Member Posts: 2
edited 2014-02-20 in NAV Three Tier
Hello everyone,

at the moment I'm trying to call the Service Task page and have the ressource filter set on "THORSTEN".
What works perfectly fine for normal fields, i.e. Document Type will not work for the ressource filter.

Below you'll find the code which results in the following error:
Id 0 was not found in Service Item Line object!

If I remove the filter the program runs just fine, but obviously without any filter.
Any help would be greatly appreciated.

Thanks
BaqFish
static void Main(string[] args)
        {
            ServiceTask_Service service = new ServiceTask_Service();
            service.UseDefaultCredentials = true;

            ServiceTask task = new ServiceTask();
            
            List<ServiceTask_Filter> filterArray = new List<ServiceTask_Filter>();
            ServiceTask_Filter nameFilter = new ServiceTask_Filter();

            nameFilter.Field = ServiceTask_Fields.ResourceFilter;
            nameFilter.Criteria = "THORSTEN";
            filterArray.Add(nameFilter);
            
            Msg("List before modification");
            PrintServiceTaskList(service, filterArray);

            Msg("Press [ENTER] to exit program!");
            Console.ReadLine();
        }

        static void PrintServiceTaskList(ServiceTask_Service service, List<ServiceTask_Filter> filter)
        {
            ServiceTask[] list = service.ReadMultiple(filter.ToArray(), null, 0);
            foreach (ServiceTask s in list)
            {
                PrintServiceTask(s);
            }
        }

        static void PrintServiceTask(ServiceTask s)
        {
            Console.WriteLine("Reagieren bis: {0} {1} Priorität: {2} Belegart: {3} Belegnr.: {4}", s.Response_Date, s.Response_Time, s.Priority, s.Document_Type, s.Document_No);
        }

        static void Msg(string msg)
        {
            Console.WriteLine(msg);
        }
Sign In or Register to comment.