Revenue Management API Developer Reference

ffrr.ViewService

global with sharing class ViewService

Provides methods for interacting with Recognition View records. Giving the ability to save and retrieve views as well as searching for values in records that relate to those views.

Enums

ViewType

The type of information (Actual, Forecast) that is presented to the user.

Value Description
Actual The information displayed is related to actual records.
Forecast The information displayed is related to forecast records.

Methods

getCurrencies

global static List<String> getCurrencies()

Retrieves a list of currencies in the current user's org.

Return Value

This service returns a list of String objects.

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.

//Call the method
List<String> currencyNames = ffrr.ViewService.getCurrencies();

//Output the currencies that were retrieved
for (String currencyName : currencyNames)
{
    system.debug('Currency: ' + currencyName);
}

getDefaultTabs

global static List<ffrr.ViewService.Tab> getDefaultTabs()

Retrieves a list of default tabs available to the current user. These are created using the ffrr__Settings__c records.

Return Value

This service returns a list of ffrr.ViewService.Tab objects.

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.

//Note: This sample demonstrates how to call the getDefaultTabs method and therefore
//relies on there being data within the system. For the sample to run fully
//Recognition Settings, Recognition Templates, Recognition Years and Periods, and Tabs should be available.
//If the data isn't available then the returned results will vary.

//Call the method
List<ffrr.ViewService.Tab> defaultTabs = ffrr.ViewService.getDefaultTabs();

//Output the default tabs that were retrieved
for (ffrr.ViewService.Tab defaultTab : defaultTabs)
{
    system.debug('Tab.isActive: ' + defaultTab.isActive);
    system.debug('Tab.objectType: ' + defaultTab.objectType);
    system.debug('Tab.selectors: ' + defaultTab.selectors);
    system.debug('Tab.tabFilter: ' + defaultTab.tabFilter);
}

getTabs

global static List<ffrr.ViewService.Tab> getTabs()

Retrieves a list of all of tabs which have been saved by the current user. Will return the working copy. If no working copy exists for the current user then the defaults will be returned.

Return Value

This service returns a list of ffrr.ViewService.Tab objects.

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.

//Note: This sample demonstrates how to call the getTabs method and therefore
//relies on there being data within the system. For the sample to run fully
//Recognition Settings, Recognition Templates, Recognition Years and Periods, and Tabs should be available.
//If the data isn't available then the returned results will vary.

//Call the method
List<ffrr.ViewService.Tab> allTabs = ffrr.ViewService.getTabs();

//Output the tabs that were retrieved
for (ffrr.ViewService.Tab tabDetails : allTabs)
{
    system.debug('Tab.isActive: ' + tabDetails.isActive);
    system.debug('Tab.objectType: ' + tabDetails.objectType);
    system.debug('Tab.selectors: ' + tabDetails.selectors);
    system.debug('Tab.tabFilter: ' + tabDetails.tabFilter);
}

getTabs

global static List<ffrr.ViewService.Tab> getTabs(ffrr.ViewService.ViewType viewType)

Retrieves a list of all of tabs of the specified type (Actual, Forecast) which have been saved by the current user.

Input Parameters

Name Type Description
viewType ffrr.ViewService.ViewType The type of the view (e.g. Actual or Forecast).

Return Value

This service returns a list of ffrr.ViewService.Tab objects.

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.

//Note: This sample demonstrates how to call the getTabs method and therefore
//relies on there being data within the system. For the sample to run fully
//Recognition Settings, Recognition Templates, Recognition Years and Periods, and Tabs should be available.
//If the data isn't available then the returned results will vary.

//Call the method for the forecast view type
List<ffrr.ViewService.Tab> allTabs = ffrr.ViewService.getTabs(ffrr.ViewService.ViewType.FORECAST);

//Output the tabs that were retrieved
for (ffrr.ViewService.Tab tabDetails : allTabs)
{
    system.debug('Tab.isActive: ' + tabDetails.isActive);
    system.debug('Tab.objectType: ' + tabDetails.objectType);
    system.debug('Tab.selectors: ' + tabDetails.selectors);
    system.debug('Tab.tabFilter: ' + tabDetails.tabFilter);
}

getTabsForView

global static List<ffrr.ViewService.Tab> getTabsForView(String viewName)

Retrieves a list of tabs for the specified shared recognition view.

Input Parameters

Name Type Description
viewName String Name of a shared recognition view.

Return Value

This service returns a list of ffrr.ViewService.Tab objects.

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.

//Note: This sample demonstrates how to call the getTabsForView method and therefore
//relies on there being data within the system. For the sample to run fully
//Recognition Settings, Recognition Templates, Recognition Years and Periods, Tabs and Views should be
//available. If the data isn't available then the returned results will vary. As
//this sample will retrieve tabs for a specific View, it is necessary that the View
//exists and that its name is used to populate the a String variable named viewName.

//Call the method
String viewName = 'Accounts View';
List<ffrr.ViewService.Tab> viewTabs = ffrr.ViewService.getTabsForView(viewName);

//Output the view tabs that were retrieved
for (ffrr.ViewService.Tab viewTab : viewTabs)
{
    system.debug('Tab.isActive: ' + viewTab.isActive);
    system.debug('Tab.objectType: ' + viewTab.objectType);
    system.debug('Tab.selectors: ' + viewTab.selectors);
    system.debug('Tab.tabFilter: ' + viewTab.tabFilter);
}

getViewNames

global static List<String> getViewNames()

Retrieves the list of recognition view names which are available to all users.

Return Value

This service returns a list of String objects.

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.

//Note: This sample demonstrates how to call the getViewNames method and therefore
//relies on there being data within the system. For the sample to run fully
//Recognition Settings, Recognition Templates, Recognition Years and Periods, Tabs and Views should be
//available. If the data isn't available then the returned results will vary.

//Call the method
List<String> viewNames = ffrr.ViewService.getViewNames();

//Output the names of the views that were retrieved
for (String viewName: viewNames)
{
    system.debug('ViewName: ' + viewName);
}

getWorkingCopy

global static List<ffrr.ViewService.Tab> getWorkingCopy()

Retrieves the working recognition view for the current user.

Return Value

This service returns a list of ffrr.ViewService.Tab objects.

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.

//Note: This sample demonstrates how to call the getWorkingCopy method and therefore
//relies on there being data within the system. For the sample to run fully
//Recognition Settings, Recognition Templates, Recognition Years and Periods, and Tabs should be available.
//If the data isn't available then the returned results will vary.

//Call the method
List<ffrr.ViewService.Tab> workingCopyTabs = ffrr.ViewService.getWorkingCopy();

//Output the working copy tabs that were retrieved
for (ffrr.ViewService.Tab workingCopy: workingCopyTabs)
{
    system.debug('Tab.isActive: ' + workingCopy.isActive);
    system.debug('Tab.objectType: ' + workingCopy.objectType);
    system.debug('Tab.selectors: ' + workingCopy.selectors);
    system.debug('Tab.tabFilter: ' + workingCopy.tabFilter);
}

getWorkingCopy

global static List<ffrr.ViewService.Tab> getWorkingCopy(ffrr.ViewService.ViewType viewType)

Retrieves the working recognition view for the current user for the specified type (Actual, Forecast). If the working recognition view does not exist the method retrieves the default tabs.

Input Parameters

Name Type Description
viewType ffrr.ViewService.ViewType The type of the view (e.g. Actual or Forecast).

Return Value

This service returns a list of ffrr.ViewService.Tab objects.

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.

//Note: This sample demonstrates how to call the getWorkingCopy method and therefore
//relies on there being data within the system. For the sample to run fully
//Recognition Settings, Recognition Templates, Recognition Years and Periods, and Tabs should be available.
//If the data isn't available then the returned results will vary.

//Call the method for the forecast view type
List<ffrr.ViewService.Tab> workingCopyTabs = ffrr.ViewService.getWorkingCopy(ffrr.ViewService.ViewType.FORECAST);

//Output the working copy tabs that were retrieved
for (ffrr.ViewService.Tab workingCopy: workingCopyTabs)
{
    system.debug('Tab.isActive: ' + workingCopy.isActive);
    system.debug('Tab.objectType: ' + workingCopy.objectType);
    system.debug('Tab.selectors: ' + workingCopy.selectors);
    system.debug('Tab.tabFilter: ' + workingCopy.tabFilter);
}

save

global static void save(List<ffrr.ViewService.Tab> tabs)

Saves the details of a set of revenue recognition tabs for a user's personal use. This saved data will not be available to other users.

Input Parameters

Name Type Description
tabs List<ffrr.ViewService.Tab> List of tabs.

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.

//Make sure that we have a filter in the system for the field StageName on the Opportunity object
ffrr__Filter__c stageFilter = new ffrr__Filter__c();
stageFilter.ffrr__ObjectAPIName__c = 'Opportunity';
stageFilter.ffrr__FieldAPIName__c = 'StageName';
insert stageFilter;

//Create the tab structure to save, along with the tab filter and tab filter selector
ffrr.ViewService.Tab myTab = new ffrr.ViewService.Tab();
ffrr.ViewService.TabFilter tabFilter = new ffrr.ViewService.TabFilter();
ffrr.ViewService.TabSelectorFilter tabSelectorFilter = new ffrr.ViewService.TabSelectorFilter();

//Populate the tab and connect it to the tab filter and the tab filter selector
myTab.isActive = true;
myTab.objectType = Opportunity.SObjectType;
myTab.tabFilter = tabFilter;

//Setup the tab selector and create its filter object (connecting it to the tab selector filter)
ffrr.ViewService.TabSelector tabSelector = new ffrr.ViewService.TabSelector();
tabSelector.objectType = Opportunity.SObjectType;
tabSelector.filters = new List<ffrr.ViewService.TabSelectorFilter>{tabSelectorFilter};

//Connect the tab selector to the tab
List<ffrr.ViewService.TabSelector> tabSelectorList = new List<ffrr.ViewService.TabSelector>();
tabSelectorList.add(tabSelector);
myTab.selectors = tabSelectorList;

//Setup the tab selector filter (filtering where StageName is 'Qualification' or 'Prospecting')
tabSelectorFilter.field = Opportunity.StageName;
tabSelectorFilter.values = new List<Object>{'Qualification', 'Prospecting'};

//Setup the recognition date and filter currency
tabFilter.currencyName = 'USD';
tabFilter.recognitionDate = date.today();

//Call the method to save the tab against the view 'Opportunity' for a forecast view type
ffrr.ViewService.save(new List<ffrr.ViewService.Tab>{myTab}, ffrr.ViewService.ViewType.FORECAST);

save

global static void save(List<ffrr.ViewService.Tab> tabs, String viewName)

Saves the details of a shared recognition view so that it is available for other users to use.

Input Parameters

Name Type Description
tabs List<ffrr.ViewService.Tab> List of tabs.
viewName String Name of the recognition view.

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.

//Make sure that we have a filter in the system for the field StageName on the Opportunity object
ffrr__Filter__c stageFilter = new ffrr__Filter__c();
stageFilter.ffrr__ObjectAPIName__c = 'Opportunity';
stageFilter.ffrr__FieldAPIName__c = 'StageName';
insert stageFilter;

//Create the tab structure to save, along with the tab filter and tab filter selector
ffrr.ViewService.Tab myTab = new ffrr.ViewService.Tab();
ffrr.ViewService.TabFilter tabFilter = new ffrr.ViewService.TabFilter();
ffrr.ViewService.TabSelectorFilter tabSelectorFilter = new ffrr.ViewService.TabSelectorFilter();

//Populate the tab and connect it to the tab filter and the tab filter selector
myTab.isActive = true;
myTab.objectType = Opportunity.SObjectType;
myTab.tabFilter = tabFilter;

//Setup the tab selector and create its filter object (connecting it to the tab selector filter)
ffrr.ViewService.TabSelector tabSelector = new ffrr.ViewService.TabSelector();
tabSelector.objectType = Opportunity.SObjectType;
tabSelector.filters = new List<ffrr.ViewService.TabSelectorFilter>{tabSelectorFilter};

//Connect the tab selector to the tab
List<ffrr.ViewService.TabSelector> tabSelectorList = new List<ffrr.ViewService.TabSelector>();
tabSelectorList.add(tabSelector);
myTab.selectors = tabSelectorList;

//Setup the tab selector filter (filtering where StageName is 'Qualification' or 'Prospecting')
tabSelectorFilter.field = Opportunity.StageName;
tabSelectorFilter.values = new List<Object>{'Qualification', 'Prospecting'};

//Setup the recognition date and filter currency
tabFilter.currencyName = 'USD';
tabFilter.recognitionDate = date.today();

//Call the method to save the tab against the view 'Opportunity'
ffrr.ViewService.save(new List<ffrr.ViewService.Tab>{myTab}, 'Opportunity');

save

global static void save(List<ffrr.ViewService.Tab> tabs, ffrr.ViewService.ViewType viewType)

Saves the details of a set of revenue recognition tabs of the specified view type for a user's personal use. This saved data will not be available to other users.

Input Parameters

Name Type Description
tabs List<ffrr.ViewService.Tab> List of tabs to be saved as a view.
viewType ffrr.ViewService.ViewType The type of the view (e.g Actual, Forecast).

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.

//Make sure that we have a filter in the system for the field StageName on the Opportunity object
ffrr__Filter__c stageFilter = new ffrr__Filter__c();
stageFilter.ffrr__ObjectAPIName__c = 'Opportunity';
stageFilter.ffrr__FieldAPIName__c = 'StageName';
insert stageFilter;

//Create the tab structure to save, along with the tab filter and tab filter selector
ffrr.ViewService.Tab myTab = new ffrr.ViewService.Tab();
ffrr.ViewService.TabFilter tabFilter = new ffrr.ViewService.TabFilter();
ffrr.ViewService.TabSelectorFilter tabSelectorFilter = new ffrr.ViewService.TabSelectorFilter();

//Populate the tab and connect it to the tab filter and the tab filter selector
myTab.isActive = true;
myTab.objectType = Opportunity.SObjectType;
myTab.tabFilter = tabFilter;

//Setup the tab selector and create its filter object (connecting it to the tab selector filter)
ffrr.ViewService.TabSelector tabSelector = new ffrr.ViewService.TabSelector();
tabSelector.objectType = Opportunity.SObjectType;
tabSelector.filters = new List<ffrr.ViewService.TabSelectorFilter>{tabSelectorFilter};

//Connect the tab selector to the tab
List<ffrr.ViewService.TabSelector> tabSelectorList = new List<ffrr.ViewService.TabSelector>();
tabSelectorList.add(tabSelector);
myTab.selectors = tabSelectorList;

//Setup the tab selector filter (filtering where StageName is 'Qualification' or 'Prospecting')
tabSelectorFilter.field = Opportunity.StageName;
tabSelectorFilter.values = new List<Object>{'Qualification', 'Prospecting'};

//Setup the recognition date and filter currency
tabFilter.currencyName = 'USD';
tabFilter.recognitionDate = date.today();

//Call the method to save the tab for a forecast view type
ffrr.ViewService.save(new List<ffrr.ViewService.Tab>{myTab}, 'Opportunity', ffrr.ViewService.ViewType.FORECAST);

save

global static void save(List<ffrr.ViewService.Tab> tabs, String viewName, ffrr.ViewService.ViewType viewType)

Saves the details of a shared recognition view of the specified view type so that it is available for other users to use.

Input Parameters

Name Type Description
tabs List<ffrr.ViewService.Tab> List of tabs to be saved as a view.
viewName String The name of the view.
viewType ffrr.ViewService.ViewType The type of the view (e.g. Actual, Forecast).

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.

//Make sure that we have a filter in the system for the field StageName on the Opportunity object
ffrr__Filter__c stageFilter = new ffrr__Filter__c();
stageFilter.ffrr__ObjectAPIName__c = 'Opportunity';
stageFilter.ffrr__FieldAPIName__c = 'StageName';
insert stageFilter;

//Create the tab structure to save, along with the tab filter and tab filter selector
ffrr.ViewService.Tab myTab = new ffrr.ViewService.Tab();
ffrr.ViewService.TabFilter tabFilter = new ffrr.ViewService.TabFilter();
ffrr.ViewService.TabSelectorFilter tabSelectorFilter = new ffrr.ViewService.TabSelectorFilter();

//Populate the tab and connect it to the tab filter and the tab filter selector
myTab.isActive = true;
myTab.objectType = Opportunity.SObjectType;
myTab.tabFilter = tabFilter;

//Setup the tab selector and create its filter object (connecting it to the tab selector filter)
ffrr.ViewService.TabSelector tabSelector = new ffrr.ViewService.TabSelector();
tabSelector.objectType = Opportunity.SObjectType;
tabSelector.filters = new List<ffrr.ViewService.TabSelectorFilter>{tabSelectorFilter};

//Connect the tab selector to the tab
List<ffrr.ViewService.TabSelector> tabSelectorList = new List<ffrr.ViewService.TabSelector>();
tabSelectorList.add(tabSelector);
myTab.selectors = tabSelectorList;

//Setup the tab selector filter (filtering where StageName is 'Qualification' or 'Prospecting')
tabSelectorFilter.field = Opportunity.StageName;
tabSelectorFilter.values = new List<Object>{'Qualification', 'Prospecting'};

//Setup the recognition date and filter currency
tabFilter.currencyName = 'USD';
tabFilter.recognitionDate = date.today();

//Call the method to save the tab against the view 'Opportunity' for a forecast view type
ffrr.ViewService.save(new List<ffrr.ViewService.Tab>{myTab}, 'Opportunity', ffrr.ViewService.ViewType.FORECAST);

save

global static void save(List<ffrr.ViewService.Tab> tabs, String viewName, ffrr.ViewService.SaveOptions saveOptions)

Saves the details of a shared recognition view of the specified view type so that it is available for other users to use.

Input Parameters

Name Type Description
tabs List<ffrr.ViewService.Tab> List of tabs to be saved as a view.
viewName String The name of the view.
saveOptions ffrr.ViewService.SaveOptions Additional options to change what is saved.

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.

//Make sure that we have a filter in the system for the field StageName on the Opportunity object
ffrr__Filter__c stageFilter = new ffrr__Filter__c();
stageFilter.ffrr__ObjectAPIName__c = 'Opportunity';
stageFilter.ffrr__FieldAPIName__c = 'StageName';
insert stageFilter;

//Create the tab structure to save, along with the tab filter and tab filter selector
ffrr.ViewService.Tab myTab = new ffrr.ViewService.Tab();
ffrr.ViewService.TabFilter tabFilter = new ffrr.ViewService.TabFilter();
ffrr.ViewService.TabSelectorFilter tabSelectorFilter = new ffrr.ViewService.TabSelectorFilter();

//Populate the tab and connect it to the tab filter and the tab filter selector
myTab.isActive = true;
myTab.objectType = Opportunity.SObjectType;
myTab.tabFilter = tabFilter;

//Setup the tab selector and create its filter object (connecting it to the tab selector filter)
ffrr.ViewService.TabSelector tabSelector = new ffrr.ViewService.TabSelector();
tabSelector.objectType = Opportunity.SObjectType;
tabSelector.filters = new List<ffrr.ViewService.TabSelectorFilter>{tabSelectorFilter};

//Connect the tab selector to the tab
List<ffrr.ViewService.TabSelector> tabSelectorList = new List<ffrr.ViewService.TabSelector>();
tabSelectorList.add(tabSelector);
myTab.selectors = tabSelectorList;

//Setup the tab selector filter (filtering where StageName is 'Qualification' or 'Prospecting')
tabSelectorFilter.field = Opportunity.StageName;
tabSelectorFilter.values = new List<Object>{'Qualification', 'Prospecting'};

//Setup the recognition date and filter currency
tabFilter.currencyName = 'USD';
tabFilter.recognitionDate = date.today();

// Setup the Options so that a working copy will be saved as well as a global copy.
ffrr.ViewService.SaveOptions saveOptions = new ffrr.ViewService.SaveOptions();
saveOptions.SaveWorkingCopy = true;
saveOptions.ViewType = ffrr.ViewService.ViewType.ACTUAL;

//Call the method to save the tab against the view 'Project__c' for an actual view type
ffrr.ViewService.save(new List<ffrr.ViewService.Tab>{myTab}, 'Opportunity', saveOptions);

search

global static ffrr.ViewService.SearchResult search(ffrr.ViewService.Tab tab, Schema.SObjectType objectType, String value)

Retrieves items from within the current tab using the selection filters that have been defined previously and the supplied value to search for. The returned data includes both the filters that were applied and the ids and names of the matched items.

Input Parameters

Name Type Description
tab ffrr.ViewService.Tab Tab to search in.
objectType Schema.SObjectType Source object to search.
value String Value to search for.

Return Value

This service returns a ffrr.ViewService.SearchResult object.

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.

//Note: This sample demonstrates how to call the search method for a specific object
//within a specific tab, and therefore relies on there being data within the system.
//For the sample to run Recognition Settings, Recognition Templates and data records should be available. If
//the data isn't available then the results will vary.

//Make sure that we have some filters for Opportunity object (in this case Region, CostCenter and Text)
ffrr__Filter__c regionFilter = new ffrr__Filter__c();
regionFilter.ffrr__ObjectAPIName__c = 'Opportunity';
regionFilter.ffrr__FieldAPIName__c = 'StageName';

ffrr__Filter__c costCenterFilter = new ffrr__Filter__c();
costCenterFilter.ffrr__ObjectAPIName__c = 'Opportunity';
costCenterFilter.ffrr__FieldAPIName__c = 'AccountName';

ffrr__Filter__c textFilter = new ffrr__Filter__c();
textFilter.ffrr__ObjectAPIName__c = 'Opportunity';
textFilter.ffrr__FieldAPIName__c = 'LeadSource';

insert new List<ffrr__Filter__c>{regionFilter, costCenterFilter, textFilter};


//Try to extract all of the tabs in the system for Opportunity
List<ffrr.ViewService.Tab> viewTabList = ffrr.ViewService.getTabsForView('Opportunity');

if (viewTabList.Size() > 0)   //Do we have any tabs?
{                                 //Yes - We'll search in the first one
    ffrr.ViewService.Tab searchTab = viewTabList[0];   //Store which tab we'll be searching in

    //Call the method to search Opportunity where any of the filters (Region__c, CostCenter__c or Text__c) equal 'Prospecting'
    ffrr.ViewService.SearchResult searchResults = ffrr.ViewService.search(searchTab, Opportunity.SObjectType, 'Prospecting');

    //Output the results that were returned
    for (ffrr.ViewService.Reference searchResult: searchResults.records)
    {
        System.debug('SearchResult: ' + searchResult);
    }
}

search

global static List<Object> search(ffrr.ViewService.Tab tab, Schema.SObjectType objectType, Schema.SObjectField field, String value)

Retrieves items from within the current tab based on the specified field rather than any selection filters that have been previously defined. The returned data includes both the filters that were applied and the ids and names of the matched items.

Input Parameters

Name Type Description
tab ffrr.ViewService.Tab Tab to search in.
objectType Schema.SObjectType Source object to search.
field Schema.SObjectField Field to search in.
value String Value to search for.

Return Value

This service returns a list of Object objects.

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.

//Note: This sample demonstrates how to call the search method for a specific field
//in a specific object within a specific tab of a specific view type, and therefore relies on there being
//data within the system. For the sample to run Recognition Settings, Recognition Templates and data records
//should be available. If the data isn't available then the results will vary.

//Try to extract all of the tabs in the system for Opportunity
List<ffrr.ViewService.Tab> viewTabList = ffrr.ViewService.getTabsForView('Opportunity');

if (viewTabList.Size() > 0)   //Do we have any tabs?
{                                 //Yes - We'll search in the first one
    ffrr.ViewService.Tab searchTab = viewTabList[0];   //Store which tab we'll be searching in

    //Call the method to search Opportunity where the StageName field equals 'Prospecting'
    List<Object> searchResults = ffrr.ViewService.search(searchTab, Opportunity.SObjectType, Opportunity.StageName, 'Prospecting');
}

search

global static ffrr.ViewService.SearchResult search(ffrr.ViewService.Tab tab, Schema.SObjectType objectType, String value, ffrr.ViewService.ViewType viewType)

Retrieves items from within the current tab of the specified view type using the selection filters that have been defined previously and the supplied value to search for. The returned data includes both the filters that were applied and the ID's and names of the matched items.

Input Parameters

Name Type Description
tab ffrr.ViewService.Tab Tab to search in.
objectType Schema.SObjectType Source object to search.
value String Value to search for.
viewType ffrr.ViewService.ViewType The type of the view to search in.

Return Value

This service returns a ffrr.ViewService.SearchResult object.

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.

//Note: This sample demonstrates how to call the search method for a specific object
//within a specific tab, and therefore relies on there being data within the system.
//For the sample to run Recognition Settings, Recognition Templates and data records should be available. If
//the data isn't available then the results will vary.

//Make sure that we have some filters for Opportunity object (in this case Region, CostCenter and Text)
ffrr__Filter__c regionFilter = new ffrr__Filter__c();
regionFilter.ffrr__ObjectAPIName__c = 'Opportunity';
regionFilter.ffrr__FieldAPIName__c = 'StageName';

ffrr__Filter__c costCenterFilter = new ffrr__Filter__c();
costCenterFilter.ffrr__ObjectAPIName__c = 'Opportunity';
costCenterFilter.ffrr__FieldAPIName__c = 'AccountName';

ffrr__Filter__c textFilter = new ffrr__Filter__c();
textFilter.ffrr__ObjectAPIName__c = 'Opportunity';
textFilter.ffrr__FieldAPIName__c = 'LeadSource';

insert new List<ffrr__Filter__c>{regionFilter, costCenterFilter, textFilter};


//Try to extract all of the tabs in the system for Opportunity
List<ffrr.ViewService.Tab> viewTabList = ffrr.ViewService.getTabsForView('Opportunity');

if (viewTabList.Size() > 0)   //Do we have any tabs?
{                                 //Yes - We'll search in the first one
    ffrr.ViewService.Tab searchTab = viewTabList[0];   //Store which tab we'll be searching in

    //Call the method to search Opportunity where any of the filters (Region__c, CostCenter__c or Text__c) equal 'Prospecting'
    ffrr.ViewService.SearchResult searchResults = ffrr.ViewService.search(searchTab, Opportunity.SObjectType, 'Prospecting', ffrr.ViewService.ViewType.FORECAST);

    //Output the results that were returned
    for (ffrr.ViewService.Reference searchResult: searchResults.records)
    {
        System.debug('SearchResult: ' + searchResult);
    }
}

search

global static List<Object> search(ffrr.ViewService.Tab tab, Schema.SObjectType objectType, Schema.SObjectField field, String value, ffrr.ViewService.ViewType viewType)

Retrieves items from within the current tab of the specified type of view based on the specified field rather than any selection filters that have been previously defined. The returned data includes both the filters that were applied and the ID's and names of the matched items.

Input Parameters

Name Type Description
tab ffrr.ViewService.Tab Tab to search in.
objectType Schema.SObjectType Source object to search.
field Schema.SObjectField Field to search in.
value String Value to search for.
viewType ffrr.ViewService.ViewType The type of the view to search in.

Return Value

This service returns a list of Object objects.

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.

//Note: This sample demonstrates how to call the search method for a specific field
//in a specific object within a specific tab of a specific view type, and therefore relies on there being
//data within the system. For the sample to run Recognition Settings, Recognition Templates and data records
//should be available. If the data isn't available then the results will vary.

//Try to extract all of the tabs in the system for Opportunity
List<ffrr.ViewService.Tab> viewTabList = ffrr.ViewService.getTabsForView('Opportunity');

if (viewTabList.Size() > 0)   //Do we have any tabs?
{                                 //Yes - We'll search in the first one
    ffrr.ViewService.Tab searchTab = viewTabList[0];   //Store which tab we'll be searching in

    //Call the method to search Opportunity where the Region__c field equals 'UK' in the view of type Forecast
    List<Object> searchResults = ffrr.ViewService.search(searchTab, Opportunity.SObjectType, Opportunity.StageName, 'Prospecting', ffrr.ViewService.ViewType.FORECAST);
}

ffrr.ViewService.FieldIdentifier

global with sharing class FieldIdentifier

Contains the details of a field being referenced this includes the object the field belongs to.

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.

//Get some Tabs
List<ffrr.ViewService.Tab> tabs = ffrr.ViewService.getTabsForView( 'MyTab' );

for(ffrr.ViewService.Tab tab : tabs)
{
    if(tab.filterErrors != null)
    {
        for(ffrr.ViewService.FieldIdentifier fiSample : tab.filterErrors)
        {
            System.debug(String.format('Field by name: {0}.{1}', new List<String>{fiSample.objectName, fiSample.fieldName}));
            System.debug(String.format('Field by label: {0}.{1}', new List<String>{fiSample.objectLabel, fiSample.fieldLabel}));
        }
    }
}

Properties

Name Type Description
fieldName String Identifies the source field by name.
fieldLabel String Identifies the source field by label.
objectName String Identifies the source object by name.
objectLabel String Identifies the source object by label.

Methods

FieldIdentifier

global FieldIdentifier()

FieldIdentifier

global FieldIdentifier(String objectName, String objectLabel, String fieldName, String fieldLabel)

ffrr.ViewService.Tab

global with sharing class Tab

Contains the details of a display tab, including the object or group that the tab refers to and any filters that have been setup for that object or group.

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 the TabFilter, TabSelectors and TabSelectorFilters that we'll add to our Tab

//Create a filter for the billing country
ffrr.ViewService.TabSelectorFilter tsfBillingCountry = new ffrr.ViewService.TabSelectorFilter();
tsfBillingCountry.field = Account.BillingCountry;
tsfBillingCountry.values = new List<String>{'UK', 'US'};

//Create a filter for the industry
ffrr.ViewService.TabSelectorFilter tsfIndustry = new ffrr.ViewService.TabSelectorFilter();
tsfIndustry.field = Account.Industry;
tsfIndustry.values = new List<String>{'Insurance', 'Finance'};

//Create the TabSelector
ffrr.ViewService.TabSelector sampleTabSelector = new ffrr.ViewService.TabSelector();
sampleTabSelector.objectType = Account.getSObjectType();
sampleTabSelector.filters = new List<ffrr.ViewService.TabSelectorFilter>();

sampleTabSelector.filters.add(tsfBillingCountry);
sampleTabSelector.filters.add(tsfIndustry);


//Create the TabFilter
ffrr.ViewService.TabFilter sampleTabFilter = new ffrr.ViewService.TabFilter();
sampleTabFilter.currencyName = 'USD';
sampleTabFilter.recognitionDate = date.newInstance(2013, 3, 13);


//Create the Tab
ffrr.ViewService.Tab tSample = new ffrr.ViewService.Tab();

//Specify that the tab is active
tSample.isActive = true;

//Specify which group this tab relates to
tSample.objectType = Account.getSObjectType();

//Apply the TabFilter that we created above
tSample.tabFilter = sampleTabFilter;

//Create a list to hold our TabSelectors
tSample.selectors = new List<ffrr.ViewService.TabSelector>();

//Add the TabSelectors that we created above
tSample.selectors.add(sampleTabSelector);

Properties

Name Type Description
filterErrors List<ffrr.ViewService.FieldIdentifier> Error messages for any bad filters which were removed.
isActive Boolean True = Active Tab | False = Inactive Tab
objectType Schema.SObjectType Identifies the source object.
selectors List<ffrr.ViewService.TabSelector> User-defined filters.
tabFilter ffrr.ViewService.TabFilter Any filters to apply to the tab.

Methods

Tab

global Tab()

ffrr.ViewService.TabFilter

global with sharing class TabFilter

Contains the mandatory filters to apply to the tab. = These are applied in addition to the user-defined filters defined elsewhere.

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 the TabFilter
ffrr.ViewService.TabFilter tfSample = new ffrr.ViewService.TabFilter();

//Specify the currency that the tab will use
tfSample.currencyName = 'USD';

//Specify the recognition date that the tab will filter by
tfSample.recognitionDate = date.newInstance(2013, 3, 13);

Properties

Name Type Description
currencyName String Name of the currency.
ProcessUseInContractRecords Boolean If true source records related recognition settings where ffrr__UseInRevenueContract__c is true are selected. If false source records related recognition settings where ffrr__UseInRevenueContract__c is false are selected. The default is false.
recognitionDate Date Date on which to base the calculation.
years List<Id> List of year IDs.

Methods

TabFilter

global TabFilter()

Contains the mandatory filters to apply to the tab. These are applied in addition to the user-defined filters defined elsewhere.

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.

//Note: in order for the following code to work one or more Recognition Years
//should exist in the database.

//Create a list of ids and add the yearr ids retrieved from the database.
List<ID> yearids = new List<ID>();
yearIDs.add('a1ga00000111sg1');
yearIDs.add('a1ga00000111sg2');
yearIDs.add('a1ga00000111sg3');

//Create the TabFilter
ffrr.ViewService.TabFilter tfSample = new ffrr.ViewService.TabFilter();

//Specify the currency that the tab will use
tfSample.currencyName = 'USD';

//Specify the recognition date that the tab will filter by
tfSample.recognitionDate = date.newInstance(2013, 3, 13);

//Specify the years that the tab will filter by
tfSample.years = yearIDs;

ffrr.ViewService.TabSelector

global with sharing class TabSelector

Contains the details of an object to be filtered and the filters that apply to that object.

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 the TabSelectorFilters which will specify the fields and values
//that can be filtered. These will then get added to the TabSelector

//Create a filter for the billing country
ffrr.ViewService.TabSelectorFilter tsfBillingCountry = new ffrr.ViewService.TabSelectorFilter();
tsfBillingCountry.field = Account.BillingCountry;
tsfBillingCountry.values = new List<String>{'UK', 'US'};

//Create a filter for the industry
ffrr.ViewService.TabSelectorFilter tsfIndustry = new ffrr.ViewService.TabSelectorFilter();
tsfIndustry.field = Account.Industry;
tsfIndustry.values = new List<String>{'Insurance', 'Finance'};


//Create the TabSelector
ffrr.ViewService.TabSelector tsSample = new ffrr.ViewService.TabSelector();

//Specify the object type that the filter will apply to
tsSample.objectType = Account.getSObjectType();

//Create the structure to hold the TabSelectorFilter objects
tsSample.filters = new List<ffrr.ViewService.TabSelectorFilter>();

//Add the two TabSelectorFilters that we created
tsSample.filters.add(tsfBillingCountry);
tsSample.filters.add(tsfIndustry);

Properties

Name Type Description
filters List<ffrr.ViewService.TabSelectorFilter> The filters to apply.
objectType Schema.SObjectType The object to filter.

Methods

TabSelector

global TabSelector()

ffrr.ViewService.TabSelectorFilter

global with sharing class TabSelectorFilter implements Comparable

Contains the field and the values used to filter an object.

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 the TabSelectorFilter
ffrr.ViewService.TabSelectorFilter tsfSample = new ffrr.ViewService.TabSelectorFilter();

//Specify the field which the filter will apply to
tsfSample.field = Account.BillingCountry;

//Specify the available filter values that we're allowing for the field
tsfSample.values = new List<String>{'UK', 'US'};

Properties

Name Type Description
field Schema.SObjectField The field to filter on.
values List<Object> The value or values to filter by.

Methods

TabSelectorFilter

global TabSelectorFilter()

ffrr.ViewService.Reference

global virtual with sharing class Reference implements Comparable, IRevRecReference

Contains the ID and name of an item. Used throughout Revenue Management.

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 the Reference
ffrr.ViewService.Reference rSample = new ffrr.ViewService.Reference();

//Set the ID and the label of the data
rSample.Id = 'a0wa00000661oe8';
rSample.name = 'Customer Account 1762991';

Properties

Name Type Description
id Id ID of the item.
name String Name of the item.

Methods

Reference

global Reference()

ffrr.ViewService.SearchResult

global with sharing class SearchResult

Contains the results of a search. The structure contains both the returned records and the filters used in the search.

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 the filters that apply to this search result
//Create a filter for the billing country
ffrr.ViewService.TabSelectorFilter tsfBillingCountry = new ffrr.ViewService.TabSelectorFilter();
tsfBillingCountry.field = Account.BillingCountry;
tsfBillingCountry.values = new List<String>{'UK', 'US'};

//Create a filter for the industry
ffrr.ViewService.TabSelectorFilter tsfIndustry = new ffrr.ViewService.TabSelectorFilter();
tsfIndustry.field = Account.Industry;
tsfIndustry.values = new List<String>{'Insurance', 'Finance'};

//Create the results data that we want to send back via the SearchResult
//Create the first row of result data
ffrr.ViewService.Reference result1 = new ffrr.ViewService.Reference();
result1.id = 'a0sa00000011op1';
result1.name = 'Customer 1 Project';

//Create the second row of result data
ffrr.ViewService.Reference result2 = new ffrr.ViewService.Reference();
result2.id = 'a0sa00000011ow4';
result2.name = 'Customer 8 Project';


//Create the SearchResult
ffrr.ViewService.SearchResult srSample = new ffrr.ViewService.SearchResult();

//Create a list to hold the filters that were applied to get the search result data
srSample.filters = new List<ffrr.ViewService.TabSelectorFilter>();

//Add the filters that were applied to get the search result data
srSample.filters.add(tsfBillingCountry);
srSample.filters.add(tsfIndustry);

//Create a list to hold the records that matched the search filters
srSample.records = new List<ffrr.ViewService.Reference>();

//Add the records that matched the search filters
srSample.records.add(result1);
srSample.records.add(result2);

Properties

Name Type Description
filters List<ffrr.ViewService.TabSelectorFilter> List of filters used in the search.
records List<ffrr.ViewService.Reference> The records that came back from the search.

Methods

SearchResult

global SearchResult()

ffrr.ViewService.SaveOptions

global with sharing class SaveOptions

Specifies additional options to change what is saved.

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 the save option
ffrr.ViewService.SaveOptions saveOptions = new ffrr.ViewService.SaveOptions();

//Specify whether to create a WorkingCopy view or not.
saveOptions.SaveWorkingCopy = true;

//The type of View to create.
saveOptions.ViewType = ffrr.ViewService.ViewType.ACTUAL;

Properties

Name Type Description
SaveWorkingCopy Boolean Determines whether a Working Copy view is also saved. Defaults to false.
ViewType ffrr.ViewService.ViewType The type of the view (e.g. Actual, Forecast).

Methods

SaveOptions

global SaveOptions()

© Copyright 2009–2024 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.