|
|
To create time-based and condition-based PM Plans through this web service, you must first configure time-based and Condition-based PM Plan Templates.
|
|
Entry Point
|
Class
|
When to Use
|
|---|---|---|
|
SOAP Webservice
|
PREV_PMAutomation
|
External SOAP integrations, middleware, third-party systemscalling Salesforce via SOAP API
|
|
Global Apex API
|
PREV_PMAutomation_API
|
Internal Apex callers: Triggers, Batch Apex, Queueable,Flows, LWC Apex controllers
|
|
Method Name
|
Input Parameters
|
Output Parameters
|
|---|---|---|
|
CreatePMPlanFromAccount
|
PREV_PMAutomationRequest
|
PREV_PMAutomationResponse
|
|
CreatePMPlanFromLOC
|
PREV_PMAutomationRequest
|
PREV_PMAutomationResponse
|
|
CreatePMPlanFromSC
|
PREV_PMAutomationRequest
|
PREV_PMAutomationResponse
|
|
CreatePMPlanFromIB
|
PREV_PMAutomationRequest
|
PREV_PMAutomationResponse
|
global class PREV_PMAutomationKeyValue{
webservice String key {get;set;}
webservice String value {get;set;
}
global sharing class PREV_PMAutomationRequest
{
webservice list<Strings> pmPlanIdList{get;set;}
webservice String planType{get;set;}
webservice List<SVMXC.PREV_PMAutomation.PREV_PMAutomationKeyValue> additionalParams {get; set;}
}
global class PREV_PMAutomationResponse
{
webservice Boolean success{get;set;}
webservice String message{get;set;}
webservice String messageType{get;set;}
webservice list<PREV_PMAutomationResult> results{get;set;}
}
Global Class PREV_PMAutomationResult
{
webservice String pmPlanId {get;set;}
webservice String errorMessage {get;set;}
webservice Boolean success{get;set;}
}
global class PREV_PMAutomationKeyValue{
global String key {get;set;}
global String value {get;set;
}
global class PREV_PMAutomationRequest
{
global list<Strings> pmPlanIdList{get;set;}
global String planType{get;set;}
global List<SVMXC.PREV_PMAutomation.PREV_PMAutomationKeyValue> additionalParams {get; set;}
}
global class PREV_PMAutomationResponse
{
global Boolean success{get;set;}
global String message{get;set;}
global String messageType{get;set;}
global list<PREV_PMAutomationResult> results{get;set;}
}
Global Class PREV_PMAutomationResult
{
global String pmPlanId {get;set;}
global String errorMessage {get;set;}
global Boolean success{get;set;}
}
|
|
It is optional to specify request.planType = 'TIME' parameter for the time-based PM Plan.
|
SVMXC.PREV_PMAutomation.PREV_PMAutomationRequest request = new SVMXC.PREV_PMAutomation.PREV_PMAutomationRequest();
request.pmPlanIdList = new List<String>{'PM Plan SF Id'};
request.planType = 'TIME';
SVMXC.PREV_PMAutomation.createPMPlanFromAccount(request);
//SVMXC.PREV_PMAutomation.createPMPlanFromLOC(request);
//SVMXC.PREV_PMAutomation.createPMPlanFromSC(request);
//SVMXC.PREV_PMAutomation.createPMPlanFromIB(request);
|
|
when the flag, request.planType = 'CONDITION' is not provided, the service preserves the existing time-based behavior.
|
SVMXC.PREV_PMAutomation.PREV_PMAutomationRequest request = new SVMXC.PREV_PMAutomation.PREV_PMAutomationRequest();
request.pmPlanIdList = new List<String>{'PM Plan SF Id'};
request.planType = 'CONDITION';
SVMXC.PREV_PMAutomation.createPMPlanFromAccount(request);
//SVMXC.PREV_PMAutomation.createPMPlanFromLOC(request);
//SVMXC.PREV_PMAutomation.createPMPlanFromSC(request);
//SVMXC.PREV_PMAutomation.createPMPlanFromIB(request);
|
|
It is optional to specify request.planType = 'TIME' parameter for the time-based PM Plan.
|
SVMXC.PREV_PMAutomation_API.PREV_PMAutomation_APIRequest request = new SVMXC.PREV_PMAutomation_API.PREV_PMAutomation_APIRequest();
request.pmPlanIdList = new List<String>{'PM Plan SF Id'};
request.planType = 'TIME';
SVMXC.PREV_PMAutomation_API.createPMPlanFromAccount(request);
//SVMXC.PREV_PMAutomation_API.createPMPlanFromLOC(request);
//SVMXC.PREV_PMAutomation_API.createPMPlanFromSC(request);
//SVMXC.PREV_PMAutomation_API.createPMPlanFromIB(request);
|
|
when the flag, request.planType = 'CONDITION' is not provided, the service preserves the existing time-based behavior.
|
SVMXC.PREV_PMAutomation_API.PREV_PMAutomation_APIRequest request = new SVMXC.PREV_PMAutomation_API.PREV_PMAutomation_APIRequest();
request.pmPlanIdList = new List<String>{'PM Plan SF Id'};
request.planType = 'CONDITION';
SVMXC.PREV_PMAutomation_API.createPMPlanFromAccount(request);
//SVMXC.PREV_PMAutomation_API.createPMPlanFromLOC(request);
//SVMXC.PREV_PMAutomation_API.createPMPlanFromSC(request);
//SVMXC.PREV_PMAutomation_API.createPMPlanFromIB(request);
|
|
If your organization is offering PM Plans for Installed Based, then ensure that the IP records are created before generating PM Plans with them as coverages.
|
|
Best Practice
|
Description
|
|---|---|
|
Using the correct planType value
|
Always set planType to 'CONDITION' (case-sensitive) when processing condition-based plans.
When the flag, request.planType = 'CONDITION' is not provided, the service preserves the existing time-based behavior.
|
|
Validating IB mode prerequisites
|
Ensure that coverages already exist on the PM Plan before calling createPMPlanFromIB(). If no coverages exist, the plan is skipped.
|
|
Handling large volumes efficiently
|
Use Queueable or Batch Apex to split large plan ID sets across multiple transactions for better scalability.
|
|
Retrying safe processing
|
Rely on built-in behaviour where plans with existing schedules are skipped. Safely retry requests without risk of duplicate processing.
|
|
Checking activation settings
|
Verify the PREV001 > SET002 configuration before processing. If disabled, plans are processed but their status remains unchanged.
|
|
Using additionalParams appropriately
|
Consider additionalParams as a placeholder for future enhancements. Leave it null or omit it, as it has no effect in current functionality.
|
|
Avoiding mixed plan types
|
Do not include both time-based and condition-based plan IDs in a single request. Ensure all plan IDs match the specified planType to prevent individual rejections.
|