Retrieves a list of service call summmary objects that match the specified criteria.
Parameter |
Type |
Description |
---|---|---|
criteria |
A service call criteria object that specifies which service call summary objects are returned. |
|
context |
Specifies information about how the method will be called. |
Value |
Type |
Description |
---|---|---|
GetServiceCallListResult |
The list of service call summary objects that match the specified criteria. |
The following C# example retrieves the list of service call summary objects with a technician Id property of “T0102”. The technician Id and customer name properties from each service call summary object is displayed in a message box.
Legacy endpoint
using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using DynamicsGPWebServiceSample.DynamicsGPService; namespace DynamicsGPWebServiceSample { class Program { static void Main(string[] args) { CompanyKey companyKey; Context context; LikeRestrictionOfString technicianId; ServiceCallCriteria serviceCallCriteria; ServiceCallSummary[] serviceCallSummary; // Create an instance of the service DynamicsGP wsDynamicsGP = new DynamicsGP(); // Be sure the default credentials are used wsDynamicsGP.UseDefaultCredentials = true; // Create a context with which to call the service context = new Context(); // Specify which company to use (sample company) companyKey = new CompanyKey(); companyKey.Id = (-1); // Set up the context object context.OrganizationKey = (OrganizationKey)companyKey; // Create a restriction object // Retrieve service call summaries with the technician Id 'T0102' technicianId = new LikeRestrictionOfString(); technicianId.EqualValue = "T0102"; // Create a service call criteria object // Retrieve service call summaries for the specified technician Id serviceCallCriteria = new ServiceCallCriteria(); serviceCallCriteria.TechnicianId = technicianId; // Retrieve the service call summaries specified by the criteria object serviceCallSummary = wsDynamicsGP.GetServiceCallList(serviceCallCriteria, context); // Display the technician Id and customer name of each member of the object list StringBuilder summaryList = new StringBuilder(); foreach (ServiceCallSummary a in serviceCallSummary) { summaryList.AppendLine("Technician: " + a.TechnicianKey.Id + " Customer: " + a.CustomerName); } MessageBox.Show(summaryList.ToString()); } } }
Native endpoint
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using DynamicsGPWebServiceSample.DynamicsGPService; namespace DynamicsGPWebServiceSample { class Program { static void Main(string[] args) { CompanyKey companyKey; Context context; LikeRestrictionOfstring technicianId; ServiceCallCriteria serviceCallCriteria; ServiceCallSummary[] serviceCallSummary; // Create an instance of the service DynamicsGPClient wsDynamicsGP = new DynamicsGPClient(); // Create a context with which to call the service context = new Context(); // Specify which company to use (sample company) companyKey = new CompanyKey(); companyKey.Id = (-1); // Set up the context object context.OrganizationKey = (OrganizationKey)companyKey; // Create a restriction object // Retrieve service call summaries with the technician Id 'T0102' technicianId = new LikeRestrictionOfstring(); technicianId.EqualValue = "T0102"; // Create a service call criteria object // Retrieve service call summaries for the specified technician Id serviceCallCriteria = new ServiceCallCriteria(); serviceCallCriteria.TechnicianId = technicianId; // Retrieve the service call summaries specified by the criteria object serviceCallSummary = wsDynamicsGP.GetServiceCallList(serviceCallCriteria, context); // Display the technician Id and customer name of each member of the object list StringBuilder summaryList = new StringBuilder(); foreach (ServiceCallSummary a in serviceCallSummary) { summaryList.AppendLine("Technician: " + a.TechnicianKey.Id + " Customer: " + a.CustomerName); } MessageBox.Show(summaryList.ToString()); // Close the service if(wsDynamicsGP.State != CommunicationState.Faulted) { wsDynamicsGP.Close(); } } } }