Human Capital Management Apex API Developer Reference

vanahcm.LearningTypeService

global with sharing class LearningTypeService

Represents a learning type service structure

Methods

getByName

global static List<vanahcm.CommonService.LearningType> getByName(Set<String> names, Map<Schema.SObjectType, Set<Schema.SObjectField>> customFields)

Get Learning types with related learning catalog records based on learning type name

Input Parameters

Name Type Description
names Set<String> Name of learning type records that need to be returned
customFields Map<Schema.SObjectType, Set<Schema.SObjectField>> Collection of custom fields that need to be queried for learning type and learning catalog

Return Value

List of LearningType

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__LearningType__c to names
names.add('Learning Type1');

Map<Schema.SObjectType, Set<Schema.SObjectField>> customFields = new Map<Schema.SObjectType, Set<Schema.SObjectField>>{
    vanahcm__LearningType__c.SObjectType => new Set<Schema.SObjectField>{vanahcm__LearningType__c.vanahcm__LastModifiedById},
    vanahcm__Learning_Catalog__c.SObjectType => new Set<Schema.SObjectField>{vanahcm__Learning_Catalog__c.CreatedById}};

List<vanahcm.CommonService.LearningType> learningTypes = vanahcm.LearningTypeService.getByName(names, customFields);

getById

global static List<vanahcm.CommonService.LearningType> getById(Set<ID> ids, Map<Schema.SObjectType, Set<Schema.SObjectField>> customFields)

Get learning types with related learning catalog records based on learning type ID

Input Parameters

Name Type Description
ids Set<ID> ID of learning type records that need to be returned
customFields Map<Schema.SObjectType, Set<Schema.SObjectField>> Collection of custom fields that need to be queried for learning type and learning catalog

Return Value

List of LearningType

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> learningTypeIds = new Set<ID>();
learningTypeIds.add('a0nj000000KcOqN');

Map<Schema.SObjectType, Set<Schema.SObjectField>> customFields = new Map<Schema.SObjectType, Set<Schema.SObjectField>>{
    vanahcm__LearningType__c.SObjectType => new Set<Schema.SObjectField>{vanahcm__LearningType__c.LastModifiedById},
    vanahcm__Learning_Catalog__c.SObjectType => new Set<Schema.SObjectField>{vanahcm__Learning_Catalog__c.CreatedById}};

List<vanahcm.CommonService.LearningType> learningTypes = vanahcm.LearningTypeService.getById(learningTypeIds, customFields);

create

global static List<vanahcm.LearningTypeService.Result> create(List<vanahcm.CommonService.LearningType> learningTypes)

Insert learning type with related learning catalog

Input Parameters

Name Type Description
learningTypes List<vanahcm.CommonService.LearningType> Learning type records that need to be inserted

Return Value

List 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.LearningType learningType = new vanahcm.CommonService.LearningType();
learningType.Name = 'New Learning Type';
List<vanahcm.CommonService.LearningType> learningTypes = new List<vanahcm.CommonService.LearningType>();
learningTypes.add(learningType);

List<vanahcm.LearningTypeService.Result> results = vanahcm.LearningTypeService.create(learningTypes);

modify

global static List<vanahcm.LearningTypeService.Result> modify(List<vanahcm.CommonService.LearningType> learningTypes)

Insert or update learning type with related learning catalog

Input Parameters

Name Type Description
learningTypes List<vanahcm.CommonService.LearningType> Learning type records that need to be inserted or updated

Return Value

List 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.LearningType learningType = new vanahcm.CommonService.LearningType();
learningType.Id = 'a2P15000000iU1c';
learningType.Name = 'Updated Learning Type';

List<vanahcm.CommonService.LearningType> learningTypes = new List<vanahcm.CommonService.LearningType>();
learningTypes.add(learningType);

List<vanahcm.LearningTypeService.Result> results = vanahcm.LearningTypeService.modify(learningTypes);

vanahcm.LearningTypeService.Result

global with sharing class Result

Represents a Result

Properties

Name Type Description
RecordId ID Learning type ID
CatalogIds List<ID> List of ID of LearningType's Catalog records
© Copyright 2009–2017 FinancialForce.com, inc. Confidential – all rights reserved. Various trademarks held by their respective owners.