Human Capital Management API Developer Reference

vanahcm.NewHireService

global with sharing class NewHireService

Represents a new hire wizard service structure

Methods

create

global static List<ID> create(List<vanahcm.CommonService.NewHire> newHires)

Insert New Hires

Input Parameters

Name Type Description
newHires List<vanahcm.CommonService.NewHire> New hire records that need to be inserted

Return Value

List of ID

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

vanahcm.CommonService.NewHire NewHire = new vanahcm.CommonService.NewHire();
CommonService.Worker worker = new CommonService.Worker();
worker.FirstName = 'FIRSTNAME';
worker.LastName = 'LASTNAME';
worker.Middle = 'MIDDLENAME';
worker.PersonalEmail = 'personalemail@mailinator.com';
worker.FLSAStatus = 'Exempt';
newHire.Worker = worker;

CommonService.Phone phone = new CommonService.Phone();
phone.PhoneType = 'Home';
phone.PhoneNumber = '999-999-9999';
newHire.Worker.Phone = phone;

CommonService.WorkAssignment workAssignment = new CommonService.WorkAssignment();
workAssignment.WorkerType = 'Employee';
workAssignment.WorkerEvent = 'a4615000000SFDlAAO';
workAssignment.AssignmentIndicator = 'Primary';
workAssignment.BusinessTitle = 'Software Engineer';
newHire.Worker.WorkAssignment = workAssignment;

CommonService.Compensation compensation = new CommonService.Compensation();
compensation.CompensationEvent = 'a1M1500000JHj9HEAT';
compensation.CompensationPlan = 'a1R1500000ePpV7EAK';
compensation.CompensationGrade = 'a1P15000003N14AEAS';
compensation.PayGroup = 'a2v15000000IGktAAG';
compensation.CompensationRate = 0.9;
newHire.Worker.Compensation = compensation;

CommonService.NationalID nationalId = new CommonService.NationalID();
nationalId.CountryCode = 'a1c15000000fHMDAA2';
nationalId.NationalIDType = 'a2d15000000HrAAAA0';
nationalId.NationalID = '999-9999-999';
newHire.Worker.NationalID = nationalId;

CommonService.Address address = new CommonService.Address();
address.CountryCode = 'a1c15000000fHMDAA2';
address.AddressType  = 'Home';
address.AddressLine1 = '24 MARK STREET';
address.CityTown = 'NEW YORK';
newHire.Worker.Address = address;

CommonService.EquityPlan equityPlan = new CommonService.EquityPlan();
equityPlan.GrantReason = 'New Hire';
equityPlan.EquityType = 'a201500000GOV15AAH';
equityPlan.Amount = 200;
equityPlan.VestingSchedule = '2';
newHire.Worker.EquityPlan = equityPlan;

List<vanahcm.CommonService.NewHire> NewHires = new List<vanahcm.CommonService.NewHire>();
NewHires.add(NewHire);

List<ID> results = vanahcm.NewHireService.create(NewHires);