Subscribed zuora forsalesforce training -section301-final

36
#Subscribed14 @twittername Section 301 Templates, Components & Plugins Advanced Concepts

description

ZuoraForSalesforce Session 301 - Covering Advanced topics like Components and Plugins.

Transcript of Subscribed zuora forsalesforce training -section301-final

Page 1: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Section 301

Templates, Components & Plugins

Advanced Concepts

Page 2: Subscribed zuora forsalesforce training -section301-final

OBJ 1:

OBJ 2:

OBJ 3:

Understand the need when to extend and add to the OOTB Zuora Quotes workflow and the benefits offered by Templates, Components & Plugin functionality

Get comfortable with developing components & plugins and enhancing Zuora Quotes workflow

Objectives

Explore the Component Registration Feature in ZuoraConfig and examples of OOTB components available

Page 3: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Business Scenario - Advanced Sales Quote Workflow

CreateAccount

Create Opport Advanced Create Quote Workflow

Add Products & RatePlansSubmit QuoteReview Subscription& Invoice

With a large number of variations in the quote to subscription workflow, very often it is required to either extend existing functionality or add new functionality to Zuora Quotes. This is where Components and Plugins in Zuora For Salesforce comes into the picture.

Page 4: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Components & Plugins – Definition

ComponentsSimilar to the way you can encapsulate a piece of code in a method and then reuse that method several times in a program, you can encapsulate a common design pattern in a custom component and then reuse that component several times in one or more Visualforce pages.

PluginsAn Apex plugin for a managed package is an external class, instantiated dynamically at runtime, which is called from within the package, the package has no dependency on the class.

Page 5: Subscribed zuora forsalesforce training -section301-final

Components & Plugin - ArchitectureVisual Force Page

Page Level Component

UI Component

UI Component

UI Component

Plug-In

UI Component

Plug-In

= Plug-In

Page 6: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Examples of OOTB Components

Page 7: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Property Component

Page 8: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

List Component

Page 9: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Lookup Component

Page 10: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Mutton (Menu + Button) Component

Page 11: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Components & Plugins - Benefits

Components and Plugins provide the following benefits:They dramatically speed up development what previously was pure Apex code by reusing successful patterns already established in our Quotes applicationIt allows custom functionality over and above what Zuora For Salesforce provides out of the box, but in a managed way, an example being the default-values exercise you will perform in a lab exercise.

Page 12: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Component RegistrationZuora provides a single place to manage all your components and plugins in a structured way.

Page 13: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Component Registration Benefits

• Provides a central place to manage all of your custom components and plugins

• Reduces the number of steps it previously took to use a component or a plugin in your system

• Puts you on an upgrade path such that when we add additional functionality to these components, you get an immediate benefit as opposed to if you had used custom code

• It means you will take advantage for your own components of any point and click Admin UI we decide to put on top of the components or plugins

• It allows Zuora to isolate custom code versus product issues occurring in your implementation much more easily

Page 14: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Section 301

Lab Exercises

Page 15: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Lab Exercise 1 - Components

In this lab exercise you will use the PropertyComponent to create a new Quote Details Page.

We will programmatically create the PaymentMethod field (static field in Section 201) and dynamically drive Payment Term field.

Page 16: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Property & Lookup Component - Lab Exercise Steps

1. Develop Custom Controller by Extending zqu.PropertyComponentController & Leverage Lookup Component

2. Develop Custom Visualforce Page and Leverage PropertyComponent attributes

3. Add the Newly Created Page to the Quote Wizard Workflow

Page 18: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Step 1 – Create Custom Controller

App Setup – Develop – Apex Classes – New - Paste the downloaded Code

Page 19: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

High Level Code Analysis

1. Extending zqu.PropertyComponentController

2. Leveraging zqu.PropertyComponentOptions

3. Leveraging zqu.LookupComponentOptions

Page 20: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Step 2 – Develop Custom Visualforce Page

App Setup – Develop – Pages – New – Paste the downloaded Code

Page 21: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Update Quote Wizard Workflow

Select the Visualforce page you created as step #2

Page 22: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Create a New Quote

Select an opportunity and click on New Quote Button

Page 23: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Verify Step #2 of the Quote Workflow

Page Label of the VF page created

Payment Method & Payment Term Fields

Page 24: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Lab Exercise 2 - Plugins

• In this Lab Exercise we will extend the behavior of the Quotes Details Page we created in the previous step by leveraging out of box QuoteDefaultPlugin

• The goal of this exercise is to demonstrate how ZuoraForSalesforce OOTB Plugins can help extend/enhance functionality.

Page 25: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Using Plugins – Lab Exercise

Notes – Modify the diagram – Quote Detail with Create Quote

Page 26: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Plugin - Lab Exercise Steps

1. Develop Apex Plugin (Code Provided)

2. Use Component Registration Feature under ZuoraConfig to extend the CreateQuote PropertyComponent

3. Create a new Quote to verify the Default Value Plugin works

Page 27: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Step 1- Create Apex Class

Under AppSetup – Click on Pages

Click on New to create a new Apex Class

Page 28: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

DefaultValuePlugin - Codeglobal class DefaultValueCreateQuoteComponent extends zqu.CreateQuoteController.PopulateDefaultFieldValuePlugin {

  global override void populateDefaultFieldValue(SObject record, zqu.PropertyComponentController.ParentController pcc) {    super.populateDefaultFieldValue(record, pcc);<<Query the value of the custom Region field>>If it is West    record.put('zqu__InitialTerm__c', 15);If it is east    record.put('zqu__RenewalTerm__c', 12);    record.put('zqu__ValidUntil__c', Date.today().addDays(30));    record.put('zqu__StartDate__c', Date.today());    record.put('zqu__PaymentMethod__c', 'Check');

    // The opportunity Id is populated from the parent method, use it here to retrieve the account ID    Id opportunityId = (Id) record.get('zqu__Opportunity__c');    Opportunity opp = [SELECT Account.Id FROM Opportunity WHERE Id = :opportunityId LIMIT 1];        // Find the contacts associated with the account    List<Contact> contacts = [SELECT Id, Name FROM Contact WHERE Account.Id = :opp.Account.Id];        // Assuming the contacts are present    if (contacts.size() > 0) {      System.debug('mp: about to add ' + contacts[0].Id + ' as a contact ID');      record.put('zqu__BillToContact__c', contacts[0].Id);      record.put('zqu__SoldToContact__c', contacts[0].Id);

      // Before retrieving the lookup options, needs to populate the map first      super.setLookupOptions(pcc);

      // Now retrieve the lookup component options      zqu.LookupComponentOptions billToOptions = super.getLookupOption('zqu__BillToContact__c');      billToOptions.targetId = contacts[0].Id;      billToOptions.targetName = contacts[0].Name;

      zqu.LookupComponentOptions soldToOptions = super.getLookupOption('zqu__SoldToContact__c');      soldToOptions.targetId = contacts[0].Id;      soldToOptions.targetName = contacts[0].Name;    }      }

}

Copy the code from this slide and paste it in the development editor

Page 29: Subscribed zuora forsalesforce training -section301-final

Lab Step 2Use Component Registration

& Extend Default PropertyComponent

Page 30: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Using Component Registration

Click on ZuoraConfig Tab

Select Component Registration

Page 31: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Extend the Default Value Plugin

Click on Edit Action for zqu:PropertyComponent for CreateQuote

Page 32: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Extend the Default Value Plugin

We will be extending the PopulateValuePlugin

Enter the name of the Plugin Apex class you created in the Class Name

Click on Update Button

Page 33: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Lab Step 3Create a New Quote

Page 34: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Create a new Quote and See the new Plugin in Action

Note the required values have default values populated.

Page 35: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

End of Section 301

Page 36: Subscribed zuora forsalesforce training -section301-final

#Subscribed14 @twittername

Other Component & Plugins Examples

In the previous two examples we just scratched the surface on what’s possible with components.

More code and examples can be found at:https://github.com/zuora/Z-Force/tree/master/ZDKSampleCode&http://knowledgecenter.zuora.com/CB_Commerce/Zuora_for_Salesforce/E_Z-Force_Builder/B_Component_Library