Setting up AccelQ to access Salesforce Database

|
| By Webner

While working on any project based on Salesforce and using AccelQ to automate the flow, there are certain scenarios where we might need to use SOQL queries to get data instead of writing a script to get the data directly from the UI. It saves time and effort for QA Engineers. But before using the SOQL queries in AccelQ we need to understand how to set up properly and what are some of the basic approaches we can use.

How to Set Up?
Setting up AccelQ to execute the AccelQ queries is really simple, to start with we only need three things from any salesforce Org:

  1. URL
  2. Username
  3. Password

For URLs, we can use “https://login.salesforce.com” or “https://test.salesforce.com” depending on the type of environment. The same goes for the Username, we can use the username we enter while logging in to the org manually.

For the Password, we need to use the password we use to log in manually and the security token for the related salesforce org.

To obtain the security token from the salesforce, click on the user icon and then click on the settings right under the user name, then click on Reset the Security Token on the left side, you will receive an email including that security token.

Setting up AccelQ

Once we have all these things, we can head on to AccelQ and create an action to start working with SOQL queries.

Creating SOQL Action in AccelQ

After creating a new action, type “soql” and it will automatically show a few commands we can use. Let’s go through the first three statements as these are the most used ones.
token1

  1. Define Salesforce Query Connection (SOQL/SOSL): We can use this statement to set up our connection.
    token2
    Here, SOQL URL Instance, SOQL Username, and SOQL Password are global properties that we can use across orgs or differently for each org. We can use exact values for the URL and username except for the password. For the password, we need to use the Salesforce Org password+security token. While creating these global properties, we can encrypt the password directly with AccelQ tools and use that.
  2. Execute Salesforce Query: We use this statement to run the SOQL queries.
    token3
    We can use the queries we use in the developer console on the salesforce here.
  3. Get Field Value from Salesforce Query Result: We can use this statement to get the results from an executed query.
    token4
    We can use the query reference name to get the results from that query, we can use row number and column number to get the data from the results, and we can also use column name instead of column number. However, one limitation is that this statement will only record a single result so if we have multiple rows of results, we can use collection lists to store the data and then use it in the actions.

Some of the best Approaches:

  1. Use global properties from credentials so we don’t have to change actions directly every time we run the script in different orgs.
  2. If there are certain record types like in Accounts or contacts in salesforce that may have the same names, it is best to use the record Id.
  3. Use collection lists to store multiple rows of the SOQL query results.
  4. Always make SOQL actions separate from UI script actions to use the same SOQL actions within other actions
  5. Always make SOQL action a library action to use in any activity within any context.

Leave a Reply

Your email address will not be published. Required fields are marked *