Automating Salesforce CPQ Testing

Automating Salesforce CPQ Testing

Salesforce CPQ(Configure-Price-Quote) solution from Salesforce is based on the Lightning experience. It has some of the elements that account for a challenge – that of standard automation methods, of the likes of using Selenium. 

CPQ is native for Sales Cloud or Service Cloud orgs. We need to come down to the brass stacks of “Why automate Salesforce CPQ testing?”. 

Why automate Salesforce CPQ testing? 

As we all know that Salesforce comes up with three automatic upgrades in a year and the same applies for CPQ too. So, it is quite a difficult proposition for the testers to test the CPQ features manually. It becomes a tedious and uphill task for the testing team. 

Moreover, the CPQ is a complex product and it is indeed a time-consuming task for the testing team. So, here is where enters the automated tests. They serve the best way to achieve predictable and repeatable assessments of the quality of the custom code, in question. If you need to know “How helpful are the automated tests?”.

Then without any hesitation, we must state that the automated tests quicken the process of getting feedback. This feedback is on the quality of the custom code. 

We would also like to highlight some of the challenges of Salesforce CPQ. Let us discuss some of these challenges.

Salesforce CPQ Field locators

It is difficult to handle Salesforce CPQ testing, while used with the traditional automation methods of the likes of Selenium. The Salesforce CPQ pages are said to make heavy use of shadow DOM. This is made accessible with CSS  locators – not with Xpaths or even Field IDs. However, the CSS locators are unable to match with texts. So, it becomes difficult to locate shadow DOM elements. 

Salesforce CPQ tabs and tables

The Salesforce CPQ pages have yet another issue. This pertains to the internal tab, controlling the fields and tables, visible under the tab. Since it requires an awareness of “active tabs”, it is difficult to control by Selenium. 

The right fields are not to be found, on selecting the wrong tab. This leads to test failures. 

Quote Line Editor Drawers

The Quote Line Editor Drawers can be used in quote line editors. This allows to better handle a large fieldset. The fields which are placed in the collapsible drawer below the line item can be accessible by clicking on the arrow, appearing at the end of the quote line. The arrow must be at the end of expanding settings, for accessing the fields below. Otherwise, it becomes difficult to handle this situation.

In this post, we will provide insights on the different types of automated tests for Salesforce CPQ and will throw some light on the guidelines for writing automated tests. 

What are the Different Types of Automated Tests for Salesforce CPQ?

The various types of automated tests for Salesforce CPQ are:

  • Apex Tests
  • CPQ API Tests 
  • Selenium Webdriver UI Tests
  • Lighting Component Tests

Apex Tests

Apex tests run automatically, before and after the upgrades. There are many ways by means of which Apex tests can be used in Salesforce CPQ. Some of the examples to cite are – ordering, contracting, amending and renewal flows. In addition to this, it covers any functionality related to subjects. However, CRUD, UI and REST services are out of the scope of Apex.

Here is a code snippet on a sample Apex test. 

CPQ API Tests 

The API helps to test the REST-based services on Heroku. The CPQ API tests are useful to test:

  • Quote Calculator Plugins
  • Quote Calculate Functionality
  • Document Generation

Here is a code snippet on a sample Apex test. 

Webdriver UI Tests with Selenium 

Browser actions can be automated by writing tests with the Selenium framework. However, Selenium tests are only to be recommended for the complex workflows, because these are expensive to run or maintain. 

These tests can be specifically recommended for client-side features and end-to-end workflow. The tests also get modified with changes in UI. 

Finally, the Page Object patterns encapsulate the locators and operations – all in a single class. This is used to reduce maintenance costs and enhance readability.

Here is a code snippet on Selenium Webdriver for the CPQ QuoteLineEditor.

Lighting Component Tests

In the case of Lightning components, Lightning Testing Services(LTS) can be used to create test suites for the LIghtning components. This uses standard Javascript frameworks such as Jasmine and Mocha. The built-in features of LTS are extremely beneficial to write these tests. 

Salesforce CPQ is built on the Lightning platform and seamlessly integrates with many of the Sales Cloud features. The automation strategy evolved must behave layers to map the layers in the CPQ. Here are some of the best practices on writing automated tests.

Best Practices on Writing the Automated Tests 

Test at the Right Layer

The tests must be written at the right layer. A CPQ REST API test is written, if you need to write a test on a calculation. Otherwise, simply write a component test for a custom UI component. 

Carry Out Mutually Exclusive Tests

The tests must set up the applications specific to the needs and has to be cleaned up, once completed. The test results produced must be the same – irrespective of the size of the test- a small or a large set of suites. However, the set up is varied, when it is complex or cost-prohibitive for automation. 

Follow Single Level of Abstraction Policy(SLAP)

The test case must have the ability to do everything that is required,  whatever it might be – data set up, helper methods and utility.  

Limit to a Few Assertions

A test has only one thing to evaluate, so assertions must be limited to one or more only. When running tests that are expensive, it is important to remember that tests need to be split and a threshold used for the same purpose. Usually, three assertions is a good threshold. This is more so for a Black Box. 

Summary 

Salesforce comes up with three upgrades in a year, so the testers find it an uphill task to manually test the features of CPQ. Since CPQ is a complex product, so the testers will find it time-consuming. The automated tests quicken the process of providing feedback on the quality of the custom code, written for the purpose. There are various types of automated tests for Salesforce CPQ and testers need to adhere to some of the best practices on testing the Salesforce CPQ.

How to undertake SAP and Salesforce Integration

How to undertake SAP and Salesforce Integration

The rapid adoption of Cloud Computing is impacting how enterprise applications are developed, distributed, and implemented. This development has implications for both the IT industry as well as enterprises.

The typical characteristics of enterprise software are complexity, data dependency and security and they focus on three areas: the platform, collaboration, and co-evolution.

The original idea for SAP was to provide customers with the ability to interact with a common corporate database for a comprehensive range of applications this has undergone a significant change over a period. Salesforce started off as a cloud-based customer management company though it has also expanded its solution stack significantly.

SAP S/4HANA- SAP S/4 HANA has a Cloud-based ERP offering that transforms SAP from an on-premise platform into a Cloud-based solution. This solution can be deployed either as a public Cloud or as an on-premise deployment.

Public Cloud designed for companies that have less restrictive data security and segregation policy and need integration that addresses the core business processes.

Salesforce – Salesforce revolutionized the CRM software market by developing a SAAS based CRM. Salesforce CRM has features that address most of the customers’ requirements. Force.com is a recent PaaS offering from Salesforce and offers developer several tools to develop and deploy their applications. The advanced apps distributed through the market platform AppExchange. AppExchange applications are web-based applications that interoperate with the Force.com platform and quite often Salesforce CRM. With both Salesforce and SAP entrenched within the enterprise there seamless integration has been an area of focus for corporations.

SAP Integration methods are Netweaver and Non-Netweaver based like BAPI/ ABAP/ IDOC ALE Inbound/Outbound Web services Netweaver XI/PI SAP BW/BI (ODBO, OLAP BAPI, XML for Analysis/XMLA) ABAP Connector & Batch-Input Connector.

Integrating with Salesforce Integration Platform provides third-party platforms capabilities for automated integration with the Salesforce API including objects, CRM metadata, bulk jobs, replication and lead conversion.

A business process integration solution allows corporations to perform all the required functions with objects. When working with Salesforce.com metadata, an organization needs to validate the status of any metadata operation at any time.

For corporations which have both SAP and Salesforce implemented the benefit of Integration are many, this combination is utilized to synchronize information between the two frameworks. For example, when data integrated into Salesforce, it is essential that this information is accessible in a synchronized way for finance, administration, and other business functions managed by SAP. Whenever SAP and

Salesforce is well integrated, and organizations can streamline and automate their business processes.

A significant advantage of this integration is reduction of manual data entry, fewer information redundancies, and mistakes caused by manual information

Undertaking data-integration predominantly did through either Extract-Transform-Load or Enterprise Application Integration tools. ETL approach involves data uploads in batches into Salesforce, or from Salesforce into data warehouses.  Batch uploads happen at regular intervals which can be hourly, daily or some other frequency. EAI is a complex event-based approach, where data ingestion occurs very frequently from external systems into Salesforce.

Conventional integration scenarios have been resource intensive and complex. Collaborative, point-to-point integration, for example, has been used at times as a rapid solution for SAP and Salesforce integration.

Service Oriented Architecture is an approach that can be leveraged to incorporate SAP and Salesforce. While SOA stacks enable free integration between applications and give corporations flexibility to address changes. Developing a full SOA stack for a large enterprise application requires high expenses and significant time to prepare.

Undertaking SAP and Salesforce integration require addressing of several issues which include aspects like identifying connectors and interfaces security, and the center approach you’ll take. There are multiple options to undertake integration. Designed and delivered right all solutions can work, but every opportunity has its scenario of risks, expenses, and tradeoffs. The idea should be to use the approach best suited to a corporation’s requirements.

When integrating SAP with Salesforce.com, a corporation needs to consider factors like network infrastructure, information flow, and data exchanges.

One of the ways to integrate SAP with Salesforce is by using the Sales Lightning component to undertake this integration.

Another viral mechanism leveraged by corporations is to undertake integration leveraging Informatica ETL functionality which enables an organization to set up a client synchronization with a wizard-based interface.

A new approach that is increasing in popularity is that of API driven integration and a leading solution in this domain is Mulesoft, the advantages of undertaking integration using this method is that building a scalable solution is easy in comparison to other approaches. With APIs, developers can integrate with endpoints and make connections without needing to have a deep understanding of disparate systems.

To wrap up

Remember, integrating Saleforce.com to SAP is essential since there is a central need to bring these frameworks together to meet the prerequisites of the business. Integration projects have been very specialized, challenging and costly to execute, a reason corporation frequently stayed away from this leading it to it hamper business. Once this integration initiates successfully, it becomes easy for organizations to exchange data seamlessly.

Salesforce Google Map Integration

Salesforce Google Map Integration

We are Salesforce™ Experts and we channelize our energy by documenting all the industry-specific technical problems we solve in Salesforce™ CRM world. Here I am about to explain one of the Google Map API with Saleforce.com custom development projects I was closely involved as a Salesforce™ Developer. At, below I will provide you the brief description of the project what basically it is and how we helped our end client.

Requirements:-

In, this Project Client basically need a system viewer where he can calculate a distance between the source and the other records. The basic agenda of this project to help our end client where they will help their customer and they can identify all the machine from the source of Account.

The original idea of the project is that from a single Account record Source we need the ability to produce a list of other accounts. Account records that fall within a certain proximity radius to that account is a list of accounts that result from the search ‘Proximity’ accounts.

The account in the system could potentially be a source account. The user initiating the search from the Source account would first need to populate a screen showing various criteria information. Such criteria would include a ‘Radius’ setting we will provide the initial default value but we will need the ability to override.

Additional criteria would include two or three custom fields these currently exist on the Account record. It will provide default values for each but we will need the ability to override.

It is not mandatory that the list of Proximity accounts display in map form. If the Proximity accounts are displayed in a list, and not on a map, it is important that we can see the distance in miles from each Proximity account to the Source account.

We came with the solution:-

In,this what we acknowledge that from the list of account we can identify certain set of machines from the source to the estimate miles and can find out the list of machines from the source with different cost and it would ease to identify the certain machine from the list of miles and also it can be identified from the last sale day ago which we can filter from all the above source and then click on search. From this, it provides two option 

1-Generate pdf
2-View Map

Generate Pdf:- From this Option Customer after selecting their choices they will click on this option and they will get the detailed report within the Pdf.

View Map:- It provides the viewer to identify all the destination location of the products and analyze the certain destination via this map.

 

 

Now, with the following screenshots its methodology can be understood as follows:-

1) Search Filter with the various criteria

 

It can be understood with the following Code Snippets as follows. These are the few components which we deployed to the production.

1. Show All Account on Filter Controller:-

From below code, we are able to distinguish how to multi-select the option which is available on the filter-

public with sharing class ShowAllAccountOnFilterController {

public String recordID{get;set;}

public Account Sourceaccount{get;set;}

public double Last_Sale_Days_Ago{get;set;}

public list<Account> accountList{get;set;}

public list<Account> accountlistSearched{get;set;}

public list<Account> accountlistSearched1{get;set;} // list will show on map

public list<wrpclass> SearchAccountListWithMiles{get;set;}

public list<String> accountpicklistvalue;

public list<String> seletectedaccountpicklistvalue;

public boolean listisempty{get;set;}

public boolean showiflistfilled{get;set;}

public  String headerdata{get;set;}

At below there is a description of the above model with the ER Diagram

 

 

 

 

Demand Tools

Demand Tools

What is Demand Tools

Demand Tool is the leading data quality & data cleansing toolset for salesforce.com customers worldwide. Demand Tools is a suite of 10+ individual data quality modules to control, standardize, de-duplicate, import and generally manipulate Salesforce and/or Force.com data. Designed to work in the Developer, Professional, Enterprise and Unlimited versions of Salesforce. Demand Tools is a client-based application that Salesforce administrator’s install on their Microsoft Windows computer.

How to install Demand Tools:-

Step 1: Go to https://www.crmfusion.com page.

Step 2: click on Download Trail Tab.

Step 3: Download Demand Tools 2.7 (32 bit or 64 bit).

Step 4: Double click on Demand Tools Setup and follow the instructions step by step.

After Successful installation, a window appears like below:-

Now if you want to use Demand Tools with your sandbox for a trail, first you need to click on Proxy/Endpoint Setup and then click on Use Custom Endpoint checkbox and Enter your custom Endpoint and press OK Button and then click on Sandbox Login Checkbox and then enter your Salesforce Username and password and then click on Login to Sandbox Button.

Note: Custom EndPoint Like-  https://test.salesforce.com/services/Soap/c/39.0
After this, a new window has opened like below:-

Here, enter your Salesforce.com Organization ID and after filled this, click on Create Trial Account Button. This trial account is valid for only five days from created date.

Demand Tools Modules

The Demand Tools has the number of modules but some important modules are described below:-

The Demand Tools MassImpact module is used to modify hundreds or thousands of EXISTING records WITHOUT importing or exporting. Like, update shipping addresses fields with data from the business address fields. This module can be used to perform data standardization functions to normalize data across records and Transferring account address information to associated contacts and Concatenating field values from multiple fields into one. You can create and save custom scenarios for future use.

The MassEffect module is used to perform Insert/Import, Update, Upsert, Delete, Export operation within Salesforce. This Module is used for many important cases like if you want to Migrate data from legacy systems to Salesforce and Insert Salesforce Content that resides locally on your PC (in .csv file) and you can create and Save field mapping for future use by creating the template which is used for all imports and updates.

Power Grid module is used to update mass records with an easy to use grid based view of the data.  Here, Fields can be updated directly inside the grid with the ability to review all changes before pushing the updates to Salesforce.  It is primarily designed for use with a maximum of about 20 K records at one time.  If you have recorded more than 20 k you can also use this but it takes more processing time. You can also perform delete operation on records within Salesforce.

The Reassign Ownership module can be used to mass transfer the ownership of ANY object in Salesforce and its related sub-objects in a single pass using either a set of user-specified conditions or an input file of ID’s to determine which records should be reassigned.  A single new owner can be specified, or a group of records can be assigned to multiple new owners, either randomly or by specifying match conditions. You can also Create Tasks or Summary Events to track ownership changes on the parent object record.

The Demand Tools MassBackup module allows the user to take backup with user-friendly interface and it creates a .mdb backup file of Salesforce data on your local computer.  The .mdb database that is created is fully relational and useful for different types of integrations. This module is supported with the 32bit version of Demand Tools. But the overall size of the resulting .mdb file also cannot exceed 2GB.

BulkBackup module also used for backup your Salesforce data but it uses Bulk API to export the data and save to .mdb (32bit only) or .csv files. It has user-friendly interface and this module will not work for Salesforce Professional Edition (PE) Users because BULK API is not supported by Salesforce in Professional Edition.

Report Edit module is a simple module that provides access to all custom Salesforce reports allowing for some basic operations to be performed like Rename Reports, Update Report Descriptions and Delete Reports. Only users with “Modify All Data” on their Salesforce Profile will be able to use Report Edit due to Salesforce’s complex report permission structure.

How We Can Use Third Party JavaScript Libraries With Lightning Components?

How We Can Use Third Party JavaScript Libraries With Lightning Components?

Third-party Libraries are used by most of the developers nowadays because Third-party libraries provide quick and easy work around that can save you a lot of time and help you avoid some lines and efforts while writing codes.

Third-party libraries usually fall in one of the following categories:

  1. DOM manipulation libraries ( ex. jQuery, etc.)
  2. Specialized Utility Libraries (ex. moment.js, numeral.js, etc)
  3. UI Libraries (ex. Bootstrap, jQuery UI, etc.)
  4. Data Visualization Libraries (ex. D3, Chart.js, Leaflet, etc.)
  5. MVC Frameworks (ex. React, Angular, etc.)

How to use third party libraries in lighting components-

There is a whole lot of powerful features which are provided by the Lightning Framework. In lighting components, Functionalities by your library might not always work.
In lightning component, we need to add these libraries to a static resource, and then we can include the library by using tag <ltng:require>
Upload everything in zip format under static resources. And use them in <ltng:require> tag.

Example:-

&amp;lt;ltng:require styles="{!$Resource.YourCSSResource}" scripts="{!$Resource.YourJSResource}" afterScriptsLoaded="{!c.afterScriptsLoaded}"/&amp;gt;

afterScriptsLoaded attribute is used to execute some javascript method after the script is loaded.

USE SCRIPTS
To include a JavaScript library that you’ve uploaded as a static resource, use a <ltng:require> tag in your .cmp or .app markup.
Using styles attributes, you can include the .css resources into the component or app and be using scripts attribute you can include the javascript resources into the component or page.

Here is an Example of aura component:


&amp;lt;aura:component&amp;gt;
&amp;lt;ltng:require styles="{!$Resource.YourCSSResource}" scripts="{!$Resource.YourJSResource}" afterScriptsLoaded="{!c.libLoaded}" /&amp;gt;
&amp;lt;div class='mynamespace'&amp;gt;
&amp;lt;div class="dropdown"&amp;gt;
&amp;lt;ul class="dropdown-menu" role="menu" aria-labelledby="mLabel"&amp;gt;
&amp;lt;li role="presentation"&amp;gt;&amp;lt;a role="menuitem" href=""&amp;gt;Action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
&amp;lt;li role="presentation"&amp;gt;&amp;lt;a role="menuitem" href=""&amp;gt;Another action&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/aura:component&amp;gt;

Class mynamespace, dropdown, dropdown-menu would be defined into the libraries.This is the method of how one can use JS Function which will always execute after loading of the script.


({
libLoaded: function(component, event, helper) {
alert('ready to go');
}
})

Here is the example of JQuery sortable. We have to add the JQuery resource in the page and use functions to perform the functionality.

Use CSS FRAMEWORKS

You can use bootstrap classes for CSS. After adding the Bootstrap resource, you need to add the class on the element.

Steps to include bootstrap in your lightning:

  • Download the salesforce.com optimized Bootstrap package.
  • Unzip that package and go to Setup > Build > Develop > Static Resources and click New.
  • Specify bootstrap as the Name, then click the Choose File button, and select the bootstrap.css in the dist/CSS directory of the unzipped bootstrap folder.

After adding bootstrap in static resources, you can use the classes of bootstrap to your component elements.
Ex:


&amp;lt;div class="navbar-header"&amp;gt;
&amp;lt;a href="#" class="navbar-brand"&amp;gt;Accounts Details&amp;lt;/a&amp;gt;
&amp;lt;/div&amp;gt;

So, this is how you can implements the standard UI by third-party libraries with your lightning components.

Pin It on Pinterest