Loading
Salesforce now sends email only from verified domains. Read More
Media Cloud
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Set Up the Ad Availability Calendar

          Set Up the Ad Availability Calendar

          Complete the following steps to set up the Avails Calendar in your Advertising Sales Management org.

          Managed Package Icon This is an Advertising Sales Management on Managed Package feature. For Advertising Sales Management on Salesforce Platform, see Advertising Sales Management on Salesforce Platform.

          REQUIRED EDITIONS AND USER PERMISSIONS
          Available in: Lightning Experience
          Available in: all editions
          REQUIRED USER PERMISSIONS  
          To access Media Cloud advanced features MediaCloudPlus Runtime

          Enable Avails Calendar and Media Avails

          Before you can use the avails calendar, enable Media Avails and the Avails Calendar from Settings in your Advertising Sales Management org.

          Managed Package Icon This is an Advertising Sales Management on Managed Package feature. For Advertising Sales Management on Salesforce Platform, see Advertising Sales Management on Salesforce Platform.

          1. Go to Settings and then click Setup.
          2. In Quick Find, search for and select Profiles.
          3. Click Edit associated with the System Administrator profile.
          4. Under Tab Settings, select Default On for the following.

            Media Avails - Settings

            Avails Calendar

          5. Click Save, and refresh the page after your changes have been saved.

          Media Avails - Settings and Avails Calendar are now available from the App Launcher.

          Set Up the All Ad Availability View Configuration List

          Set up the list view to display the fields that you're most likely to want to view.

          Managed Package Icon This is an Advertising Sales Management on Managed Package feature. For Advertising Sales Management on Salesforce Platform, see Advertising Sales Management on Salesforce Platform.

          1. In App Launcher, search for and select Ad Availability View Configurations.
            Note
            Note Make sure that the developer name for the list is All_AdAvailabilityViewConfigs.
          2. Click the gear icon to open the list view controls, and then click Select Fields to Display.
          3. Select the following under Available Fields and move them to the Visible Fields column.
            • Configuration Key

            • Configuration Type

            • Configuration Value

            • Is Active

            • Pivot On

          4. Click Save.

          Verify the Edit Permission of Fields

          To set up the avails calendar, you must have field-level security on the Ad Availability Dimensions, Ad Digital Availability, Ad Linear Availability, Ad Availability Job, Ad Availability View Configuration, Ad Order Item, and Ad Server objects. You can use field-level security to enable and disable ‌‌read and edit access to fields.

          Managed Package Icon This is an Advertising Sales Management on Managed Package feature. For Advertising Sales Management on Salesforce Platform, see Advertising Sales Management on Salesforce Platform.

          Make sure that you have edit access to these fields:

          Object Name Fields
          Ad Availability Dimensions Product, Media Channel, Ad Order Item, Ad Quote Line, Ad Space Specification, Media Content Title, Job
          Ad Order Item Ad Server Proposal Line Status
          Ad Server AdServerCompany
          Ad Digital Availability All fields
          Ad Linear Availability All fields
          Ad Availability Job All fields
          Ad Availability View Configuration All fields

          Set Up Interface Implementation to Ensure that the Ad Server Responds

          To generate the data for valid products, you must update your interface implementation with a MockedResponseP2PService class. This class defines the entry point for P2P integrations and is the interface implementation for the seed P2PSvcCustomizer.

          Managed Package Icon This is an Advertising Sales Management on Managed Package feature. For Advertising Sales Management on Salesforce Platform, see Advertising Sales Management on Salesforce Platform.

          To use your implementation for P2P Service API processing, create an Apex class, add it to the interface implementation, and then activate the interface implementation.

          1. From the App Launcher, find and select Interface Implementations.
          2. To create an interface implementation, click New.
          3. Enter P2PSvcCustomizer for the interface name.
          4. Save your changes.
          5. From your Advertising Sales Management org, go to Settings, and click Developer Console.
          6. Create an implementation class that shows the mocked response for a fixed seven-day period.
            
            global class MockedResponseP2PService implements vlocity_cmt.VlocityOpenInterface{
            
              global Boolean invokeMethod(
              String action,
              Map<String, Object> input,
              Map<String, Object> output,
              Map<String, Object> options)
              {
                String availabilityType = (String)((Map<String,Object>)JSON.deserializeUntyped((String)input.get('payload'))).get('availabilityType');
                String servicePath = (String)input.get('servicePath');
                Map<String, Object> response;
                Map<String, Object> payload;
                System.debug('Mocked input for the HTTP call is TestAdServerMockResponse :'+ servicePath);
                System.debug('Mocked availtype for the HTTP call is TestAdServerMockResponse :'+ availabilityType);
                  
                if(servicePath.equalsIgnoreCase('/api/forecast/availability') &&  availabilityType ==  'ByProspectiveItem')
                {
                    System.debug('Mocked P2P is Invoked for avails ');
                  response = new Map<String, Object> {
                    'result' => 200 ,
                    'adServerInstanceId' => '22773096280',
                    'requestedBy' => 'autoproc@00dro0000009vcm2ay',
                    'requestId' => '468cb843-c88d-4679-5db5-4c704dd28030',
                    'minimalResults' => 20,
                    'detailResults' => new Map<String, Object>
                    {
                      'availableUnits' => 1,
                      'totalUnits' => 700000,
                      'deliveredUnits' => 600000,
                      'unitType' => 'IMPRESSIONS',
                      'reservedUnits' => 1,
                      'breakdownByTimeWindow' => new List<Object>
                      {
                          new Map<String, Object> {
                            'start' => '2023/11/01 00:00:00',
                            'end' => '2023/11/01 23:59:59',
                            'availableUnits' => 100,
                            'totalUnits' => 700
                          },
                          new Map<String, Object> {
                            'start' => '2023/11/02 00:00:00',
                            'end' => '2023/11/02 23:59:59',
                            'availableUnits' => 1000,
                            'totalUnits' => 10000
                          },          
                          new Map<String, Object> {
                            'start' => '2023/11/03 00:00:00',
                            'end' => '2023/11/03 23:59:59',
                            'availableUnits' => 3000,
                            'totalUnits' => 5000
                          },          
                          new Map<String, Object> {
                            'start' => '2023/11/04 00:00:00',
                            'end' => '2023/11/04 23:59:59',
                            'availableUnits' => 3000,
                            'totalUnits' => 5000
                          },          
                          new Map<String, Object> {
                            'start' => '2023/11/05 00:00:00',
                            'end' => '2023/11/05 23:59:59',
                            'availableUnits' => 3000,
                            'totalUnits' => 5000
                          },          
                          new Map<String, Object> {
                            'start' => '2023/11/06 00:00:00',
                            'end' => '2023/11/06 23:59:59',
                            'availableUnits' => 3000,
                            'totalUnits' => 5000
                          },          
                          new Map<String, Object> {
                            'start' => '2023/11/07 00:00:00',
                            'end' => '2023/11/07 23:59:59',
                            'availableUnits' => 3000,
                            'totalUnits' => 5000
                          }
                          
                         
                        }
                  }           
                };
                     System.debug('Mocked   P2P is TestAdServerMockResponse 2');
                    
                } 
                else if(servicePath.equalsIgnoreCase('/api/forecast/availability') &&  availabilityType == 'ByItemID')
                {
                  System.debug('Mocked   P2P is TestAdServerMockResponse 3');
                  payload = new Map<String, Object> {
                  'result' => 200 ,
                  'adServerInstanceId' => '22773096280',
                  'requestedBy' => 'autoproc@00dro0000009vcm2ay',
                  'requestId' => '468cb843-c88d-4679-5db5-4c704dd28030',
                  'minimalResults' => 20,
                  'detailResults' => new Map<String, Object>
                  {
                    'availableUnits' => 1,
                    'totalUnits' => 700000,
                    'deliveredUnits' => 600000,
                    'unitType' => 'IMPRESSIONS',
                    'reservedUnits' => 700,
                    'lineItemId' => '6287849752',
                    'orderId' => '3194297894'
                      }           
                    };
                         System.debug('Mocked   P2P is Invoked for total');
                }
                HttpResponse httpResponse = new HttpResponse();
                httpResponse.setStatusCode(200);
                httpResponse.setBody(JSON.serialize(response));
                output.put('HttpResponse', httpResponse);
                System.debug('Mocked response for the HTTP call is TestAdServerMockResponse :'+ response);
                return true;     
              }
              }
            
          7. From the App Launcher, find and select Interface Implementations.
          8. Click P2PSvcCustomizer from the list.
          9. In Active Implementation Class, enter MockedResponseP2PService.
          10. Save your changes.
          11. On the Related tab next to Interface Implementation Detail, click New.
          12. In the Available Implementation, enter MockedResponseP2PService, and select Active.
          13. Save your changes.

          Add Picklist Values to the Ad Availability Objects

          To view the avails calendar in your Advertising Sales Management org, add picklist values to the Units Status picklist field on the Ad Digital Availability and Ad Linear Availability objects.

          Managed Package Icon This is an Advertising Sales Management on Managed Package feature. For Advertising Sales Management on Salesforce Platform, see Advertising Sales Management on Salesforce Platform.

          1. From Setup, go to Object Manager, and click Ad Digital Availability.
          2. Click Fields & Relationships in the left pane.
          3. Click Units Status.
          4. Under Units Status Picklist Values, click New.
          5. Enter ‌these values in the space provided:
            • Available

            • Offered

            • Booked

            • Forecasted

            • Total

          6. Save your changes.
          7. Return to Object Manager, and click Ad Linear Availability.
          8. Similarly, add 'Available, Offered, Booked, Forecasted, and Total' as a Units Status picklist value.

          Configure the Avails Calendar

          Configure the avails calendar for your digital and TV ad placements from the Media Avails - Settings page. Create filters, edit the Availability Status legend, and make general configuration changes to the avails calendar view.

          Managed Package Icon This is an Advertising Sales Management on Managed Package feature. For Advertising Sales Management on Salesforce Platform, see Advertising Sales Management on Salesforce Platform.

          1. In the app launcher, search for and click Media Avails - Settings.
          2. To add custom filters for various media types, click the Filters tab in the left pane.
            From here, you can edit existing filters or even create new ones.
          3. To edit the Availability Status legend, click Availability Status in the left pane.
            From here, you can edit the Status Label, specify a range, define the associated color, and even create new statuses.
          4. To make general configuration changes to the avails calendar, click General Configuration in the left pane.
            From here, you can define batch sizes, data limits, inventory statuses, currency limits, and so on.

          Edit the Ad Server Layout to Include the Ad Server Company Field

          The Ad Server Company field is used for Media Ad Tech API Integrations. Edit the Ad Server page layout to ensure that this field is visible when creating an ad server record in your Advertising Sales Management org.

          Managed Package Icon This is an Advertising Sales Management on Managed Package feature. For Advertising Sales Management on Salesforce Platform, see Advertising Sales Management on Salesforce Platform.

          Note
          Note When creating an Ad Server in your org, the Ad Server Company field must not be empty. Use GAM if your external ad server is Google Ad Manager, and xglinear if your external ad server is xG Linear.
          1. Go to Settings and then click Setup.
          2. Go to Object Manager.
          3. Click Ad Server, and then click Page Layouts.
          4. Click Ad Server Layout.
          5. In Quick Find under Ad Server Layout, search for Ad Server Company.
          6. Drag and drop Ad Server Company into the Ad Server Detail section, and click Save.
          7. Add valid values for the Ad Server Company field. Valid values include GAM for Google Ad Manager and xglinear for xG Linear.

          Run a Data Population Job to Fetch Inventory Records

          You can schedule a data population job to fetch inventory records from your ad server at regular intervals or run a job once. To run your data population job one time, use ‌this script in the developer console.

          Managed Package Icon This is an Advertising Sales Management on Managed Package feature. For Advertising Sales Management on Salesforce Platform, see Advertising Sales Management on Salesforce Platform.

          1. From your Advertising Sales Management org, go to Settings, and click Developer Console.
          2. From Debug, select Open Execute Anonymous Window.
          3. Enter this script:
            This script triggers the job at 5:48 AM. You can adjust the namespace and time.
            
            vlocity_cmt.SfiAdsPopulationServiceSchedulable m = new vlocity_cmt.SfiAdsPopulationServiceSchedulable();
            String sch = '0 48 5 * * ?';
            String jobID = System.schedule('CP Test Population Job 4', sch, m);
            
          4. To run this script, click Execute.

          Set Up a Scheduler to Fetch Inventory Records

          Set up a scheduler to periodically retrieve inventory data from your ad server, so that the information you view from the avails calendar is accurate.

          Managed Package Icon This is an Advertising Sales Management on Managed Package feature. For Advertising Sales Management on Salesforce Platform, see Advertising Sales Management on Salesforce Platform.

          Before you set up the scheduler, ensure that your org has 'Total' as a picklist value under the Units Status picklist field for the Ad Digital Availability and Ad Linear Availability objects.

          1. Go to Settings and then click Setup.
          2. Click Schedule Apex.
          3. Enter a Job Name, and specify the frequency, and start and end date for the job to run.
          4. In the Apex Class field, click the search icon and find and select SfiAdsPopulationServiceSchedulable.
          5. Click Save.

          The scheduler is created. You can view your scheduled jobs from Setup. For more information about configuring the batch size, see Configure the Batch Size for a Scheduled Apex Class.

          Customize the Population Service

          Customize the population service used for the avails calendar at different points in the data fetching process.

          Managed Package Icon 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 Advertising Sales Management, you can use certain action strings to define customizations to the population service for the MediaAPICustomizer interface implementation.

          The following table lists the action strings for customization, along with sample inputs and expected outputs.

          Action String Description Sample Input Expected Output
          PopulateAvailabilityData Use this action string to customize the population service on top of an API response, to get availability data for all the Ad Space Specifications. For example, after the getAvailabilityForecast API call to the ad server.

          A map with availability data transformed.

          "data" : [{"dimensions": {map} , "digital": {List<Map>}},{"dimensions": , "linear":}]
          A map with key 'result'
          PopulateBookedData Use this action string to customize the population server on top of an API response to get booked data for all the OrderItems. For example, after the getAvailabilityForecastById API call to the ad server.

          A map with booked data transformed.

          "data" : [{"dimensions": {map} , "digital": {List<Map>}},{"dimensions": , "linear":}]
          A map with key 'result'
          PrePopulate Use this action string to populate the availability, offered, and booked data manually. You must give your own implementation to persist this information. The output of this action implementation must contain a key 'continueDefault'. Set the key to true if the existing default flow should follow this customization.

          A map with these keys:

          • adSpaceSpecificationList

          • availabilityJobId

          • startDate

          • endDate

          'continueDefault'
          PostPopulate Use this action string to make changes after the population service has tun.

          A map with these keys:

          • adSpaceSpecificationList

          • availabilityJobId

          • startDate

          • endDate

          • populationServiceOutput

          A map with the key 'result'

          Following is a sample interface implementation to achieve customizations.

          public virtual class MediaAPICustomizer implements VlocityOpenInterface{
                  
                  /**
                  * This method is called from SfiAdsPopulationServiceDataProcessor to return back customized responses
                  *
                  * @param  action where in the flow the customization is to take place 
                  * @param  input a map of input passed into customizer
                  * @param  output a map of output passed from customizer
                  * @param  options a map of options passed into customizer
                  * @return  if the call was successful or not
                  */
                  public Boolean invokeMethod(
                  String action,
                  Map<String, Object> input,
                  Map<String, Object> output,
                  Map<String, Object> options)
                  {
                  if(action == 'PopulateAvailabilityData'){
                  return true;
                  }
                  else if(action == 'PopulateBookedData'){
                  return true;
                  }
                  else if(action == 'PrePopulate'){
                  return true;
                  }
                  else if(action == 'PostPopulate'){
                  Map<String,Object> resultFromPopulate = (Map<String,Object>)input.get('result');
                  Map<String,Object> errorFromPopulate = (Map<String,Object>)input.get('error');
                  //perform any operations on the above two variables as you like and assign it to the output
                  return true;
                  }
                  return false;
                  }
                  }

          Set Up an Archival Service

          You can run into storage limit violations as the population service keeps running. To avoid the storage limit violations, set up an archival service for your Digital and TV media type.

          Managed Package Icon This is an Advertising Sales Management on Managed Package feature. For Advertising Sales Management on Salesforce Platform, see Advertising Sales Management on Salesforce Platform.

          1. From your Advertising Sales Management org, go to Settings, and click Developer Console.
          2. Create an archiver Apex class and run this code:
            global class sfiAdsAvailsArchiver implements Database.Batchable<sObject>{
            
             global Database.QueryLocator start(Database.BatchableContext context) {
                return Database.getQueryLocator('Select Id from AdAvailabilityDimensions where Job.IsActive = false');   
             }
            
             global void execute(Database.BatchableContext context, List<AdAvailabilityDimensions> records){
                delete records;
             }
            
             global void execute(Database.BatchableContext context){        
             }
             
             global void finish(Database.BatchableContext context){}
            }
          3. Create an archiver schedulable Apex class and run this code:
            // to be put in as a Scheduled job.
            global class sfiAdsAvailsArchiveScheduleable implements Schedulable {
                global void execute(SchedulableContext sc) {
                    sfiAdsAvailsArchiver b = new sfiAdsAvailsArchiver(); 
                    Database.executeBatch(b, 1);
                }
            }
          4. From your Advertising Sales Management org, go to Settings, and click Setup.
          5. In the Quick Find box, enter Apex Classes, and select it.
          6. Click Schedule Apex on the Apex Classes page.
          7. Enter a job name and specify the frequency, start date, and end date for the job to run.
            Note
            Note The frequency is determined by the data shape of TV and Digital media types.
          8. To find and select your schedulable Apex class in the Apex class field, clickSearch icon icon .
          9. Save your changes.
            Note
            Note To ensure the record deletion performance, regularly clean your Recycle Bin. See Deleting records.
           
          Loading
          Salesforce Help | Article