pse.ServicesDeliverableServiceglobal with sharing class ServicesDeliverableService This class contains methods to push services deliverables and their related records to projects for delivery. EnumsAllocationMode
Methods
addDeliverablesToProjectglobal static pse.ServicesDeliverableService.AddServicesDeliverableResponse addDeliverablesToProject(pse.ServicesDeliverableService.AddServicesDeliverableRequest request) A method which uses services deliverables as templates to push project deliverables with services credits pricing to projects. For each deliverable specified, a project deliverable will be created, as well as a project deliverable item for each active linked deliverable item. The milestones linked to the deliverable items will be duplicated on the target project, along with any linked tasks, project task dependencies, project task assignments, resource requests, resource skill requests, schedules, schedule exceptions, and risks. The date fields on these records will be shifted to account for the difference in start date between the source and target project. Input Parameters
Exceptions Thrown
Return ValueAddServicesDeliverableResponse Contains the response to adding services deliverables. 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.
//construct the request object
List<Id> deliverableIds = new List<Id>{
'a1r000000000001AAA',
'a1r000000000002AAA',
'a1r000000000003AAA'
};
pse.ServicesDeliverableService.AddServicesDeliverableRequest request = new pse.ServicesDeliverableService.AddServicesDeliverableRequest();
request.deliverableIds = deliverableIds;
request.projectId = 'a0r000000000001AAA';
request.allocationMode = pse.ServicesDeliverableService.AllocationMode.ALLOCATION_ALLOW_FAILURE;
//call the service
pse.ServicesDeliverableService.AddServicesDeliverableResponse response = pse.ServicesDeliverableService.addDeliverablesToProject(
request
);
//response if successful
pse.ServicesDeliverableService.AddDeliverableResult firstResult = response.results[0];
pse__Services_Deliverable_Instance__c firstDeliverableInstance = firstResult.deliverableInstance; // this will be populated
List<String> firstDeliverableErrorMessages = firstResult.errorMessages; // this will be empty
//response if there was an error
pse.ServicesDeliverableService.AddDeliverableResult secondResult = response.results[1];
pse__Services_Deliverable_Instance__c secondDeliverableInstance = secondResult.deliverableInstance; // this would be null
List<String> secondDeliverableErrorMessages = secondResult.errorMessages; // this will be populated
addMonetaryPricedDeliverablesToProjectglobal static pse.ServicesDeliverableService.AddMonetaryPricedDeliverableResponse addMonetaryPricedDeliverablesToProject(pse.ServicesDeliverableService.AddMonetaryPricedDeliverableRequest pricedDeliverableRequest) A method which uses services deliverables as templates to push project deliverables with monetary pricing to projects. For each deliverable specified, a project deliverable will be created, as well as a project deliverable item for each active linked deliverable item. The milestones linked to the deliverable items will be duplicated on the target project, along with any linked tasks, project task dependencies, project task assignments, resource requests, resource skill requests, schedules, schedule exceptions, and risks. The date fields on these records will be shifted to account for the difference in start date between the source and target project. Input Parameters
Exceptions Thrown
Return ValueAddMonetaryPricedDeliverableResponse Contains the response to adding services deliverables. 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.
//Create a list of inputs. Each input contains the ID of the deliverable to add and its corresponding price.
List<pse.ServicesDeliverableService.MonetaryPricedDeliverableInput> pricedDeliverables = new List<pse.ServicesDeliverableService.MonetaryPricedDeliverableInput>{
new pse.ServicesDeliverableService.MonetaryPricedDeliverableInput(
'a1r000000000001AAA',
42000.50
),
new pse.ServicesDeliverableService.MonetaryPricedDeliverableInput('a1r000000000002AAA', 6000),
new pse.ServicesDeliverableService.MonetaryPricedDeliverableInput(
'a1r000000000003AAA',
10450.45
)
};
Id destinationProjectId = 'a1r000000000001AAB';
//Create the request
pse.ServicesDeliverableService.AddMonetaryPricedDeliverableRequest request = new pse.ServicesDeliverableService.AddMonetaryPricedDeliverableRequest();
request.projectId = destinationProjectId;
request.monetaryPricedDeliverables = pricedDeliverables;
//Call the service
pse.ServicesDeliverableService.AddMonetaryPricedDeliverableResponse response = pse.ServicesDeliverableService
.addMonetaryPricedDeliverablesToProject(request);
//Response if the addition is successful
pse.ServicesDeliverableService.AddMonetaryPricedDeliverableResult firstResult = response.results[0];
pse__Services_Deliverable_Instance__c firstDeliverableInstance = firstResult.deliverableInstance; // This will be populated
List<String> firstDeliverableErrorMessages = firstResult.errorMessages; // This will be empty
//Response if there are errors during the addition
pse.ServicesDeliverableService.AddMonetaryPricedDeliverableResult secondResult = response.results[1];
pse__Services_Deliverable_Instance__c secondDeliverableInstance = secondResult.deliverableInstance; // This will be null
List<String> secondDeliverableErrorMessages = secondResult.errorMessages; // This will contain error messages indicating why this deliverable failed to be added
pse.ServicesDeliverableService.AddServicesDeliverableRequestglobal with sharing class AddServicesDeliverableRequest Contains the request to add services deliverables with services credits pricing to a project. Properties
MethodsAddServicesDeliverableRequestglobal AddServicesDeliverableRequest() pse.ServicesDeliverableService.AddServicesDeliverableResponseglobal with sharing class AddServicesDeliverableResponse Contains the response to adding services deliverables with services credits pricing. Properties
MethodsAddServicesDeliverableResponseglobal AddServicesDeliverableResponse() pse.ServicesDeliverableService.AddDeliverableResultglobal with sharing class AddDeliverableResult The result of an individual services deliverable in the process of adding deliverables with services credits pricing to a project. Properties
MethodsAddDeliverableResultglobal AddDeliverableResult() hasErrorsglobal Boolean hasErrors() Returns true if there were errors when attempting the addition. pse.ServicesDeliverableService.MonetaryPricedDeliverableInputglobal with sharing class MonetaryPricedDeliverableInput This class represents a services deliverable to be added to a project, along with its monetary price. Properties
MethodsMonetaryPricedDeliverableInputglobal MonetaryPricedDeliverableInput(Id deliverableId, Decimal price) pse.ServicesDeliverableService.AddMonetaryPricedDeliverableRequestglobal with sharing class AddMonetaryPricedDeliverableRequest Contains the request to add services deliverables with monetary pricing to a project. Properties
MethodsAddMonetaryPricedDeliverableRequestglobal AddMonetaryPricedDeliverableRequest() pse.ServicesDeliverableService.AddMonetaryPricedDeliverableResponseglobal with sharing class AddMonetaryPricedDeliverableResponse Contains the response to adding services deliverables with monetary pricing. Properties
MethodsAddMonetaryPricedDeliverableResponseglobal AddMonetaryPricedDeliverableResponse(List<pse.ServicesDeliverableService.AddMonetaryPricedDeliverableResult> results) pse.ServicesDeliverableService.AddMonetaryPricedDeliverableResultglobal with sharing class AddMonetaryPricedDeliverableResult The result of an individual services deliverable in the process of adding deliverables with monetary pricing to a project. Properties
MethodshasErrorsglobal Boolean hasErrors() Returns true if there were errors when attempting the addition. |