Description

This article shows how you can use GenRocket to dynamically generate Master-Detail & Lookup Data for Salesforce. In this article, you will learn how to: 

  1. Set up a Master-Detail relationship for Account-Asset.
  2. Set up a Lookup relationship for Assets to look up Products.
  3. Create a Scenario and dynamically generate & insert Asset data into Salesforce.


Note: The Scenario will generate and insert 20 accounts, have 3 assets associated with each account and 1 product associated with each Asset.


In This Article


Example Story

This story has the following three Domains (i.e., Salesforce Objects): 

  • Account
  • Asset
  • Product2


Step 1 - Change the Account Domain loopCount to 20

  • Within the Project Dashboard, click on the Account Domain in the Domains pane.


  • Click on the Edit (Pencil) icon for the global.Account.loopCount variable.


  • Enter 20 as the value.

  • Click the Save button to save the change.


Step 2 - Configure the SFQueryGen Generator for the id Attribute

The SFQueryGen Generator will be used to query for the 20 required Account IDs.

To configure this Generator for the accountId Attribute, complete these steps:

  • Click on the id Attribute within the Domain Dashboard.


  • Type SFQueryGen to replace the currently assigned Generator.

  • Click the Replace button.


  • The Generator configuration is shown below with the following changes: 
    • seed = global.Account.seed
    • grVar1 = Id
    • query = SELECT grVar1 from account order by Id limit 20

  • The SELECT statement will dynamically query the first 20 Salesforce Account IDs in real time.

  • Remember to click the Save Generator button after making any changes.


Step 3 - Configure the SFQueryGen for the productCode Attribute

The SFQueryGen Generator will be used to select the Product IDs we want the assets to look up.

  • Click on the productCode Attribute in the Domain Dashboard.


  • Type SFQueryGen to replace the currently assigned Generator.

  • Click the Replace button.


  • The Generator configuration is shown below with the following changes: 
    • seed = global.Account.seed
    • grVar1 = Id
    • query = SELECT grVar1 from Product2 order by Id limit 15

  • Remember to click the Save Generator button after making any changes.


Step 4 - Change the Asset Domain loopCount

  • Within the Project Dashboard, click on the Asset Domain in the Domains pane.


  • Click on the Edit (Pencil) icon for the global.Asset.loopCount variable.


  • Enter 3 as the value.

  • Click the Save button to save the change.


Step 5 - Set the Master-Detail Relationship between the Account and Asset

In GenRocket, this relationship is referred to as the Parent-Child Relationship. Complete the following steps: 

  • Click the Relationship Tab when viewing the Asset Domain in the Domain Dashboard.


  • Click the Add Referential Parent button.


  • Tick the radio button for the Account Domain.

  • Click the Save button.


Step 6 - Set Up the Asset Relationship to the Product

In GenRocket, this is referred to as a Sibling Relationship.

  • On the Relationship Tab, click the Add Referential Sibling button.


  • Tick the check box for the Product2 Domain.

  • Click the Save button.


Step 7 - Build a Scenario using the Scenario Wizard

The Scenario Wizard will use the above relationship information to build the Asset Scenario.

  • Navigate to the Domain Dashboard.

  • Click the New Scenario button.


  • Enter a Name for your Scenario.

  • Click the Next button.


  • Click the Create with Primary Domain button.


  • Tick the radio button for the Asset Domain.

  • Click the Next button.


  • Click the Yes button to finish creating the Asset Scenario using the referential relationships set up in previous steps.


  • Click the Yes button to add referential integrity.


  • The Scenario will appear as shown below:


Step 8 - Dynamically Generate the Asset Data and Insert it into Salesforce

  • Click the Execute From Web button.

  • The data will be dynamically generated and inserted into Salesforce in real time.


  • Once the data has been generated, you can immediately go into Salesforce and see the results. 



Video Training

The following video shows the same steps as above. Please note that the screens may vary due to version differences.