Description
This method creates test information for a specified applicant.
Parameters
Parameter |
Type |
Description |
|---|---|---|
businessObject |
The applicant test 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
- Human Resources/Payroll
Examples
The following C# example creates a new applicant test entry for an applicant. The ApplicantSequenceKey property of the ApplicantTestKey object specifies the applicant. The Id property of the TestKey specifies "TEST1" to specify the test object.
** 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;
ApplicantTest applicantTest;
ApplicantKey applicantKey;
ApplicantTestKey applicantTestlKey;
ApplicantSequenceKey applicantSequenceKey;
TestKey testKey;
Policy applicantTestCreatePolicy;
// 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 an applicant key
applicantKey = new ApplicantKey();
applicantKey.Id = 1;
// Create an applicant sequence key object
applicantSequenceKey = new ApplicantSequenceKey();
applicantSequenceKey.ApplicantKey = applicantKey;
// Create a test key
testKey = new TestKey();
testKey.Id = "TEST1";
// Create an applicant test key
applicantTestlKey = new ApplicantTestKey();
applicantTestlKey.ApplicantSequenceKey = applicantSequenceKey;
applicantTestlKey.TestKey = testKey;
// Create an applicant test object
applicantTest = new ApplicantTest();
// Populate the fields of the applicant test object
applicantTest.ApplicantTestKey = applicantTestlKey;
applicantTest.Notes = "Created applicant test object";
// Get the create policy for application test objects
applicantTestCreatePolicy = wsDynamicsGP.GetPolicyByOperation(
"CreateApplicantTest", context);
// Create the applicant test record
wsDynamicsGP.CreateApplicantTest(applicantTest,
context, applicantTestCreatePolicy);
}
}
}
** 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;
ApplicantTest applicantTest;
ApplicantKey applicantKey;
ApplicantTestKey applicantTestlKey;
ApplicantSequenceKey applicantSequenceKey;
TestKey testKey;
Policy applicantTestCreatePolicy;
// 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 an applicant key
applicantKey = new ApplicantKey();
applicantKey.Id = 1;
// Create an applicant sequence key object
applicantSequenceKey = new ApplicantSequenceKey();
applicantSequenceKey.ApplicantKey = applicantKey;
// Create a test key
testKey = new TestKey();
testKey.Id = "TEST1";
// Create an applicant test key
applicantTestlKey = new ApplicantTestKey();
applicantTestlKey.ApplicantSequenceKey = applicantSequenceKey;
applicantTestlKey.TestKey = testKey;
// Create an applicant test object
applicantTest = new ApplicantTest();
// Populate the fields of the applicant test object
applicantTest.ApplicantTestKey = applicantTestlKey;
applicantTest.Notes = "Created applicant test object";
// Get the create policy for application test objects
applicantTestCreatePolicy = wsDynamicsGP.GetPolicyByOperation(
"CreateApplicantTest", context);
// Create the applicant test record
wsDynamicsGP.CreateApplicantTest(applicantTest,
context, applicantTestCreatePolicy);
// Close the service
if(wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
}
}