Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Description
This method creates a new service call document.
Parameters
Parameter |
Type |
Description |
|---|---|---|
serviceCall |
The service call object being created. |
|
context |
Specifies information about how the method will be called. |
|
policy |
Specifies the set of behaviors and behavior options to be applied during the operation. |
Interfaces
- Dynamics GP
- Field Service
Examples
The following C# example creates a service call document with the key value "SCTEST00100". The required Key, CustomerKey, and ShipToAddressKey properties are populated. All other properties use default values.
** Legacy endpoint**
using System;
using System.Collections.Generic;
using System.Text;
using DynamicsGPWebServiceSample.DynamicsGPService;
namespace DynamicsGPWebServiceSample
{
class Program
{
static void Main(string[] args)
{
CompanyKey companyKey;
Context context;
ServiceCall serviceCall;
ServiceDocumentKey serviceDocKey;
CustomerKey customerKey;
ShipToAddressKey shipToAddressKey;
Policy serviceCallCreatePolicy;
// 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 service call object
serviceCall = new ServiceCall();
// Create a service document key object
// Populate the Id property with a value that uniquely identifies the document
serviceDocKey = new ServiceDocumentKey();
serviceDocKey.Id = "SCTEST00100";
// Populate the service call object's Key propety with the service document key
serviceCall.Key = serviceDocKey;
// Create a customer key
// Populate the Id property to specify the customer
customerKey = new CustomerKey();
customerKey.Id = "AARONFIT0001";
// Populate the service call object's CustomerKey property with the customer key object
serviceCall.CustomerKey = customerKey;
// Create a ship to address key object
// Populate the Id property to specify the customer address information
shipToAddressKey = new ShipToAddressKey();
shipToAddressKey.Id = "PRIMARY";
// Populate the service call object's ShipToAddressKey property with the ship to address
// key object
serviceCall.ShipToAddressKey = shipToAddressKey;
// Get the create policy for service calls
serviceCallCreatePolicy = wsDynamicsGP.GetPolicyByOperation("CreateServiceCall", context);
// Create the service equipment document
wsDynamicsGP.CreateServiceCall(serviceCall, context, serviceCallCreatePolicy);
}
}
}
** Native endpoint **
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using DynamicsGPWebServiceSample.DynamicsGPService;
namespace DynamicsGPWebServiceSample
{
class Program
{
static void Main(string[] args)
{
CompanyKey companyKey;
Context context;
ServiceCall serviceCall;
ServiceDocumentKey serviceDocKey;
CustomerKey customerKey;
ShipToAddressKey shipToAddressKey;
Policy serviceCallCreatePolicy;
// 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 service call object
serviceCall = new ServiceCall();
// Create a service document key object
// Populate the Id property with a value that uniquely identifies the document
serviceDocKey = new ServiceDocumentKey();
serviceDocKey.Id = "SCTEST00100";
// Populate the service call object's Key propety with the service document key
serviceCall.Key = serviceDocKey;
// Create a customer key
// Populate the Id property to specify the customer
customerKey = new CustomerKey();
customerKey.Id = "AARONFIT0001";
// Populate the service call object's CustomerKey property with the customer key object
serviceCall.CustomerKey = customerKey;
// Create a ship to address key object
// Populate the Id property to specify the customer address information
shipToAddressKey = new ShipToAddressKey();
shipToAddressKey.Id = "PRIMARY";
// Populate the service call object's ShipToAddressKey property with the ship to address
// key object
serviceCall.ShipToAddressKey = shipToAddressKey;
// Get the create policy for service calls
serviceCallCreatePolicy = wsDynamicsGP.GetPolicyByOperation("CreateServiceCall", context);
// Create the service equipment document
wsDynamicsGP.CreateServiceCall(serviceCall, context, serviceCallCreatePolicy);
// Close the service
if(wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
}
}