pse.VersionServiceglobal with sharing class VersionService Service to create a version of a project and its details. Methods
createAsyncglobal static List<Id> createAsync(List<pse.VersionService.Version> versions) Creates versions of projects using the version instances provided. The call creates the Version records synchronously. Then one asynchronous batch process starts for each version in the request and copies the child records for that version. Input Parameters
Return ValueThis service returns the newly created version IDs. 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. Id projectId = Id.valueOf('a1Q1a0000006VJ4');// A valid pse__Proj__c record Id to take Version of. //Version setup. pse.VersionService.Version dto = new pse.VersionService.Version(); dto.ProjectId = projectId; dto.VersionName = 'Demo Version name'; dto.Notes = 'Demo notes.'; dto.Baseline = true; List<pse.VersionService.Version> versions = new List<pse.VersionService.Version> { dto }; //Call API List<Id> versionIds = pse.VersionService.createAsync(versions); deleteAsyncglobal static void deleteAsync(List<Id> versionIds) Removes project versions and all project version child records. This method runs asynchronously, running batch processes to delete project version data. Project version statuses immediately update to Deleting and the records should not be subsequently used. Input Parameters
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. Id projectId = Id.valueOf('a1Q1a0000006VJ4');// A valid pse__Proj__c record Id we are working with. //Find the oldest non-baseline version of this project. List<pse__Version__c> versions = [SELECT Id FROM pse__Version__c WHERE pse__Baseline__c = false AND pse__Project__c =: projectId ORDER BY CreatedDate LIMIT 1]; Id oldestVersionId = versions[0].Id; List<Id> versionIdsToDelete = new List<Id> { oldestVersionId }; //Call API List<Id> versionIds = pse.VersionService.deleteAsync(versionIdsToDelete); pse.VersionService.Versionglobal inherited sharing class Version This class is used to define how a project version can be created. Properties
|