How to create a revenue schedule

  • 1
  • Question
  • Updated 4 years ago
  • Answered
I am new to Skuid. I have managed to set up products on a create opportunity page, but I cannot figure out how to configure the revenue schedule associated with each line item. I would be fine with having it on the page, but would prefer to use a pop up if possible. I really don't see any tutorials or pre set up pages that include this feature. 
Photo of Justin Kruse

Justin Kruse

  • 314 Points 250 badge 2x thumb

Posted 4 years ago

  • 1
Photo of Irvin Waldman

Irvin Waldman, Champion

  • 9,006 Points 5k badge 2x thumb
Assume you have activated schedules.  

The sobject that you will need to model is OpportunityLineItemSchedule.  

Review these links for more details:

https://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_opportunitylineitem.htm

https://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_opportunitylineitemschedule...

Hope this get you started in the right direction.
Photo of Justin Kruse

Justin Kruse

  • 314 Points 250 badge 2x thumb
Thanks, I will give these a look!
Photo of Irvin Waldman

Irvin Waldman, Champion

  • 9,006 Points 5k badge 2x thumb
Try this:

<skuidpage unsavedchangeswarning="yes" showsidebar="true" showheader="true" tabtooverride="OpportunityLineItem">   <models>
      <model id="OpportunityLineItem" limit="100" query="true" createrowifnonefound="false" sobject="OpportunityLineItem">
         <fields>
            <field id="Id"/>
            <field id="CreatedDate"/>
            <field id="OpportunityId"/>
            <field id="Opportunity.Name"/>
            <field id="HasQuantitySchedule"/>
            <field id="HasRevenueSchedule"/>
            <field id="Discount"/>
            <field id="ServiceDate"/>
            <field id="Description"/>
            <field id="ListPrice"/>
            <field id="Name"/>
            <field id="ProductCode"/>
            <field id="Quantity"/>
            <field id="UnitPrice"/>
            <field id="Subtotal"/>
            <field id="TotalPrice"/>
         </fields>
         <conditions>
            <condition type="modelmerge" value="" field="OpportunityId" operator="=" model="Opportunity" enclosevalueinquotes="true" mergefield="Id" novaluebehavior="deactivate"/>
         </conditions>
         <actions/>
      </model>
      <model id="Opportunity" limit="20" query="true" createrowifnonefound="false" sobject="Opportunity">
         <fields>
            <field id="Name"/>
            <field id="Id"/>
         </fields>
         <conditions>
            <condition type="param" value="id" field="Id" operator="=" enclosevalueinquotes="true" novaluebehavior=""/>
         </conditions>
         <actions/>
      </model>
      <model id="OpportunityLineItemSchedule" limit="20" query="true" createrowifnonefound="false" sobject="OpportunityLineItemSchedule">
         <fields>
            <field id="Revenue"/>
            <field id="Quantity"/>
            <field id="Type"/>
            <field id="Id"/>
            <field id="OpportunityLineItemId"/>
            <field id="OpportunityLineItem.Id"/>
            <field id="Description"/>
            <field id="ScheduleDate"/>
         </fields>
         <conditions>
            <condition type="fieldvalue" value="" enclosevalueinquotes="true" field="OpportunityLineItemId" state="filterableoff" inactive="true" name="OpportunityLineItemId"/>
         </conditions>
         <actions/>
      </model>
   </models>
   <components>
      <pagetitle model="Opportunity">
         <subtitle>Opportunity Products for</subtitle>
         <actions>
            <action type="savecancel"/>
         </actions>
         <maintitle>{{Name}}</maintitle>
      </pagetitle>
      <skootable showconditions="true" showsavecancel="false" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="false" model="OpportunityLineItem" mode="readonly">
         <fields>
            <field id="Name" valuehalign="" type=""/>
            <field id="Description" valuehalign="" type=""/>
            <field id="Quantity" decimalplaces="" valuehalign="" type="">
               <summaries>
                  <summary>sum</summary>
               </summaries>
            </field>
            <field id="ListPrice" decimalplaces="" valuehalign="" type=""/>
            <field id="UnitPrice" decimalplaces="" valuehalign="" type=""/>
            <field id="Subtotal" decimalplaces="" valuehalign="" type="">
               <summaries>
                  <summary>sum</summary>
               </summaries>
            </field>
            <field id="TotalPrice" decimalplaces="" valuehalign="" type="" allowordering="true">
               <summaries>
                  <summary>sum</summary>
               </summaries>
            </field>
            <field id="HasQuantitySchedule" type="" valuehalign=""/>
            <field id="HasRevenueSchedule" type="" valuehalign=""/>
         </fields>
         <rowactions>
            <action type="multi" label="Show Schedules" icon="ui-silk-application-form-add">
               <actions>
                  <action type="cancel">
                     <models>
                        <model>OpportunityLineItemSchedule</model>
                     </models>
                  </action>
                  <action type="setCondition" model="OpportunityLineItemSchedule" condition="OpportunityLineItemId" value="{{Id}}"/>
                  <action type="requeryModel" model="OpportunityLineItemSchedule" behavior="standard"/>
                  <action type="drawer" openicon="ui-silk-application-form-delete">
                     <drawer title="Drawer Area" width="90%" closehandle="true">
                        <components>
                           <skootable showconditions="true" showsavecancel="false" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="false" model="OpportunityLineItemSchedule" buttonposition="" mode="readonly">
                              <fields>
                                 <field id="Type" valuehalign="" type=""/>
                                 <field id="ScheduleDate"/>
                                 <field id="Quantity" decimalplaces="" valuehalign="" type=""/>
                                 <field id="Revenue" decimalplaces="" valuehalign="" type=""/>
                                 <field id="Description"/>
                              </fields>
                              <rowactions/>
                              <massactions usefirstitemasdefault="true"/>
                              <views>
                                 <view type="standard"/>
                              </views>
                           </skootable>
                        </components>
                     </drawer>
                  </action>
               </actions>
               <renderconditions logictype="or">
                  <rendercondition type="fieldvalue" operator="=" enclosevalueinquotes="false" fieldmodel="OpportunityLineItem" sourcetype="fieldvalue" field="HasQuantitySchedule" value="true"/>
                  <rendercondition type="fieldvalue" operator="=" enclosevalueinquotes="false" fieldmodel="OpportunityLineItem" sourcetype="fieldvalue" field="HasRevenueSchedule" value="true"/>
               </renderconditions>
            </action>
         </rowactions>
         <massactions usefirstitemasdefault="true"/>
         <views>
            <view type="standard"/>
         </views>
      </skootable>
   </components>
   <resources>
      <labels/>
      <css/>
      <javascript/>
   </resources>
</skuidpage>
Photo of Justin Kruse

Justin Kruse

  • 314 Points 250 badge 2x thumb
To be more clear. I have created an Opportunity create wizard. As one of the steps, I want the user to add products, then establish/customize a revenue schedule for each product. Thanks!
Photo of Irvin Waldman

Irvin Waldman, Champion

  • 9,006 Points 5k badge 2x thumb
Take a look at this page for details on the schedule sobject.

https://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_opportunitylineitemschedule...

I see a couple of challenges to work through:
  • Reproducing the Establish operation
  • Determining which columns to show depending on the type of schedule e.g. Revenue, Quantity or Both.
Note that the Type field is a restricted picklist.  I am intrigued and may give it a shot when I get a chance.
Photo of Justin Kruse

Justin Kruse

  • 314 Points 250 badge 2x thumb
Thanks. It seems bizarre that this would be so difficult. I cannot be the only person who has wanted to set up revenue schedules on a product, you would think there would be clear instructions...oh well. 
Photo of Justin Kruse

Justin Kruse

  • 314 Points 250 badge 2x thumb
I actually found a suitable workaround for the moment. I created an action on the product table that redirects in a new window to the standard lineId url and allows them to establish a schedule. It isn't perfect, but it allows me to move on to more pressing matters. If you think of anything better let me know. Thanks!
Photo of Irvin Waldman

Irvin Waldman, Champion

  • 9,006 Points 5k badge 2x thumb
Hi, Good to hear that you are moving forward.  Let me think about this one.