You are here:
Extend the Spot Calendar
Learn how to extend the spot calendar for Advertising Sales Management in Media Cloud.
You can extend the spot calendar in the following ways:
Create an Interface Implementation for the Spot Calendar
You can extend the spot calendar by creating your own Interface Implementation.
This is an Advertising Sales Management on Managed Package feature. For Advertising Sales
Management on Salesforce Platform, see Advertising
Sales Management on Salesforce Platform.
- In the App Launcher, search for and click Interface Implementations.
- Search for and open SfiAdsRadioService.
- Under Related, deactivate the current Interface Implementation Detail.
- Click New.
- Specify the appropriate custom class under Available Implementation, and select Active and Default.
- Click Save.
The spot calendar in your org now defaults to the Interface Implementation you'd created. All transactions related to the Spot Calendar (including auto-populate, spot update, and spot delete) are routed through the custom class you've created, and all CRUD operations are handled in the custom class.
Modify the Default Interface Implementation for the Spot Calendar
If you want to override certain transactions, or modify the fields before out-of-the-box transactions of your spot calendar, call the default implementations from your custom class.
This is an Advertising Sales Management on Managed Package feature. For Advertising Sales
Management on Salesforce Platform, see Advertising
Sales Management on Salesforce Platform.
Out-of-the-box, SfiAdsRadioService uses the DefaultRadioServiceImpl custom class. The details of the DefaultRadioServiceImpl custom class are as follows:
-
Class name: DefaultRadioServiceImpl
-
Method name: invokeMethod
-
Payload:
-
String methodName. The name of the transaction.
-
Map<String,Object> input. The input to your custom interface is already in the expected format.
-
Map<String,Object> output. The output from the Salesforce Platform is returned here.
-
Map<String,Object> options. This is optional. You can send an empty map.
-
Possible values for methodName include the following:
-
constructBroadcastCalendar. This method created the weekly broadcast calendar.
Expected input:
{ "startDate": <Start Date>, "endDate": <End Date>, "formatter":'d/MM/yyyy' }Expected Output:
{ "hasSuccess": <boolean>, "allWeeks": <list of weeks from core> } -
updateIndividualSpot. This method updates an individual spot record.
Expected input:
{ "AdQuoteLineUnitsSplit": { "Name": <name>, "StartDate": <startDate>, "EndDate": <endDate>, "AdQuoteLineId": <adQuoteLineId>, "Id": <id> } }Expected output:
{ "hasSuccess": <boolean>, "result": <response from core> } -
removeInvalidUnitsSplit. This method validates spot records against the Placement date range and removes the spots which are outside the specified date range.
Expected input:
{ "AdQuoteLineIdList": <List of AdQuoteLineId> }Expected output:
{ "hasSuccess": <boolean>, "result": <response from core> } -
splitQuantityDistribution. This method contains the logic for the auto distribution of spots.
Expected input:
{ "DistributionInputMap":[{ "SpotList": [{ "Name": <name>, "StartDate": <startDate>, "EndDate": <endDate>, "AdQuoteLineId": <adQuoteLineId>, "Id": <id> },{ "Name": <name>, "StartDate": <startDate>, "EndDate": <endDate>, "AdQuoteLineId": <adQuoteLineId>, "Id": <id> }], "AdRequestedQuanity": <Total split count> }] }Expected output:
{ "hasSuccess": <boolean>, "result": <response from core> } -
upsertBuildAdQuoteLineUnitsSplits. This Method creates bulk spots after the auto distribution logic is complete.
Expected input:
{ "AdQuoteLineUnitsSplits": [{ "Name": <name>, "StartDate": <startDate>, "EndDate": <endDate>, "AdQuoteLineId": <adQuoteLineId>, "Id": <id> },{ "Name": <name>, "StartDate": <startDate>, "EndDate": <endDate>, "AdQuoteLineId": <adQuoteLineId>, "Id": <id> }]Expected output:
{ "hasSuccess": <boolean>, "result": <response from core> }
The following is an example code for the custom implementation.
public class CustomSpotImpl implements VlocityOpenInterface, Callable
{
public Object call(String action, Map<String, Object> args)
{
Map<String,Object> inputMap = (Map<String,Object>)args.get('input');
Map<String,Object> outputMap = (Map<String,Object>)args.get('output');
Map<String,Object> options = (Map<String,Object>)args.get('options');
return invokeMethod(action, inputMap, outputMap, options);
}
public Boolean invokeMethod(String methodName, Map<String,Object> input, Map<String,Object> output, Map<String,Object> options)
{
if (methodName == 'updateIndividualSpot') {
//insert custom logic for this scenario
} else {
//calling OOTB for rest of the scenarios
DefaultRadioServiceImpl impl = new DefaultRadioServiceImpl();
impl.invokeMethod(methodName, input, output, options);
return true;
}
}
}