pse.VersionService
global with sharing class VersionService
Service to create a version of a project and its details.
Methods
createAsync
global 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
versions |
List<pse.VersionService.Version> |
List of configurations for creating new versions. Any versionID supplied in the configuration is ignored. |
Return Value
This service returns the newly created version IDs.
Sample Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | Id projectId = Id.valueOf( 'a1Q1a0000006VJ4' );
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 };
List<Id> versionIds = pse.VersionService.createAsync(versions);
|
deleteAsync
global 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
versionIds |
List<Id> |
The Id of the records to be deleted. |
Sample Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Id projectId = Id.valueOf( 'a1Q1a0000006VJ4' );
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 };
List<Id> versionIds = pse.VersionService.deleteAsync(versionIdsToDelete);
|
pse.VersionService.Version
global inherited sharing class Version
This class is used to define how a project version can be created.
Properties
ProjectId |
Id |
ID of the pse__proj__c record the version belongs to.
|
VersionName |
String |
Name of the version.
|
Notes |
String |
Notes to associate with the version.
|
Baseline |
Boolean |
Set the version as a baseline.
|
|