You are here: Master-Detail scripts > Master Detail: Download data

Master Detail: Download data for multiple objects

You can download data from linked objects to multiple sheets in a workbook and then use those sheets to update or upsert data to Salesforce. Or, for reports, you can download data to a single sheet.

Tip: If you are downloading data to a single sheet and you want the master object data to appear in every row, click File, click Options, click Run Settings, and then check the Repeat Master rows in download all to single sheet box.

  1. Click the File tab, and then click New.
  2. Click Query.
  3. Under Select operation type, click Master Detail.

Log in

Studio for Salesforce offers three ways to log in: Web Login, Autologon, and Credentials. For Web Login, you do not need to provide a security token.

If you need to schedule a task, click the Client Login tab and log in using a stored autologon name, or click Credentials and set up a new autologon name.

Web login

  1. Click the Web Login tab.
  2. Click Read Session Data.
  3. In the Environment list, click Production, Sandbox, or Custom.

    Studio for Salesforce provides the URL for the production or test environment. If you choose Custom, type the URL for the custom environment.

  4. Click Go.
  5. Type your user name and password and then click Log in to Salesforce.
  6. Click Login or Okay.

Use Auto Logon credentials

To log in with stored credentials, click the credentials you that you want to use, and then click the OK button or the Login button.

Note: If you want to change your password or security token, click Edit, make the changes, and then click the Login button.

Log in with credentials

If you do not have auto logon credentials stored in Studio for Salesforce, do the following:

  1. Click Credentials, and type your email address, Salesforce password, and security token.
  2. For the Login URL, choose an environment.
  3. Check the Autologon Name box, and type a name for the auto logon credentials.

Choose the objects

  1. Click Standard Objects, and then click the Salesforce object that you want to create records for.

    If you do not see the object in the list, click All Objects, and type name of the object that you want.

  2. Under Select Detail Objects, check the boxes for the objects you want to link.
  3. If you do not see a detail object in the list, search for the name of the detail object that you want.

    Note: Studio for Salesforce uses the joins that have already been created in Salesforce. It is not possible to create custom joins in Studio for Salesforce.

  4. Click Microsoft Excel - Column Based Mapping or Microsoft Excel - Cell Based Mapping. For more information about cell-based mapping, see Use cell-based mapping.
  5. Click Next.

Map the fields

When you click Next, Studio moves to the Map tab, which includes:

  • Mapper: The Mapper contains the fields you can select and the Value column.
  • Data File Preview: The Data File Preview displays a preview of the Excel worksheet where the fields selected from Mapper are mapped.

    The Data File Preview includes a sheet for each object that you chose, mapped to its corresponding tab in the Mapper. The master object is always on the leftmost tab.

Map the fields to multiple sheets

  1. In the Mapper, on the first tab, select the check boxes for the fields that you want to include in your script.

    To find a field quickly, type it in the Search box. After you select the fields you want, return to the full Mapper by deleting the text in the Search box.

    Tip: To select all the fields in a group, select the group-level check box.

  2. Map each field to the Excel worksheet by doing one of the following:
    • On the ribbon, click Auto Map.
    • Type the Excel column name that corresponds to each field in the Value column in the Mapper.
    • Drag the field from the Mapper to a column in the Data File Preview.
  3. Repeat steps 1-2 for each object that is in your script.

Map the fields to a single sheet

  1. In the Mapper, click the tab for the second object.
  2. Click the arrow in the Map to Sheet box, and then click the sheet that is used for the first object.
  3. Repeat steps 1 and 2 for any additional objects.

    choose sheet1 for each object tab

  4. Click the tab for the first object, and then check the boxes for the fields that you want to include in the query.

    To find a field quickly, type it in the Search box. After you select the fields you want, return to the full Mapper by deleting the text in the Search box.

    Tip: To select all the fields in a group, select the group-level check box.

  5. Map each field to the Excel worksheet manually, or click Auto Map.
  6. Click the tab for the second object.
  7. Select the check boxes for the fields that you want to include in your script.
  8. Change the mapping of the ID column for the second object from C to the first empty column in the worksheet, then manually map the other fields that you have selected.
  9. Repeat steps 3-5 for any additional objects.

Add a condition

To define the data that will be downloaded, create a condition.

  1. On the Map tab, click Condition Builder.

    The Condition Builder box opens.

  2. Select the field.

    The default is All Fields.

  3. In the Field Description box, click the field you want.
  4. In the Value Type box, choose Fixed Value.
  5. In the Comparison box, choose an operator from the list.

    The list shows only the operators that match the data type.

  6. In the Value box, type the number or text.
  7. Choose And or Or if you want to add more conditions.
  8. Click the Add icon.
  9. Repeat for any other conditions, and then click OK.

Notes:
To add multiple values, such a Number of Employees > 50 and < 500, use the left bracket on the first value and the right bracket on the last value.

You can nest up to five conditions in the query.

For more information about conditions, see Add a condition.

Condition features for Master-Detail scripts

When you are building a condition for a Master-Detail script, you have a few more options:

  • You can access all objects at once, so your condition can include multiple objects.
  • You can see the full text of the query.
  • You can choose to download all records, only the master records that have detail records, or only the master records that do not have detail records.

Run: Download the data from Salesforce

  1. Click Script and save the script file.
  2. Click Save Data File and save the data file.
  3. Click the Run tab.
  4. Next to Extract Records, type a number or check the All box.
  5. Click Run.