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.
Variable Type Input Required Accountid string/id The id of the Account record this Opportunity will be attached to. X conid string/id The id of the Contract record this Opportunity will be related to, if co-terming. coterm boolean Determines if this Opportunity should be coterminus with the above referenced contract. inputterm decimal The term of the Opportunity. This will be recalculated if the coterm flag is true and there is a valid contract. X startdate date The start date of the subscriptions for this Opportunity. X trxtype string The transaction type if you want to force it. Otherwise the system will automatically determine the correct transaction type. m2m boolean If this is a month to month transaction. Term will be adjusted accordingly. closedate date The close date for the opportunity. X inputstagename string The stage to set the Opportunity to. If not provided, will default to the Record Type default. ownerid string/id The owner of the Opportunity. If not provided, it will default to the current user. pricebookId string/id The ID of the pricebook to be used on this Opportunity. X sourceinput string The Lead Source for this Opportunity. billtoId string/id The ID of the Billing Account. If not provided, will be set to the Account ID. cmrr decimal The 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)
- Util.createTMOpportunity(string accountId, Id conID, boolean coTerm, decimal inputTerm, date startdate, string trxtype, boolean m2m,
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.
Variable Type Input Required oppId string/id The id of the Opportunity this quote will be attached to. X recordType string/id The id of the Quote Record Type to use. User default is used if not provided. conRec string/id The id of the Contact record that should be associated to the Quote. X pbe string/id The id of the pricebook to use. description string Description of the Quote. - Util.createTMQuote(string oppId, string recordType, string conId, string pb, string description);
- Util.createTMQuote(string oppId, string recordType, string conId, string pb, string description);
Usage Example:
- The return type is a Quote object. Values such as term and dates are derived from the provided Opportunity object.
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.
Variable Type Input Required Accountid string/id The id of the Account record this Opportunity will be attached to. X conid string/id The 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. coterm boolean Determines if this Opportunity should be coterminus with the above referenced contract. inputterm decimal The term of the Opportunity. This will be recalculated if the coterm flag is true and there is a valid contract. X startdate date The start date of the subscriptions for this Opportunity. X trxtype string The transaction type if you want to force it. Otherwise the system will automatically determine the correct transaction type. m2m boolean If this is a month to month transaction. Term will be adjusted accordingly. closedate date The close date for the opportunity. X inputstagename string The stage to set the Opportunity to. If not provided, will default to the Record Type default. ownerid string/id The owner of the Opportunity. If not provided, it will default to the current user. pricebookId string/id The ID of the pricebook to be used on this Opportunity. X sourceinput string The Lead Source for this Opportunity. billtoId string/id The ID of the Billing Account. If not provided, will be set to the Account ID. cmrr decimal The CMRR Value for this Opportunity. Others xRR values are estimated and derived from this. createQuote boolean If you want to create a Quote at the same time. syncQuote boolean If the quote should be synced quoterecordType string/id The 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 map Map 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');
- Util.createTMOppAndQuote(string accountId, Id conID, boolean coTerm, decimal inputTerm, date startdate, string trxtype, boolean m2m,
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.
Variable Type Input Required quoteId string/id The id of the Quote record this Opportunity will be attached to. X productId string/id The id of the Product this is related to. The Product Code can also be used. X pricebookId string/id The id of the Pricebook this is related to. The pricebook name can also be used. X m2m boolean If this is a month to month opportunity. quantity decimal The quantity for this line. The system will determine if it's standard quantity or block quantity from the pricebook entry. X salesprice decimal The per unit price for this product. X listprice decimal The per unit list price for this product. If not set, the pricebook entry list price will be used. discount decimal The applied discount percentage for this line. partnerdisc decimal The applied partner discount percentage for this line. term decimal The term length for this line. X startdate date The start date for this line. X enddate date The end date for this line. X bundleitemId string/id The bundle item Id for this line, if part of a bundle. recalculate boolean Future 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)
- Util.createTMQuoteLineItem(string quoteID, string productID, string priceBookID, boolean m2m, decimal quantity, decimal salesPrice,
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);
- subItemsCreator(set<Id> oppIds);
Usage Example:
- Requires a set of Opportunity IDs, and will create a set of Subscription Products and Subscriptions from a Closed Won Opportunity.
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:
- Requires a set of Opportunity IDs, and will create a future Renewal Opportunity, along with Subscription Items and all adjoining child objects.
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);
- refreshOpp(Set<string> setAcctIds);
Usage Example:
- Requires a set of Account IDs, and will run the Renewal Refresher across all Renewals in the Account list.
set<string> acctIds = new set<string>(); acctIds.add('0011K0000285Zam'); tysoxrr.Util.refreshOpp(acctIds);
Generate and Attach a PDF Quote Document
- Requires the following variables:
Variable Type Input Required inputtype string/id Opportunity Type value quoteId id ID Value of the Quote Object you want to generate a PDF for X inputTemplateName string the Name of the template you want to use X inputDocName string the Name of the document (excluding the file type. '.pdf' will be added automatically) X Usage Example:
- Requires the following variables:
tysoxrr.QuoteGenerator.attachQuoteGlobal('New Business', '0Q02M000002iELd', 'Direct Order Form', 'New Business Quote.pdf');