Certain TYSO Methods are exposed for your own use. While these methods leverage our logic, they do expect correct inputs to function correctly. These methods can be referenced in your own code, or run ad-hoc in the developer console. The methods are broken down into two areas (Record Creation and Automation). Record Creation methods are used to generate records that fit the TYSO object profile/attributes. Automation is used to run TYSO methods for keeping data current at your own interval.


Record Creation:


  • Opportunity Creation
    • Requires an Account ID, along with variables to be used in the creation of a TYSO Opp. The system will automatically determine the correct transaction type based on the Account, and co-term input.
    • The return type is an Opportunity object.

      VariableTypeInputRequired
      Accountidstring/idThe id of the Account record this Opportunity will be attached to.X
      conidstring/idThe id of the Contract record this Opportunity will be related to, if co-terming.
      cotermbooleanDetermines if this Opportunity should be coterminus with the above referenced contract.
      inputtermdecimalThe term of the Opportunity. This will be recalculated if the coterm flag is true and there is a valid contract.X
      startdatedateThe start date of the subscriptions for this Opportunity.X
      trxtypestringThe transaction type if you want to force it. Otherwise the system will automatically determine the correct transaction type.
      m2mbooleanIf this is a month to month transaction. Term will be adjusted accordingly.
      closedatedateThe close date for the opportunity.X
      inputstagenamestringThe stage to set the Opportunity to. If not provided, will default to the Record Type default.
      owneridstring/idThe owner of the Opportunity. If not provided, it will default to the current user.
      pricebookIdstring/idThe ID of the pricebook to be used on this Opportunity.X
      sourceinputstringThe Lead Source for this Opportunity.
      billtoIdstring/idThe ID of the Billing Account. If not provided, will be set to the Account ID.
      cmrrdecimalThe CMRR Value for this Opportunity. Others xRR values are estimated and derived from this.
      • Util.createTMOpportunity(string accountId, Id conID, boolean coTerm, decimal inputTerm, date startdate, string trxtype, boolean m2m,

                                                 date closeDate, string inputStageName, Id OwnerID, Id pricebookId, string sourceInput, string billToId, decimal cmrr)

    • Usage Example:


Opportunity oppinsert = new Opportunity();
oppinsert = tysoxrr.Util.createTMOpportunity('0012M00002BPDwg', null, false, 12.0, system.today(), null, false, system.today(), 'Prospecting', null, '01s2M000008wFSq', 'my lead source', null, 999);
insert oppinsert;



  • Quote Creation
    • The return type is a Quote object. Values such as term and dates are derived from the provided Opportunity object.

      VariableTypeInputRequired
      oppIdstring/idThe id of the Opportunity this quote will be attached to.X
      recordTypestring/idThe id of the Quote Record Type to use. User default is used if not provided.
      conRecstring/idThe id of the Contact record that should be associated to the Quote.X
      pbestring/idThe id of the pricebook to use.
      descriptionstringDescription of the Quote.
      • Util.createTMQuote(string oppId, string recordType, string conId, string pb, string description);

    • Usage Example:


Quote qteinsert = new Quote();
qteinsert = tysoxrr.Util.createTMQuote('0062M00000fogjj', null, '0032M00002fLAV2', null, 'my quote description');
insert qteinsert;

 



  • Opportunity & Quote combined Creation
    • Requires an Account ID, along with variables to be used in the creation of a TYSO Opp. The system will automatically determine the correct transaction type based on the Account, and co-term input.
    • The return type is a map with the ID and Object for each Opportunity/Quote.
    • Quote Lines can be added by using the map<string,map<string,string>> mapQLIValues variable.
    • NOTE: In this method the Quote and Opportunity objects are inserted. Any errors are captured in the TYSO_Logs__c object.

      VariableTypeInputRequired
      Accountidstring/idThe id of the Account record this Opportunity will be attached to.X
      conidstring/idThe id of the Contract record this Opportunity will be related to, if co-terming. You may also use the Contract Number as a replacement for the ID.
      cotermbooleanDetermines if this Opportunity should be coterminus with the above referenced contract.
      inputtermdecimalThe term of the Opportunity. This will be recalculated if the coterm flag is true and there is a valid contract.X
      startdatedateThe start date of the subscriptions for this Opportunity.X
      trxtypestringThe transaction type if you want to force it. Otherwise the system will automatically determine the correct transaction type.
      m2mbooleanIf this is a month to month transaction. Term will be adjusted accordingly.
      closedatedateThe close date for the opportunity.X
      inputstagenamestringThe stage to set the Opportunity to. If not provided, will default to the Record Type default.
      owneridstring/idThe owner of the Opportunity. If not provided, it will default to the current user.
      pricebookIdstring/idThe ID of the pricebook to be used on this Opportunity.X
      sourceinputstringThe Lead Source for this Opportunity.
      billtoIdstring/idThe ID of the Billing Account. If not provided, will be set to the Account ID.
      cmrrdecimalThe CMRR Value for this Opportunity. Others xRR values are estimated and derived from this.
      createQuotebooleanIf you want to create a Quote at the same time.
      syncQuotebooleanIf the quote should be synced 
      quoterecordTypestring/idThe ID of the Quote record type. If not provided, will default to the Record Type default for the user.
      quoteDescription    string    The description to be inserted on the Quote Description field.
      mapQLIValues    mapMap of Lines, see documentation below.
      • Util.createTMOppAndQuote(string accountId, Id conID, boolean coTerm, decimal inputTerm, date startdate, string trxtype, boolean m2m,
        date closeDate, string inputStageName, Id OwnerID, Id pricebookId, string sourceInput, string billToId, decimal cmrr, boolean createQuote, boolean syncQuote, string quoterecordType,
        string quotedescription, map<string,map<string,string>> mapQLIValues)

      • mapQLIValues should be in the following format:
        • Key: Identifier for the line
        • Sub-Map: Key is the string variable listed in the table above, the value is expressed as a string, even if the final cast type is something else (decimal, boolean, etc)
          • Key(Variable) = > String Value;
          • SUBmapQLIValues.put(quoteId, 'myquoteID');
          • SUBmapQLIValues.put(salesPrice, '999.99');
             
    • Usage Example:


//New Opportunity
map<string, sObject> mapTest = tysoxrr.Util.createTMOppAndQuote('0012M00002BPDwg', null, false, 12.0, system.today(), null, false, system.today(), 'Prospecting', null, '01s2M000008wFSq', 'my lead source', null, 999, true, false, null, 'my description', null);
system.debug('### mapTest '+ mapTest);

//New Opportunity with Quote Lines
map<string,map<string,string>> mapFULLQLIValues = new map<string,map<string,string>>{};
map<string,string> mapQLIValues = new map<string,string>{};

mapQLIValues.put('productID', '01t41000002Vcfl');
mapQLIValues.put('priceBookID', '01s2M000008wFSq'); 
mapQLIValues.put('m2m', 'false'); 
mapQLIValues.put('quantity', '1'); 
mapQLIValues.put('salesPrice', '20');     
mapQLIValues.put('listPrice', '20'); 
mapQLIValues.put('term', '12.0'); 
mapFULLQLIValues.put('1', mapQLIValues); 

//New Opportunity
map<string, sObject> mapTest = Util.createTMOppAndQuote('0012M00002BPDwg', null, false, 12.0, system.today(), null, false, system.today(), 
                                                                'Prospecting', null, '01s2M000008wFSq', 'my lead source', null, 999, true, true, null, 'my description', mapFULLQLIValues);



  • Quote Line Item Creation
    • The return type is a QuoteLineItem.
    • The system will calculate correct xRR values from the inputted values.
    • Limitations: Tier level or percentage based calculations will not take place using this method.

      VariableTypeInputRequired
      quoteIdstring/idThe id of the Quote record this Opportunity will be attached to.X
      productIdstring/idThe id of the Product this is related to. The Product Code can also be used.X
      pricebookIdstring/idThe id of the Pricebook this is related to. The pricebook name can also be used.X
      m2mbooleanIf this is a month to month opportunity.
      quantity    decimalThe quantity for this line. The system will determine if it's standard quantity or block quantity from the pricebook entry.X
      salespricedecimalThe per unit price for this product.X
      listpricedecimalThe per unit list price for this product. If not set, the pricebook entry list price will be used.
      discountdecimalThe applied discount percentage for this line.
      partnerdiscdecimalThe applied partner discount percentage for this line.
      termdecimalThe term length for this line.X
      startdatedateThe start date for this line.X
      enddatedateThe end date for this line.X
      bundleitemIdstring/idThe bundle item Id for this line, if part of a bundle.
      recalculatebooleanFuture use.
      • Util.createTMQuoteLineItem(string quoteID, string productID, string priceBookID, boolean m2m, decimal quantity, decimal salesPrice,
        decimal listPrice, decimal discount, decimal partnerDisc, decimal term, date startDate, date endDate, string bundleItemId, boolean recalculate)
         
    • Usage Example:




  • Subscription & Subscription Products Creator
    • Requires a set of Opportunity IDs, and will create a set of Subscription Products and Subscriptions from a Closed Won Opportunity.
      • subItemsCreator(set<Id> oppIds);

    • Usage Example:


set<Id> oppIds = new set<Id>();
oppIds.add('0061K0000285Zam');
tysoxrr.Util.subItemsCreator(oppIds);



  • Future Renewal Creator
    • Requires a set of Opportunity IDs, and will create a future Renewal Opportunity, along with Subscription Items and all adjoining child objects.
      • renewalOppCreator(Set<Id> oppIds);

    • Usage Example:


set<Id> oppIds = new set<Id>();
oppIds.add('0061K0000285Zam');
tysoxrr.Util.renewalOppCreator(oppIds);




Automation:

  • Book Opportunities
    • Requires a set of Opportunity IDs, and will run move the Opportunities to the selected Booked Stage and Record Type.
    • Requires a synced Quote to successfully book. Any errors are captured in the TYSO_Logs__c object.
      • bookOpps(Set<Id> oppIds);

    • Usage Example:


set<Id> oppIds = new set<Id>();
oppIds.add('0061K0000285Zam');
tysoxrr.Util.bookOpps(oppIds);




  • Refresh Renewal Opportunities

    • Requires a set of Account IDs, and will run the Renewal Refresher across all Renewals in the Account list.
      • refreshOpp(Set<string> setAcctIds);

    • Usage Example:

set<string> acctIds = new set<string>();
acctIds.add('0011K0000285Zam');
tysoxrr.Util.refreshOpp(acctIds);


  • Generate and Attach a PDF Quote Document

    • Requires the following variables:

      VariableTypeInputRequired
      inputtypestring/idOpportunity Type value
      quoteIdidID Value of the Quote Object you want to generate a PDF forX
      inputTemplateNamestringthe Name of the template you want to useX
       inputDocNamestring the Name of the document (excluding the file type. '.pdf' will be added automatically)X
    • Usage Example:

tysoxrr.QuoteGenerator.attachQuoteGlobal('New Business', '0Q02M000002iELd', 'Direct Order Form', 'New Business Quote.pdf');