Description
The SFQueryGen Generator queries a column of data from a Salesforce Object. The query takes place in realtime via a Salesforce REST web service call.
In This Article
- When should the SFQueryGen be used?
- When should the SFQueryGen not be used?
- How does SFQueryGen work?
- Generator Parameters
- Use Case 1 - Query an Account Object for the Account Name
- Use Case 2 - Query an Account Object for the Account ID
- "How to" Video Example
When should the SFQueryGen be used?
- Any time a set of column data needs to be queried from a Salesforce Object and blended with synthetic data.
When should the SFQueryGen not be used?
- Any time data needs to be queried from a source other than a Salesforce Object.
How does SFQueryGen work?
The SFQueryGen Generator does the following:
- Uses a provided Query Statement to query any column of data from a Salesforce Object via REST web services.
- Queried data is cached so that when it is previewed, it does not go out and query the same data again.
- However, when the actual Scenario is run, the data is re-queried during realtime data generation.
Generator Parameters
The following parameters may be configured for the SFQueryGen Generator. Items with an asterisk* are required.
- serviceVersion* - Defines the Service URL version number. The current default is 34.0 and can be changed if needed.
- sortType* - Defines the order in which the data may be sorted.
- setLoop* - Defines whether the size of the list should be used to set the Scenario loop value.
- waitAmount* - Defines the number of iterations the Generator should wait before moving to the next value in the list.
- seed - Defines an optional seed for randomization. It guarantees that the same random value will be generated each time.
- grVar1 - Defines the first optional variable that can take the place of a constant in the SOQL statement.
- grVar2 - Defines the second optional variable that can take the place of a constant in the SOQL statement.
- grVar3 - Defines the third optional variable that can take the place of a constant in the SOQL statement.
- query* - Defines the SOQL statement that will be executed to retrieve a column of data.
- list - Caches the values of the Salesforce pickList. This way, the pickList data is only retrieved via Salesforce REST web services when an Attribute with a pickList is first created or when a user clicks the Save Generator button on the Attribute using the SFQueryGen.
Use Case 1 - Query an Account Object for the Account Name
This use case shows how the SFQueryGen Generator can be used to query a Salesforce Account Object for the account name.
Step 1 - Create a Project with a Domain
For this example, a Project titled 'SalesforceDemo' has been created with the default Project Version and an 'Account' Domain.
NOTE: Click here to learn about creating Projects. Click here to learn about creating/importing Domains into GenRocket.
Step 2 - Create an Attribute for Querying the Salesforce Object
For this example, an 'accountName' Attribute has been created for the 'Account' Domain.
NOTE: Click here to learn more about creating new Attributes for a Domain.
Step 3 - Assign the SFQueryGen Generator to the Attribute
A Generator will be automatically assigned by the data warehouse when an Attribute is created. In this case, the NameGen Generator was assigned and will need to be replaced with the SFQueryGen Generator.
This can be done by completing the following steps:
- Enter SFQueryGen into the Quick Replacement menu.
- Click the Replace button once finished.
Step 4 - Configure the SFQueryGen Generator Parameters
For this example, two Generator parameters have been modified:
- grVar1 = Name
- query = select grVar1 from account order by id
Step 5 - Save the Generator Changes
Click Save Generator after making changes to Generator parameters. GenRocket will automatically run the query and return a set of account names.
It caches the first ten rows of the data set that is returned. This provides a set of cached account names that can be previewed with your test data.
NOTE: Clicking Save Generator again will re-run the query.
Use Case 2 - Query an Account Object for the Account ID
An Account Object will be queried for a set of account IDs. The queried set of account Ids will be cached for instant previewing with test data in GenRocket.
NOTE: Please note that the same steps are followed as gone over in the previous example. Only the Attribure name and Generator parameters have changed.
An 'accountId' Attribute has been created for the Account Domain.
These Generator parameters have been changed:
- grVar1 = id
The query will be run when Save Generator is clicked. Now, a set of account IDs are queried and cached. From this point on, this set of account IDs can be previewed with your test data.
"How to" Video Example
The "How to" video below also shows the above use case. Please note that this video's user interface is outdated, but the setup, generator parameters, and flow have not changed.