This API creates a favorite configuration from the Catalog page referenced by cartID.


APISignature
saveFavoriteConfigurationstatic Apttus_Config2.FavoriteConfigurationStruct.SaveFavoriteResponseDO saveFavoriteConfiguration(Apttus_Config2.FavoriteConfigurationStruct.SaveFavoriteRequestDO requestDO)



Parameters
NameTypeDescription
requestApttus_Config2.FavoriteConfigurationStruct.SaveFavoriteRequestDOThe request data object.



Request Data Object - Apttus_Config2.FavoriteConfigurationStruct.SaveFavoriteRequestDO
FieldTypeDescription
cartIDIDThe identifier of the cart.
favoriteConfigurationSOApttus_Config2__FavoriteConfiguration__cReference to the Favorite Configuration Object
lineNumbersList <Integer>The list of line numbers to be added to the favorite configuration.



Response Data Object - Apttus_Config2.FavoriteConfigurationStruct.SaveFavoriteResponseDO
FieldTypeDescription
favoriteConfigurationSOApttus_Config2__FavoriteConfiguration__cReference to the Favorite Configuration Object
processedLineNumbersList<Integer>List of line numbers added as a favorite configuration.



Data Object - Apttus_Config2__FavoriteConfiguration_c
FieldTypeDescription
NameStringEnter a suitable name for your favorite configuration. This name is displayed as a record under your Favorites category.
PriceListIdStringThe pricelist id associated with a favorite configuration.
ScopeStringChoose an option for the visibility of your configuration record. The available values are, Public and Private. If you set this to Private, this record is visible to only the owner of the record. If you set this to Public, this record is accessible to all the users.


Code Sample

The sample below enables you to create a favorite configuration for a cart with a cartId. You can invoke this API in use cases when you want to show a Favorite configuration page based on the cartID and pricelist.

public class QAddToFavorite implements Queueable {
    public Apttus_Config2.FavoriteConfigurationStruct.SaveFavoriteRequestDO requestDO;
    
    public QAddToFavorite(Apttus_Config2.FavoriteConfigurationStruct.SaveFavoriteRequestDO requestDO) 
	{
        this.requestDO = requestDO;

    }
    
    public void execute(QueueableContext context) 
	{
        Apttus_Config2.FavoriteConfigurationStruct.SaveFavoriteResponseDO responseDO = new Apttus_Config2.FavoriteConfigurationStruct.SaveFavoriteResponseDO();
        responseDO = Apttus_Config2.FavoriteConfigurationGlobalService.saveFavoriteConfiguration(requestDO);
        List<Integer> processedLineNumbers = responseDO.processedLineNumbers;
        List<Integer> unProcessedLineNumbers = new List<Integer>();
        
        for (Integer lineNumber : requestDO.lineNumbers) 
		{
            if (!processedLineNumbers.contains(lineNumber)) 
			{
                unProcessedLineNumbers.add(lineNumber);
            }
        }
        
        if (!unProcessedLineNumbers.isEmpty()) 
		{
            requestDO.favoriteConfigurationSO.id = responseDO.favoriteConfigurationSO.id ;
            requestDO.lineNumbers = unProcessedLineNumbers;
            system.debug('Request DO is ' + requestDO);
            System.enqueueJob(new QAddToFavorite(requestDO));
        }       
    }   
}

//Sample code to execute from the anonymous window.

Apttus_Config2.FavoriteConfigurationStruct.SaveFavoriteRequestDO requestDO = new Apttus_Config2.FavoriteConfigurationStruct.SaveFavoriteRequestDO();
requestDO.favoriteConfigurationSO.Name = 'QueueableAPI-1 Fav BundleandStd'; // Name of favorite configuration
requestDO.favoriteConfigurationSO.Apttus_Config2__Active__c = true;
requestDO.favoriteConfigurationSO.Apttus_Config2__Scope__c = 'Public';
requestDO.favoriteConfigurationSO.Apttus_Config2__PriceListId__c = 'a4QP0000000wNyC'; // priceList ID
requestDO.favoriteConfigurationSO.Apttus_Config2__Description__c = 'Sample description';
requestDO.cartId = ID.valueOf('a4jP0000000M23t'); // product configuration or cartID
requestDO.lineNumbers = new List<Integer>{1,2,3,4,5,6,7,8,9,10};
System.enqueueJob(new QAddToFavorite(requestDO));
CODE