Limio gift code solution can be extended to cover the following B2B use case:
- You are a media company selling licenses for your publication. For example, a sales person sold 10 licenses for a 3 years Digital subscription to ACME Ltd on a discounted pricing.
- You want the sales person's Salesforce Opportunity to automatically create 1 gift code that can be redeemed 10 times by ACME Ltd staff.
- The gift code must redeem an offer with the special pricing defined by the sales person.
- The sales must be recorded into Zuora.
- The gift code will then be provided to ACME Ltd staff.
- ACME Ltd staff go to a /license-activation Limio page where they can redeem the gift code, set up their digital account and start enjoying their subscription!
Limio for Salesforce has the capability to enable a B2B process within a Salesforce Opportunity, that links Salesforce Opportunity Line items and Limio Offers and lets the sales agent checkout from within the Opportunity itself, with just a few clicks.
The concept of gift codes with a redeemable quantity can also be used to sell gift codes to redeem for multiple individuals (family/householding type of offers).
To allow maximum flexibility to our clients, the process implemented in Limio for Salesforce consists of a set of individual, standalone components that are exposed to Salesforce Flows.
The following is a guide that explains how to create the flow, which components to use, and in which order.
Prerequisite
To use of this process, the Salesforce org in which the Managed Package is installed must have the following:
- The process only works in the context of an Opportunity (standard Salesforce object) that has Opportunity Line Items related to it
- There must be a custom field on the Opportunity Line Item object, API name Limio_Offer_Code__c
- The Limio_Offer_Code__c field is the link between the Salesforce Product (Opportunity Line Item) and Limio Offer, so the same attribute must be configured in Limio at offer level. The field in Limio must be called "Offer Code"
- The Limio Offers used for this process must be configured as gift offers.
Flow creation
Once LFS is installed, create a Flow in Salesforce and perform the following steps.
Step 1
Create a new variable called recordId.
Use as default value the Flow's CurrentRecord value. This is used by the rest of the flow to hold the Opportunity Id.
Make sure the "Available for input" option is checked.
Step 2 - Offers Component
Add a new screen component to the flow, linked to the start of the flow. Drag and drop the custom component called "Limio B2B Offers Table".
Hide both header and footer for this component. Custom logic for the Next button is already built in in the component itself, so the out of the box next button of the flow will conflict with this.
Configure the component properties as follows:
- Offers: self reference the variable "offers" of the same component
- Record Id: variable created at step 1
Step 3 - Payment Component
This step supports two different implementation options:
- Use the built in LFS component, or
- Build your own component, capturing payment information as well as custom fields, to then be passed to the next Limio component. NOTE: this approach is recommended if additional custom fields are required to be captured and sent to Limio
Option 3.1 - use the prebuilt Limio B2B Payment component
Add a new screen component to the flow, linked to the Offers component created in Step 2. Drag and drop the custom component called "Limio B2B Payment".
Hide both header and footer for this component. Custom logic for the Next button is already built in in the component itself, so the out of the box next button of the flow will conflict with this.
Configure the component properties as follows:
- Offers: leave it blank
- Payment: self reference the variable "payment" of the same component
- Purchase Country: self reference the variable "purchaseCountry" of the same component
- Record Id: variable created at step 1
Option 3.2 - build a custom component
Unlike the first option, this approach allows to fully control the screen view, adjusting the list of field and their values.
Format the output in a way that the Limio components can consume. To easily format the object, import a build in apex method from the i42as namespace - i42as.B2BPayment.getB2BPaymentStructure - into a custom LWC, and expose this as a variable to the flow.
The following is an example of how to use custom apex code to build an instance of a B2BPayment class
i42as__B2BPayment.getB2BPaymentStructure(Map<String, String> customFields, Map<String, String> paymentAddress)
Example parameters:
customFields = {
"Company_Name__c" : "Limio"
};
paymentAddress = {
"country": "IT"
"state": "Verona"
"city": "Verona"
"address1": "Via Cappello, 23"
"postalCode": "37121"
};
After this is built, it must be passed to the following component, see next step.
Step 4 - Summary Component
Add a new screen component to the flow, linked to the Payment component created in Step 3. Drag and drop the custom component called "Limio B2B Order Summary".
Hide both header and footer for this component. Custom logic for the Next button is already built in in the component itself, so the out of the box next button of the flow will conflict with this.
Configure the component properties as follows:
- B2B Payment: to be used if custom payment has been built at step 3, see 3.2. Pass a variable of type i42as.B2BPayment in here
- Contact: not part of the LFS flow, however if a contact record is retrieved using the built in flow functionality "Get Record" then it can be passed here. Passing a contact to this parameter will ensure that the order is received in limio with contact information (for example, email)
- Deprecated: Payment: only use this if B2B Payment isn't used, see step 3.1
- Offers: use the "offers" property passed from the Offers component created at step 1
- Order Response: self reference the variable "order_response" of the same component
- Purchase Country: use the "purchaseCountry" property passed from the Payment component created at step 3.1. If custom payment is used instead (step 3.2) a different country needs to be mapped
- Record Id: variable created at step 1
Step 4 - Order Results Component
Add a new screen component to the flow, linked to the Summary component created in Step 4. Drag and drop the custom component called "Limio B2B Order Results".
Keep the footer as this component uses the standard Finish button of the Flow. Previous and Pause buttons should be hidden as the flow currently doesn't support them.
Configure the component properties as follows:
- Order Response: use the "order_response" property passed from the Summary component created at step 4
Testing the Flow
The following test is performed using the built in LFS component for the payment.
Once the flow is saved and activated, it should look something like this:
This flow is now ready to be used as a custom action or standalone component in the Lightning App Builder.
Create an Opportunity Action that invokes the flow, and add it to an Opportunity page Layout.
When the custom button that starts the flow is clicked, the following screen is displayed
- The number of entries in the table matches the number of opportunity line items for the opportunity
- The column Offer Code shows the value of the custom field Limio_Offer_Code__c for the opportunity line item
- The Limio Offer column shows the matching Offer retrieved from Limio using the same Offer Code identifier. A dedicated message will inform the user in case there is no match for the Offer based on the Offer code
- If the matching offer isn't a gift, a dedicated message will be displayed to the user
- Unit Price and Quantity are retrieved based on what's specified on the Opportunity line item entry. The Limio Offer price is ignored and not used in this context.
- Quantity field is read-only by default, to make it editable set the Allow Multibuy attribute on the relevant Limio offer to true.
The Next button will be disabled and the user won't be able to proceed if at least one of the following is met:
- The flow is used in a context that isn't a Salesforce Opportunity
- The Opportunity has no line items related to it
- There is at least one Opportunity Line Item for which the offer code is missing, or it's not matching any Limio offer (either no offer or an offer that isn't a gift)
- One of the input fields is left blank e.g. price, or quantity specified is either 0 or negative
Once the user is happy with the first step, they can click Next and be redirected to the Billing Information screen in the next step:
Billing country is set as Italy by default. The only payment method available is the B2B one. In here, all of the B2B fields required are retrieved from the Account that is linked to the Opportunity; all of the fields are editable, however should any of them be updated in this screen, the update won't be reflected on the parent account record; it is recommended that any change to a custom field is done on the source record, to persist it for future use. Note that LFS won't validate any of these fields, so if they're missing or incorrect the user won't be notified and they'll be able to continue and checkout anyway. Moreover, formatting isn't also enforced, so fields like Province or VAT number or fiscal code must be in the correct format, to avoid the payment failing.
A new editable field is added to this screen "Determina/Ordine Cliente". This is a free text field, not required.
The next button is always enabled, there's no logic for disabling it.
The next step is a summary of the order, with the ability to submit it.
Once submitted, a dedicated screen will inform the user whether the order was successful or not.
VERSION COMPATIBILITY: This functionality requires LFS v11.23 or later to work.
Comments
0 comments
Please sign in to leave a comment.