![]() Human Capital Management Apex API Developer Reference
|
vanahcm.CandidateServiceglobal with sharing class CandidateService Represents a Candidate service structure Methods
getByNameglobal static List<vanahcm.CommonService.Candidate> getByName(Set<String> names, Map<Schema.SObjectType, Set<Schema.SObjectField>> customFields) Get candidate with related education and work experience records based on candidate name Input Parameters
Return ValueList of Candidate 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. Set<String> names = new Set<String>(); //Add Name of vanahcm__Candidate__c to names names.add('foo bar'); Map<Schema.SObjectType, Set<Schema.SObjectField>> customFields = new Map<Schema.SObjectType, Set<Schema.SObjectField>>{ vanahcm__Candidate__c.SObjectType => new Set<Schema.SObjectField>{vanahcm__Candidate__c.vanahcm__Resume__c}, vanahcm__Candidate_Education__c.SObjectType => new Set<Schema.SObjectField>{vanahcm__Candidate_Education__c.CreatedById}, vanahcm__Candidate_Work_Experience__c.SObjectType => new Set<Schema.SObjectField>{vanahcm__Candidate_Work_Experience__c.vanahcm__Responsibilities__c}}; List<vanahcm.CommonService.Candidate> candidates = vanahcm.CandidateService.getByName(names, customFields); getByEmailglobal static List<vanahcm.CommonService.Candidate> getByEmail(Set<String> emails, Map<Schema.SObjectType, Set<Schema.SObjectField>> customFields) Get Candidate with related Education and Work Experience records based on candidate email Input Parameters
Return ValueList of Candidate 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. Set<String> emails = new Set<String>(); //Add Email of vanahcm__Candidate__c to emails emails.add('foo@bar.com'); Map<Schema.SObjectType, Set<Schema.SObjectField>> customFields = new Map<Schema.SObjectType, Set<Schema.SObjectField>>{ vanahcm__Candidate__c.SObjectType => new Set<Schema.SObjectField>{vanahcm__Candidate__c.vanahcm__Resume__c}, vanahcm__Candidate_Education__c.SObjectType => new Set<Schema.SObjectField>{vanahcm__Candidate_Education__c.CreatedById}, vanahcm__Candidate_Work_Experience__c.SObjectType => new Set<Schema.SObjectField>{vanahcm__Candidate_Work_Experience__c.vanahcm__Responsibilities__c}}; List<vanahcm.CommonService.Candidate> candidates = vanahcm.CandidateService.getByEmail(emails, customFields); getByIdglobal static List<vanahcm.CommonService.Candidate> getById(Set<ID> ids, Map<Schema.SObjectType, Set<Schema.SObjectField>> customFields) Get candidate with related education and work experience records based on candidate ID Input Parameters
Return ValueList of Candidate 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. Set<ID> candidateIds = new Set<ID>(); candidateIds.add('a0nj000000KcOqN'); Map<Schema.SObjectType, Set<Schema.SObjectField>> customFields = new Map<Schema.SObjectType, Set<Schema.SObjectField>>{ vanahcm__Candidate__c.SObjectType => new Set<Schema.SObjectField>{vanahcm__Candidate__c.vanahcm__Resume__c}, vanahcm__Candidate_Education__c.SObjectType => new Set<Schema.SObjectField>{vanahcm__Candidate_Education__c.CreatedById}, vanahcm__Candidate_Work_Experience__c.SObjectType => new Set<Schema.SObjectField>{vanahcm__Candidate_Work_Experience__c.vanahcm__Responsibilities__c}}; List<vanahcm.CommonService.Candidate> candidates = vanahcm.CandidateService.getById(candidateIds, customFields); createglobal static List<vanahcm.CandidateService.Result> create(List<vanahcm.CommonService.Candidate> candidates) Insert Candidates with related Education and Work Experience Input Parameters
Return ValueList of Result 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.Candidate candidate = new vanahcm.CommonService.Candidate(); candidate.FirstName = 'foo'; candidate.LastName = 'bar'; List<vanahcm.CommonService.Candidate> candidates = new List<vanahcm.CommonService.Candidate>(); candidates.add(candidate); List<vanahcm.CandidateService.Result> results = vanahcm.CandidateService.create(candidates); //Add an Attachment to candidate record Attachment resume = new Attachment(); resume.ParentId = results[0].RecordId; resume.Body = Blob.valueOf('attachment body'); resume.Name = 'foobar.txt'; insert resume; //Add a Note to candidate record Note callLog = new Note(); callLog.ParentId = results[0].RecordId; callLog.Title = 'Final HR Discussion'; callLog.Body = 'candidate approved for hiring'; insert callLog; modifyglobal static List<vanahcm.CandidateService.Result> modify(List<vanahcm.CommonService.Candidate> candidates) Insert or update candidates with related Education and Work Experience Input Parameters
Return ValueList of Result 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.Candidate candidate = new vanahcm.CommonService.Candidate(); candidate.Id = 'a20xs00230234sde'; candidate.FirstName = 'foo'; candidate.LastName = 'bar'; List<vanahcm.CommonService.Candidate> candidates = new List<vanahcm.CommonService.Candidate>(); candidates.add(candidate); List<vanahcm.CandidateService.Result> results = vanahcm.CandidateService.modify(candidates); createFromResumeglobal static vanahcm.CandidateService.Result createFromResume(String fileName, String fileBody, String ownerId) Insert candidates with related Education and Work Experience from Resume Input Parameters
Return ValueResult 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. String fileBody = EncodingUtil.base64Encode(Blob.valueOf('Name: FirstName LastName Email: foo@bar.com'));; String fileName = 'test.txt'; String ownerId = UserInfo.getUserId(); vanahcm.CandidateService.Result results = vanahcm.CandidateService.createFromResume(fileName, fileBody, ownerId); vanahcm.CandidateService.Resultglobal with sharing class Result Represents a Result Properties
|