Share via


GetApplicantWorkHistoryList

Description

Retrieves a list of applicant work history objects that match the specified criteria.

Parameters

Parameter

Type

Description

criteria

ApplicantWorkHistoryCriteria

The applicant work history criteria object that specifies which applicant work history objects are returned.

context

Context

Specifies information about how the method will be called.

Return Value:

Value

Type

Description

GetApplicantWorkHistoryListResult

ArrayOfApplicantWorkHistory

The list of applicant test objects that match the specified criteria.

Interfaces

  • Dynamics GP
  • Human Resources/Payroll

Examples

The following C# example retrieves the list of applicant work history objects where the employer value is "Previous employer". The number of applicant work history objects that match the criteria is displayed in a message box.

Ff622648.LegacyEndpoint(en-us,MSDN.10).gif** 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;
            ApplicantWorkHistory[] applicantWorkHistory;
            ApplicantWorkHistoryCriteria applicantWorkHistoryCriteria;
            LikeRestrictionOfString employerRestriction;

            // 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;

            // Specify the criteria of the applicant work history objects to retrieve
            employerRestriction = new LikeRestrictionOfString();
            employerRestriction.EqualValue = "Previous employer";
            applicantWorkHistoryCriteria = new ApplicantWorkHistoryCriteria();
            applicantWorkHistoryCriteria.Employer = employerRestriction;

            // Retrieve the list of applicant work history objects
            applicantWorkHistory = wsDynamicsGP.GetApplicantWorkHistoryList(applicantWorkHistoryCriteria, context);

            // Display the number of applicant work history objects that match the criteria
            MessageBox.Show("The number of applicants from the specified employer: " +
                applicantWorkHistory.Length.ToString());
        }
    }
}

Ff622648.NativeEndpoint(en-us,MSDN.10).gif** Native endpoint **

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Windows.Forms;
using DynamicsGPWebServiceSample.DynamicsGPService;

namespace DynamicsGPWebServiceSample
{
    class Program
    {
        static void Main(string[] args)
        {
            CompanyKey companyKey;
            Context context;
            ApplicantWorkHistory[] applicantWorkHistory;
            ApplicantWorkHistoryCriteria applicantWorkHistoryCriteria;
            LikeRestrictionOfstring employerRestriction;

            // 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;

            // Specify the criteria of the applicant work history objects to retrieve
            employerRestriction = new LikeRestrictionOfstring();
            employerRestriction.EqualValue = "Previous employer";
            applicantWorkHistoryCriteria = new ApplicantWorkHistoryCriteria();
            applicantWorkHistoryCriteria.Employer = employerRestriction;

            // Retrieve the list of applicant work history objects
            applicantWorkHistory = wsDynamicsGP.GetApplicantWorkHistoryList(applicantWorkHistoryCriteria, context);

            // Display the number of applicant work history objects that match the criteria
            MessageBox.Show("The number of applicants from the specified employer: " +
                applicantWorkHistory.Length.ToString());

            // Close the service
            if(wsDynamicsGP.State != CommunicationState.Faulted)
            {
                wsDynamicsGP.Close();
            }
        }
    }
}