With the Salesforce NZC Spreadsheet, you can collect data from Salesforce Net Zero Cloud® (NZC), such as to disclose in Environmental, Social, and Governance (ESG) reporting. From Wdata Chain Builder, you can build multiple chains that work together to:
- Download data from Salesforce NZC
- Update values in the Salesforce NZC Spreadsheet and its Wdata tables
- Log when data downloads from Salesforce NZC
Note: While you build four chains in these instructions, you'll run only one chain — which then automatically runs the others — to download data from Salesforce NZC and update its Spreadsheet.
You can download different types of carbon accounting data from Salesforce NZC:
- Emissions activity
- Stationary asset carbon footprint, emissions sources, and energy use
- Vehicle asset carbon footprint and energy use
Note: The Salesforce NZC Spreadsheet is provided by Workiva. If you don't have this Spreadsheet but are interested, contact your Customer Success Manager for details.
Prerequisites
To build these chains, you'll need these connectors:
- Workiva connector
- Tabular Transformation connector
- JSON connector
- HTTP connector
- File Utilities connector
Tip: All of the chains' commands use the default CloudRunner. No GroundRunners are needed.
To successfully run the chains, also identify:
- The OAuth client ID and secret for Salesforce NZC
- An integration user set up in Salesforce NZC
- The integration user's username and password
- The ID of the Workiva workspace
- The IDs of the Salesforce NZC Spreadsheet and its Control Sheet section
- The IDs of the Wdata tables to store each type of data downloaded from Salesforce NZC
Build a chain to log data downloads
To start, build a chain to track when carbon accounting data was last refreshed in the Control Sheet section of the Salesforce NZC Spreadsheet.
Step 1. Create the chain
- From Chains, click Create, and select Create chain.
- In Setup, enter a name of
4.SF NCZ
and a description to help identify that it logs when refreshed data from Salesforce NZC occurs. - In Variables, add variables for the IDs of the Salesforce NZC Spreadsheet and its Control Sheet section:
Name Value SpreadsheetID Enter the ID of the Salesforce NZC Spreadsheet. SheetID Enter the ID of the Control Sheet section. - Click Save.
Step 2. Start with a Runtime Inputs trigger event
Start with a Runtime inputs event to identify the cells to update in the Control Sheet section:
- From Trigger event, move Runtime inputs to Start.
- Select Runtime inputs, and click Edit.
- In Basic info, enter a name and description to help identify the event.
- In Variables, add these inputs:
Input type Display name TextField Range TextField Year - Select Required for both inputs, and click Save.
Step 3. Add commands to log the refresh in the Control Sheet section
To log the refresh, add commands to create a file and update the Control Sheet section of the Salesforce NZC Spreadsheet based on the refresh:
- From Available BizApps, select File Utilities, and move Create file to Start.
- Drag a link from Start to Create file.
- Select the Create file command, and click Edit.
- In Basic info, enter a name and description to identify the command.
- In Command properties, select the File Utilities connector to use, and click Save.
Note: Leave the command's other properties blank so it creates an empty file when the chain runs.
- From Available BizApps, select Workiva, and move Write sheet data to the canvas.
- Drag a link from Create file to Write sheet data.
- Select the Write sheet data command, and click Edit.
- In Basic info, enter a name and description to identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the Workiva connector to use. Spreadsheet ID Select the SpreadsheetID chain variable. Sheet ID/name Select the SheetID chain variable. Data file Select the Created file output of the Create file command. Delimiter Select the comma ,
.Region To specify the cell of the Control Sheet section to update: - Enter
D
. - Select the Range runtime input from Trigger.
- Enter
:D
. - Select the Range runtime input from Trigger.
Use Platform API Select this checkbox. - Enter
- From Available BizApps, select File Utilities, and move another Create file to the canvas.
- Drag a link from Write sheet data to the new Create file.
- Select the Create file command, and click Edit.
- In Basic info, enter a name and description to identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the same File Utilities connector as the first Create file command. Text To track when the Salesforce NZC data was refreshed: - Enter
Reporting year:
. - Select the Year runtime input from Trigger.
- Enter
data last refreshed on
. - Select the System.DateTime variable from Runtime.
- Enter
- From Available BizApps, select Workiva, and move another Write sheet data to the canvas.
- Drag a link from the second Create file to the new Write sheet data.
- Select the Write sheet data command, and click Edit.
- In Basic info, enter a name and description to identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the same Workiva connector as the first Write sheet data command. Spreadsheet ID Select the SpreadsheetID chain variable. Sheet ID/name Select the SheetID chain variable. Data file Select the Created file output of the second Create file command. Delimiter Select the comma ,
.Region To specify the cell of the Control Sheet section to update: - Enter
E
. - Select the Range runtime input from Trigger.
- Enter
:E
. - Select the Range runtime input from Trigger.
Use Platform API Select this checkbox. - Enter
- Click Publish, enter any notes about its publication, and click Publish.
Build a chain to update Wdata tables with data from Salesforce NZC
Next, build a chain to update the source Wdata tables of the Saleforce NZC Spreadsheet with the latest carbon accounting data from Salesforce NZC.
Step 1. Create the chain
- From Chains, click Create, and select Create chain.
- In Setup, enter a name of
3. SF NZC
and a description to help identify the chain. - Click Save.
Step 2. Start with a Runtime Inputs trigger event
Start with a Runtime inputs event to identify the tables' datasets to update:
- From Trigger event, move Runtime inputs to Start.
- Select Runtime inputs, and click Edit.
- In Basic info, enter a name and description to help identify the event.
- In Variables, add these inputs:
Input type Display name TextField FilePrefix TextField Table ID FileField DatasetFile - Select Required for all inputs, and click Save.
Step 3. Add a command group to identify the datasets to update
- Move Command group to the canvas.
- Drag a link from Start to the command group.
- From Available BizApps, select Workiva, and move List files to the canvas.
- Drag a link from Group start to List files.
- Select the List files command, and click Edit.
- In Basic info, enter a name and description to help identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the same Workiva connector as the earlier chain. Table ID Select the Table ID runtime input from Trigger. - From Available BizApps, select JSON, and move Array to CSV to the canvas.
- Drag a link from List files to Array to CSV.
- Select the Array to CSV command, and click Edit.
- In Basic info, enter a name and description to help identify the command.
- Enter the command's properties:
Property Value Connector Select the JSON connector to use. JSON data Select the File list output of the List files command. Multi-value delimiter Enter a comma ( ,
).Preview result Select this checkbox. Delimiter Select Comma. - In Columns, enter the names and JSONPaths of the columns to create, and click Save:
Column name JSONPath id .id name .name - From Available BizApps, select Tabular Transformation, and move Advanced query to the canvas.
- Drag a link from Array to CSV to Advanced query.
- Select the Advanced query command, and click Edit.
- In Basic info, enter a name and description to help identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the Tabular Transformation connector to use. Tables Add a table: - In File, select the Converted file output of the Array to CSV command.
- In Table name, enter
a
.
Query - Enter
select * from a where name = '
. - Select the FilePrefix runtime input from Trigger.
- Enter
'
.
Input delimiter Select Comma. Output delimiter Select Comma. Preview results Select this checkbox. - From Available BizApps, select Tabular Transformation, and move Extract value to the canvas.
- Drag a link from Advanced query to Extract value.
- Select the Extract value command, and click Edit.
- In Basic info, enter a name and description to help identify the command.
- Enter the command's properties:
Property Value Connector Select the same Tabular Transformation connector as the Advanced query command. Input file Select the Result output of the Advanced query command. Column index Enter 1
.Delimiter Select Comma. Rox index Enter 2
. - Select the Skip tab.
- In Skip condition, click Success.
- Add a rule, and click Save.
Data type Variable Operator Value Select Integer. Select the Record count output of the Advanced query command. Select =. Enter 0
.
Step 4. Add commands to update the datasets
- From Available BizApps, select Workiva, and move Un-import file from table to the canvas.
- Drag a link from Out of the command group to Un-import file from table.
- Select the Un-import file from table command, and click Edit.
- In Basic info, enter a name and description to help identify the command.
- Enter the command's properties:
Property Value Connector Select the same Workiva connector as the List files command. Table ID Select the Table ID runtime input from Trigger. File ID Select the Value output of the Extract value command. - Select the Skip tab.
- In Skip condition, click Success.
- Add a rule, and click Save.
Data type Variable Operator Value Select Integer. Select the Record count output of the Advanced query command. Select =. Enter 0
. - From Available BizApps, select Workiva, and move Delete file to the canvas.
- Drag a link from Un-import file from table to Delete file.
- Select the Delete file command, and click Edit.
- In Basic info, enter a name and description to help identify the command.
- Enter the command's properties:
Property Value Connector Select the same Workiva connector as earlier. File ID Select ID from the File import output of the Un-import file from table command. - Select the Skip tab.
- In Skip condition, click Success.
- Add a rule, and click Save.
Data type Variable Operator Value Select Integer. Select the Record count output of the Advanced query command. Select =. Enter 0
. - From Available BizApps, select Workiva, and move Create file to the canvas.
- Drag a link from Delete file to Create file.
- Select the Create file command, and click Edit.
- In Basic info, enter a name and description to help identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the same Workiva connector as earlier. Table ID Select Table ID runtime input from Trigger. File Select the DatasetFile runtime input from Trigger. Name Select the FilePrefix runtime input from Trigger. - From Available BizApps, select Workiva, and move Import file into table to the canvas.
- Drag a link from Create file to Import file into table.
- Select the Import file command, and click Edit.
- In Basic info, enter a name and description to help identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the same Workiva connector as earlier. Table ID Select Table ID runtime input from Trigger. File ID Select ID from the Result output of the Create file command. - Click Publish, enter any notes about its publication, and click Publish.
Build a chain to download and import data from Salesforce NZC
Next, build a chain to download and import carbon accounting data from Salesforce NZC.
Note: Create chains 4.SF NZC and 3.SF NZC before this one, for its Run chain events.
Step 1. Create the chain
- From Chains, click Create, and select Create chain.
- In Setup, enter a name of
2.SF NZC
and a description to help identify the chain. - Select Allow concurrent runs.
- In Variables, add variables for the Salesforce NZC authentication credentials:
Name Value ClientID Enter the OAuth client ID for Salesforce NZC. ClientSecret Enter the OAuth client secret for Salesforce NZC. Username Enter the username for your Salesforce NZC integration user. Password Enter the password for your Salesforce NZC integration user. SecurityToken Enter the security token for Salesforce NZC. - In Dynamic variables, add dynamic variables to enable the chains to cycle through the data from Salesforce NZC:
Name Initial value sf Enter false
.nxt Enter /services/data/v54.0/query.
- Click Save.
Step 2. Start with Runtime inputs and Set dynamic chain variable events
Start with a Runtime inputs event to identify the data to download from Salesforce NZC:
- From Trigger event, move Runtime inputs to Start.
- Select Runtime inputs, and click Edit.
- In Basic info, enter a name and description to help identify the event.
- In Variables, add these inputs:
Input type Display name TextField ObjectQuery TextField TableID TextField TableSchema TextField ObjectName TextField Range TextField ReportingYear Note: You'll specify the values for these inputs when you build the next chain.
- Select Required for all inputs, and click Save.
- From Chain events, move Set dynamic chain variable to the canvas.
- Drag a link from Start to Set dynamic chain variable.
- Select the Set dynamic chain variable event, and click Edit.
- In Basic info, enter a name and description to identify the event.
- In Action, add these dynamic variable values, and click Save:
Dynamic variable Value sf Enter false
.nxt Enter /services/data/v54.0/query
.
Step 3. Add commands to prepare a file for data from Salesforce NZC
To securely download carbon accounting data from Salesforce NZC, add commands to get an OAuth token from Salesforce and create a temporary Wdata table:
- From Available BizApps, select HTTP, and move POST to the canvas.
- Drag a link from Set dynamic chain variable to POST.
- Select the POST command, and click Edit.
- In Basic info, enter a name and description to help identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the HTTP connector to use. Show response Select this checkbox. URL Enter https://login.salesforce.com/services/oauth2/token?grant_type=password&client_id=ClientID&client_secret=ClientSecret&username=Username&password=PasswordSecurityToken
ClientID
,ClientSecret
,Username
,Password
andSecurityToken
with their respective chain variables.Content type Enter application/json
.Output schema Enter this sample response: {"access_token":"aabbcc", "instance_url":"https://lll.sandbox.my.salesforce.com", "id":"https://test.salesforce.com/id/00D2h00000012oqEAA/0052h000004UIzQAAW", "token_type":"Bearer", "issued_at":"1668540921827", "signature":"bOY6u3QEnPoBpZEoCC1vuU9Z/RbYjVU9pIE5CIhqF1Q=" }
- From Available BizApps, select File Utilities, and move Create file to the canvas.
- Drag a link from POST to Create file.
- Select the Create file command, and click Edit.
- In Basic info, enter a name and description to help identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the same File Utilities connector as the previous chain. Text Select the TableSchema runtime input from Trigger. - From Available BizApps, select Workiva, and move Create table to the canvas.
- Drag a link from Create file to Create table.
- Select the Create table command, and click Edit.
- In Basic info, enter a name and description to help identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the same Workiva connector as before. Name Enter temp. Type Select Data. Columns Enable Variable, and select the Created file output of the Create file command.
Step 4. Add a command group to download data from Salesforce NZC
To get data from Salesforce NZC, add a command group to download the appropriate carbon accounting data:
- Move Command group to the canvas.
- Drag a link from Create table to In.
- Select the command group, and click Edit.
- From the Iterations tab, enable Iterator.
- In Select modifier type, select Repeat until.
- Add a rule, and click Save:
Data type Variable Operator Value Select String. Select the Sf chain variable. Select =. Enter true
. - From Available BizApps, select HTTP, and move GET to the canvas.
- Drag a link from Group start to GET.
- Select the GET command, and click Edit.
- In Basic info, enter a name and description to identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the same HTTP connector as the POST command. Show response Select this checkbox. URL Select the instance_url variable from the Response output of the POST command, then the Nxt chain variable. Query string Enter q=
, then select the ObjectQuery runtime input from Trigger.Headers Add a header: - In Key, enter
Authorization
. - In Value, select the token_type and access_token variables — in that order — from the Response output of the POST command
Output schema Enter this sample response: {"totalSize":33,"done":true,"nextRecordsUrl":"/services/data/v54.0/query/0r81K1WtWa9VWM0QKO-2000","records":[{"attributes":{"type":"EmissionsActivity","url":"/services/data/v54.0/sobjects/EmissionsActivity/0sm2h0000000001AAA"},"Id":"0sm2h0000000001AAA","OwnerId":"0052h000004U8DnAAK","IsDeleted":false,"Name":"All Emissions","CurrencyIsoCode":"USD","CreatedDate":"2022-11-03T21:12:00.000+0000","CreatedById":"0052h000004U8DnAAK","LastModifiedDate":"2022-11-03T21:12:00.000+0000","LastModifiedById":"0052h000004U8DnAAK","SystemModstamp":"2022-11-03T21:12:01.000+0000","LastViewedDate":"2022-11-15T16:56:10.000+0000","LastReferencedDate":"2022-11-15T16:56:10.000+0000","DataSourceType":"Seeded","EmissionsScopeCategory":"All Emissions"}]}
- In Key, enter
- From Chain events, move another Set dynamic chain variable to the canvas.
- Drag a link from GET to Set dynamic chain variable.
- Select the Set dynamic chain variable event, and click Edit.
- In Basic info, enter a name and description to identify the event.
- In Action, add the dynamic variable value, and click Save:
Dynamic variable Value sf Select Done from the Response output of the GET command. - From Chain events, move Conditional to the canvas.
- Drag a link from Set dynamic chain variable to Conditional.
- Select the Conditional event and click Edit.
- In Basic info, enter a name and description to identify the event.
- In Conditions, add a rule:
Data type Variable Operator Value Select String. Select Done from the Response output of the GET command. Select =. Enter false
. - From Chain events, move another Set dynamic chain variable to the canvas.
- Drag a link from Conditional to Set dynamic chain variable.
- Select the Set dynamic chain variable event, and click Edit.
- In Basic info, enter a name and description to identify the event.
- In Action, add the dynamic variable value, and click Save:
Dynamic variable Value nxt Select NextRecordsUrl from the Response output of the GET command.
Step 5. Add commands to download Vehicle Asset data
To add logic to download Vehicle Asset data from Salesforce NZC:
- From Chain events, move Conditional to the canvas.
- Drag a link from GET to Conditional.
- Select the Conditional event and click Edit.
- In Basic info, enter a name and description to identify the event.
- Add the condition's rule, and click Save:
Data type Variable Operator Value Select String. Select ObjectName runtime input from Trigger. Select =. Enter Vehicle Asset Data
. - From Available BizApps, select JSON, and move Array to CSV to the canvas.
- Drag a link from Conditional to Array to CSV.
- Select the Array to CSV command, and click Edit.
- In Basic info, enter a name and description to identify that the command converts Vehicle Asset data.
- Enter the command's properties:
Property Value Connector Select the JSON connector to use. JSON data Select Records from the Response output of the GET command. Multi-value delimiter Enter a comma ,
.Preview result Select this checkbox. Delimiter Select Comma. - Add these columns, and click Save:
Column name JSONPath StartDate .StartDate EndDate .EndDate ReportingYear .ReportingYear Name .VehicleAssetEmssnSrc.Name IsCompanyOwnedAsset .VehicleAssetEmssnSrc.IsCompanyOwnedAsset IsDeleted .VehicleAssetEmssnSrc.IsDeleted VehicleType .VehicleAssetEmssnSrc.VehicleType TotalScp3UpstrmEmissions .TotalScp3UpstrmEmissions TotFuelCnsmpInGallons .TotFuelCnmpInGallons TotFuelCnsmpInLiters .TotFuelCnsmpInLiters TotScope1EmissionsInTco2e .TotScope1EmissionsInTco2e TotScope2LocBasedEmissions .TotScope2LocBasedEmissions TotScope2MktBasedEmissions .TotScope2MktBasedEmissions CrbnEmssnScopeAlloc .VehicleAssetEmssnSrc.CrbnEmssnScopeAlloc Tip: To download additional Vehicle Asset objects, add their columns to this Array to CSV command, and include their fields in the Run Chain event for Vehicle Asset data when you build the 1.SF NZC chain.
- From Chain events, move Run chain to the canvas.
- Drag a link from Array to CSV to Run chain.
- Select the Run chain event, and click Edit.
- In Basic info, enter a name and description to identify the event.
- In Chain to run, select the 3.SF NZC chain created earlier to update Wdata tables with the Salesforce NZC data
- Enter the chain runtime inputs, and click Save:
Runtime input Value File prefix - Enter
vehicle
. - Select the System.DateTime runtime variable.
- Enter
.csv
.
Table ID Select Id from the Table output of the Create table command. Dataset file Select the Converted file output of the Array to CSV command. - Enter
Step 6. Add commands to download Emissions Activity and Stationary Asset data
To add logic to download Emissions Activity and Stationary Asset data from Salesforce NZC:
- From Chain events, move Conditional to the canvas.
- Drag a link from the previous Conditional to the new Conditional.
- Double-click the link, select Error for Edit link condition, and click Save.
- Select the new Conditional event, and click Edit.
- In Basic info, enter a name and description to identify the event.
- Add the condition's rule, and click Save:
Data type Variable Operator Value Select String. Select ObjectName runtime input from Trigger. Select =. Enter Emissions Activity
. - From Available BizApps, select JSON, and move Array to CSV to the canvas.
- Drag a link from Conditional to Array to CSV.
- Select the Array to CSV command, and click Edit.
- In Basic info, enter a name and description to identify that the command converts Stationary Asset data.
- Enter the command's properties:
Property Value Connector Select the same JSON connector the earlier Array to CSV command. JSON data Select Records from the Response output of the GET command. Multi-value delimiter Enter a comma ,
.Preview result Select this checkbox. Delimiter Select Comma. - Add these columns, and click Save:
Column name JSONPath CurrencyIsoCode .CurrencyIsoCode DataSourceType .DataSourceType EmissionsScopeCategory .EmissionsScopeCategory IsDeleted .IsDeleted Id .Id Name .Name OwnerId .OwnerId Tip: To download additional Emissions Activity objects, add their columns to this Array to CSV command, and include their fields in the Run Chain event for Emissions Activity data when you build the 1.SF NZC chain.
- From Chain events, move Run chain to the canvas.
- Drag a link from Array to CSV to Run chain.
- Select the Run chain event, and click Edit.
- In Basic info, enter a name and description to identify the event.
- In Chain to run, select the 3.SF NZC chain created earlier to update Wdata tables with the Salesforce NZC data
- Enter the chain runtime inputs, and click Save:
Runtime input Value File prefix - Enter
emissions
. - Select the System.DateTime runtime variable.
- Enter
.csv
.
Table ID Select Id from the Table output of the Create table command. Dataset file Select the Converted file output of the Array to CSV command. - Enter
- Drag a link from the previous Conditional to Array to CSV.
- Double-click the link, select Error for Edit link condition, and click Save.
- Select the Array to CSV command, and click Edit.
- In Basic info, enter a name and description to identify that the command converts Stationary Asset data.
- Enter the command's properties:
Property Value Connector Select the same JSON connector the other Array to CSV commands. JSON data Select Records from the Response output of the GET command. Multi-value delimiter Enter a comma ,
.Preview result Select this checkbox. Delimiter Select Comma. - Add these columns, and click Save:
Column name JSONPath StartDate .StartDate EndDate .EndDate ReportingYear .ReportingYear Name .StnryAssetEnvrSrc.Name IsCompanyOwnedAsset .StnryAssetEnvrSrc.IsCompanyOwnedAsset ReportingDate .ReportingDate StationaryAssetType .StnryAssetEnvrSrc.StationaryAssetType CrbnEmssnScopeAllocId .StnryAssetEnvrSrc.CrbnEmssnScopeAllocId TotalRenewableEnergyInKwh .TotalRenewableEnergyInKwh TotalRenewableEnergyPct .TotalRenewableEnergyPct TotalScope3DnstrmEmissions .TotalScope3DnstrmEmissions TotalScope3UpstrmEmissions .TotalScope3UpstrmEmissions TotBldgIndirectEnrgyCnsmpInMwh .TotBldgIndirectEnrgyCnsmpInMwh TotEnergyConsumptionInGj .TotEnergyConsumptionInGj TotEnergyConsumptionInKwh .TotEnergyConsumptionInKwh TotEnergyConsumptionInMwh .TotEnergyConsumptionInMwh TotRnwlEnrgyExclHydroInKwh .TotRnwlEnrgyExclHydroInKwh TotRnwlEnrgyExclHydroPct .TotRnwlEnrgyExclHydroPct TotScope1EmissionsInTco2e .TotScope1EmissionsInTco2e TotScope2LocBasedEmissions .TotScope2LocBasedEmissions TotScope2MktBasedEmissions .TotScope2MktBasedEmissions Tip: To download additional Stationary Asset objects, add their columns to this Array to CSV command, and include their fields in the Run Chain event for Stationary Asset data when you build the 1.SF NZC chain.
- From Chain events, move Run chain to the canvas.
- Drag a link from Array to CSV to Run chain.
- Select the Run chain event, and click Edit.
- In Basic info, enter a name and description to identify the event.
- In Chain to run, select the 3.SF NZC chain created earlier to update Wdata tables with the Salesforce NZC data
- Enter the chain runtime inputs, and click Save:
Runtime input Value File prefix - Enter
stationary
. - Select the System.DateTime runtime variable.
- Enter
.csv
.
Table ID Select Id from the Table output of the Create table command. Dataset file Select the Converted file output of the Array to CSV command. - Enter
Step 7. Add commands to update Salesforce NZC Spreadsheet
To refresh the Salesforce NZC Spreadsheet with the carbon accounting data, add commands to update the query results for its incoming connection:
- From Available BizApps, select Workiva, and move Create query to the canvas.
- Drag a link from the command group's Out to Create query.
- Select the Create query command, and click Edit.
- In Basic info, enter a name and description to identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the same Workiva connector as the Create table command. Name Enter a name to identify the query. Query text Enter the query statement to run: - Enter
Select * from "
. - Enter the Workiva workspace ID.
- Enter
"."
. - Select Id from the Table output of the Create table command.
- Enter
"
.
Temporary Select this checkbox. - Enter
- From Available BizApps, select Workiva, and move Run query to the canvas.
- Drag a link from Create query to Run query.
- Select the Run query command, and click Edit.
- In Basic info, enter a name and description to identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the same Workiva connector as the other commands. Query ID Select Id from the Query output of the Create query command. - From Available BizApps, select Workiva, and move Download query result to the canvas.
- Drag a link from Run query to Download query result.
- Select the Download query result command, and click Edit.
- In Basic info, enter a name and description to identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the same Workiva connector as the other commands. Query result ID Select Id from the Query result output of the Run query command. - From Available BizApps, select Workiva, and move Delete query to the canvas.
- Drag a link from Download query result to Delete query.
- Select the Delete query command, and click Edit.
- In Basic info, enter a name and description to identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the same Workiva connector as the other commands. Query ID Select Id from the Query output of the Create query command. - From Chain events, move Run chain to the canvas.
- Drag a link from Delete query to Run chain.
- Select the Run chain event, and click Edit.
- In Basic info, enter a name and description to identify the event.
- In Chain to run, select the 3.SF NZC chain created earlier to update Wdata tables with the Salesforce NZC data
- Enter the chain runtime inputs, and click Save:
Runtime input Value File prefix - Select the ObjectName runtime input from Trigger.
- Select the System.DateTime runtime variable.
- Enter
.csv
.
Table ID Select Id from the Table output of the Create table command. Dataset file Select the Query result output of the Download query result command. - From Available BizApps, select Workiva, and move Delete table to the canvas.
- Drag a link from Run chain to Delete table.
- Select the Delete table command, and click Edit.
- Enter the command's properties, and click Save:
Property Value Connector Select the same Workiva connector as the other commands. Table ID Select Id from the Table output of the Create table command. - From Chain events, move another Run chain to the canvas.
- Drag a link from Delete table to Run chain.
- Select the Run chain event, and click Edit.
- In Basic info, enter a name and description to identify the event.
- In Chain to run, select the 4.SF NZC chain created earlier to update the Control sheet section of the Salesforce NZC spreadsheet.
- Enter the chain runtime inputs, and click Save:
Runtime input Value Range Select the Range runtime input from Trigger. Year Select the Reporting year runtime input from Trigger. - Click Publish, enter any notes about its publication, and click Publish.
Build a chain to specify the data to download from Salesforce NZC
Next, build the chain to specify the carbon accounting data to download, based on the selections in the Control Sheet section of the Salesforce NZC Spreadsheet.
Note: Create the 2.SF NZC chain before this one, for its Run chain events.
Step 1. Create the chain
- From Chains, click Create, and select Create chain.
- In Setup, enter a name of
1. SF NZC
and a description to help identify the chain. - Click Save.
Step 2. Add commands to identify Control Sheet selections
From the Control Sheet section of the Salesforce NZC Spreadsheet, you can select which type of data to refresh, such as for Stationary assets or Vehicle assets. To start the chain, add commands to identify the selections from the Control Sheet section.
- From BizApps, select Workiva, and move Get sheet data to Start.
- Select the Get sheet data command, and click Edit.
- In Basic info, enter a name and description to help identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the same Workiva connector as the other chains. Spreadsheet ID Enter the ID of the Salesforce NZC Spreadsheet. Section ID/name Enter the ID of the Control Sheet section of the Salesforce NZC Spreadsheet. Region Enter A11:D19
.Value style Select Calculated. Revision To ensure the latest version, enter -1
. - From BizApps, select Tabular Transformation, and move Advanced query to the canvas.
- Drag a link from Start to the Advanced query command.
- Select the Advanced query command, and click Edit.
- In Basic info, enter a name and description to help identify the command.
- In Command properties, select the Tabular Transformation connector to use.
- In Tables, enter the table's file and name:
- In File, select the Data output of the Get sheet data command.
- In Table name, enter
a
.
- Enter the command's properties, and click Save:
Property Value Query Enter select * from a where `Refresh Data` = 'Yes'
.Input delimiter Select Comma. Output delimiter Select Comma. Preview results Select this checkbox. - From BizApps, select JSON, and move CSV to JSON to the canvas.
- Drag a link between the Advanced query and CSV to JSON commands.
- Select the CSV to JSON command, and click Edit.
- In Basic info, enter a name and description to help identify the command.
- Enter the command's properties, and click Save:
Property Value Connector Select the JSON connector to use. Input file Select the Result output of the Advanced query command. Delimiter Select Comma (,).
Step 3. Add logic to download vehicle asset data
- Move Command group to the canvas.
- Drag a link from the CSV to JSON command to the command group.
- Select the command group, and click Edit.
- From the Iterations tab, enable Iterator.
- In Select modifier type, select List.
- In Iterations, select the JSON file output of the CSV to JSON command.
- Click Save.
- From Chain events, move Conditional to the canvas.
- Drag a link from Group start of the command group to the Conditional event.
- Select the Conditional event, and click Edit.
- In Basic info, enter a name and description to help identify that it checks the selection of Vehicle asset data.
- In Conditions, add a rule:
Data type Variable Operator Value Select String. Select the JSON file output of the CSV to JSON command. Select =. Enter Vehicle Asset Data
. - In Variable, click the JSON file output, add a Get value from JSON variable transformation, and click Save:
Output Value Select String Enter Name
. - From Chain events, move Run chain to the canvas.
- Drag a link from the Conditional event to the Run chain event.
- Select the Run chain event, and click Edit.
- In Basic info, enter a name and description to help identify that it downloads emissions activity data.
- In Chain to run, select the 2.SF NZC chain created earlier.
- Enter the runtime inputs, and click Save:
Input Value ObjectQuery - Enter this query:
SELECT+EndDate,ReportingYear,StartDate,TotalScp3DnstrmEmissions,TotalScp3UpstrmEmissions,TotFuelCnsmpInGallons,TotFuelCnsmpInLiters,TotScope1EmissionsInTco2e,TotScope2LocBasedEmissions,TotScope2MktBasedEmissions,VehicleAssetEmssnSrc.CrbnEmssnScopeAlloc,VehicleAssetEmssnSrc.IsCompanyOwnedAsset,VehicleAssetEmssnSrc.IsDeleted,VehicleAssetEmssnSrc.Name,VehicleAssetEmssnSrc.VehicleType+FROM+VehicleAssetCrbnFtprnt+WHERE+ReportingYear+=+'
Tip: If you included an additional column in the Array to CSV command for Emissions Activity data in the 2.SF NZC chain, also include its field in this query. You can test Salesforce Object Query Language (SOQL) for the additional data from Salesforce Workbench.
- Select the JSON file output of the CSV to JSON command, then click the output and apply a Get value from JSON variable transformation:
- In Output, select String.
- In Value, enter
Reporting Year
.
- Enter
'
.
Table ID Select the JSON file output of the CSV to JSON command, then click the output and apply a Get value from JSON variable transformation: - In Output, select String.
- In Value, enter
TableID
.
TableSchema Enter this JSON string: [
{
"mode": "nullable",
"name": "reportingyear",
"type": "integer"
},
{
"mode": "nullable",
"name": "startdate",
"type": "date"
},
{
"mode": "nullable",
"name": "enddate",
"type": "date"
},
{
"mode": "nullable",
"name": "name",
"type": "string"
},
{
"mode": "nullable",
"name": "iscompanyownedasset",
"type": "boolean"
},
{
"mode": "nullable",
"name": "isdeleted",
"type": "boolean"
},
{
"mode": "nullable",
"name": "vehicletype",
"type": "string"
},
{
"mode": "nullable",
"name": "totalscp3dnstrmemissions",
"type": "float"
},
{
"mode": "nullable",
"name": "totalscp3upstrmemissions",
"type": "float"
},
{
"mode": "nullable",
"name": "totfuelcnsmpingallons",
"type": "float"
},
{
"mode": "nullable",
"name": "totfuelcnsmpinliters",
"type": "float"
},
{
"mode": "nullable",
"name": "totscope1emissionsintco2e",
"type": "float"
},
{
"mode": "nullable",
"name": "totscope2locbasedemissions",
"type": "float"
},
{
"mode": "nullable",
"name": "totscope2mktbasedemissions",
"type": "float"
},
{
"mode": "nullable",
"name": "crbnemssnscopealloc",
"type": "string"
}
]Tip: If you included an additional column in the Array to CSV command for Emissions Activity data in the 2.SF NZC chain, also include its field in this JSON string.
Object name Select the JSON file output of the CSV to JSON command, then click the output and apply a Get value from JSON variable transformation: - In Output, select String.
- In Value, enter
Name
.
Range Enter E12:E12
.Reporting year Select the JSON file output of the CSV to JSON command, then click the output and apply a Get value from JSON variable transformation: - In Output, select String.
- In Value, enter
Reporting Year
.
- Enter this query:
Step 4. Add logic to download stationary asset data
- From Chain events, move another Conditional to the canvas.
- Drag a link from the previous Conditional event to the new one, then double-click the link, select Error for Edit link condition, and click Save.
- Select the new Conditional event, and click Edit.
- In Basic info, enter a name and description to help identify that it checks the selection of Stationary asset data.
- In Conditions, add a rule:
Data type Variable Operator Value Select String. Select the JSON file output of the CSV to JSON command, then click the output and apply a Get value from JSON variable transformation: - In Output, select String.
- In Value, enter
Name
.
Select =. Enter Stationary Asset Data
. - From Chain events, move another Run chain to the canvas.
- Drag a link from the Conditional event to the new Run chain event.
- Select the Run chain event, and click Edit.
- In Basic info, enter a name and description to help identify that it downloads stationary asset data.
- In Chain, select the 2.SF NZC chain created earlier.
- Enter the runtime inputs, and click Save:
Input Value ObjectQuery - Enter this query:
SELECT+EndDate,ReportingDate,ReportingYear,StartDate,TotalRenewableEnergyInKwh,TotalRenewableEnergyPct,TotalScp3DnstrmEmissions,TotalScp3UpstrmEmissions,TotBldgIndirectEnrgyCnsmpInMwh,TotEnergyConsumptionInGj,TotEnergyConsumptionInKwh,TotEnergyConsumptionInMwh,TotRnwlEnrgyExclHydroInKwh,TotRnwlEnrgyExclHydroPct,TotScope1EmissionsInTco2e,TotScope2LocBasedEmissions,TotScope2MktBasedEmissions,StnryAssetEnvrSrc.CrbnEmssnScopeAllocId,StnryAssetEnvrSrc.IsCompanyOwnedAsset,StnryAssetEnvrSrc.Name,StnryAssetEnvrSrc.StationaryAssetType+FROM+StnryAssetCrbnFtprnt+WHERE+ReportingYear+=+'
Tip: If you included an additional column in the Array to CSV command for Stationary Asset data in the 2.SF NZC chain, also include its field in this query. You can test SOQL for the additional data from Salesforce Workbench.
- Select the JSON file output of the CSV to JSON command, then click the output and apply a Get value from JSON variable transformation:
- In Output, select String.
- In Value, enter
Reporting Year
.
- Enter
'
.
Table ID Select the JSON file output of the CSV to JSON command, then click the output and apply a Get value from JSON variable transformation: - In Output, select String.
- In Value, enter
TableID
.
TableSchema Enter this JSON string: [
{
"mode": "nullable",
"name": "reportingyear",
"type": "integer"
},
{
"mode": "nullable",
"name": "reportingdate",
"type": "string"
},
{
"mode": "nullable",
"name": "startdate",
"type": "date"
},
{
"mode": "nullable",
"name": "enddate",
"type": "date"
},
{
"mode": "nullable",
"name": "name",
"type": "string"
},
{
"mode": "nullable",
"name": "iscompanyownedasset",
"type": "boolean"
},
{
"mode": "nullable",
"name": "stationaryassettype",
"type": "string"
},
{
"mode": "nullable",
"name": "crbnemssnscopeallocid",
"type": "string"
},
{
"mode": "nullable",
"name": "totalrenewableenergyinkwh",
"type": "float"
},
{
"mode": "nullable",
"name": "totalrenewableenergypct",
"type": "float"
},
{
"mode": "nullable",
"name": "totalscp3upstrmemissions",
"type": "float"
},
{
"mode": "nullable",
"name": "totalscp3dnstrmemissions",
"type": "float"
},
{
"mode": "nullable",
"name": "totbldgindirectenrgycnsmpinmwh",
"type": "float"
},
{
"mode": "nullable",
"name": "totenergyconsumptioningj",
"type": "float"
},
{
"mode": "nullable",
"name": "totenergyconsumptioninkwh",
"type": "float"
},
{
"mode": "nullable",
"name": "totenergyconsumptioninmwh",
"type": "float"
},
{
"mode": "nullable",
"name": "totrnwlenrgyexclhydroinkwh",
"type": "float"
},
{
"mode": "nullable",
"name": "totrnwlenrgyexclhydropct",
"type": "float"
},
{
"mode": "nullable",
"name": "totscope1emissionsintco2e",
"type": "float"
},
{
"mode": "nullable",
"name": "totscope2locbasedemissions",
"type": "float"
},
{
"mode": "nullable",
"name": "totscope2mktbasedemissions",
"type": "float"
}
]Tip: If you included an additional column in the Array to CSV command for Stationary Asset data in the 2.SF NZC chain, also include its field in this JSON string.
Object name Select the JSON file output of the CSV to JSON command, then click the output and apply a Get value from JSON variable transformation: - In Output, select String.
- In Value, enter
Name
.
Range Enter E13:E13
.Reporting year Select the JSON file output of the CSV to JSON command, then click the output and apply a Get value from JSON variable transformation: - In Output, select String.
- In Value, enter
Reporting Year
.
- Enter this query:
Step 5. Add command to download emission activity
- From Chain events, move another Run chain to the canvas.
- Drag a link from the Conditional event to the new Run chain event.
- Double-click the link, select Error for Edit link condition, and click Save.
- Select the Run chain event, and click Edit.
- In Basic info, enter a name and description to help identify that it downloads emission activity data.
- In Chain, select the 2.SF NZC chain created earlier.
- Enter the runtime inputs, and click Save:
Input Value ObjectQuery Enter this query: SELECT+CurrencyIsoCode,DataSourceType,EmissionsScopeCategory,Id,IsDeleted,Name,OwnerId+FROM+EmissionsActivity
Tip: If you included an additional column in the Array to CSV command for Vehicle Asset data in the 2.SF NZC chain, also include its field in this query. You can test SOQL for the additional data from Salesforce Workbench.
Table ID Select the JSON file output of the CSV to JSON command, then click the output and apply a Get value from JSON variable transformation: - In Output, select String.
- In Value, enter
TableID
.
TableSchema Enter this JSON string: [
{
"mode": "nullable",
"name": "currencyisocode",
"type": "string"
},
{
"mode": "nullable",
"name": "datasourcetype",
"type": "string"
},
{
"mode": "nullable",
"name": "emissionsscopecategory",
"type": "string"
},
{
"mode": "nullable",
"name": "id",
"type": "string"
},
{
"mode": "nullable",
"name": "isdeleted",
"type": "boolean"
},
{
"mode": "nullable",
"name": "name",
"type": "string"
},
{
"mode": "nullable",
"name": "ownerid",
"type": "string"
}
]Tip: If you included an additional column in the Array to CSV command for Vehicle Asset data in the 2.SF NZC chain, also include its field in this JSON string.
Object name Select the JSON file output of the CSV to JSON command, then click the output and apply a Get value from JSON variable transformation: - In Output, select String.
- In Value, enter
Name
.
Range Enter E15:E15
.Reporting year Select the JSON file output of the CSV to JSON command, then click the output and apply a Get value from JSON variable transformation: - In Output, select String.
- In Value, enter
Reporting Year
.
- Click Publish, enter any notes about its publication, and click Publish.
Run the chains
To automatically refresh the Salesforce NZC Spreadsheet with the latest carbon accounting data:
Step 1. Select the data to refresh
In the Salesforce NZC Spreadsheet, specify the data to download from Salesforce NZC — Vehicle asset data, Stationary asset data, or Emissions activity — from the Control Sheet section:
- In the Reporting Year column, select which year's data to download.
- In the Refresh Data column, select whether to download the latest data.
Step 2. Run the 1.SF NZC chain
In Chain Builder, open the 1.SF NZC chain, and click Execute and Run chain.
When this chain runs, it automatically runs the other two chains to download the selected data from Salesforce NCZ and update the corresponding values and log file in the Salesforce NZC Spreadsheet.