Data Providers
Salesforce
List records in objects
4min
Reading data from Salesforce using the Salesforce provider is easy. The provider is intuitive, and once you have synced the data from the Salesforce provider to the local data provider, you can design lists, charts, and widgets to show your organization's Salesforce metrics, accounts, opportunities, and more.
List of accounts
Search and filtering a list
The code below shows a simple example of a list of accounts in Salesforce. Adding search and filter properties allows you to easily find the accounts you looking for.
list-accounts.jigx
1title: List Salesforce accounts
2type: jig.default
3
4header:
5 type: component.jig-header
6 options:
7 height: medium
8 children:
9 type: component.image
10 options:
11 source:
12 uri: https://images.unsplash.com/photo-1605152276897-4f618f831968?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2670&q=80
13
14
15onFocus:
16 type: action.action-list
17 options:
18 actions:
19 - type: action.sync-entities
20 options:
21 provider: DATA_PROVIDER_SALESFORCE
22 entities:
23 - Account
24
25datasources:
26 salesforce-accounts:
27 type: datasource.sqlite
28 options:
29 provider: DATA_PROVIDER_LOCAL
30 entities:
31 - entity: Account
32 query: SELECT id, '$.Name', '$.Type', '$.BillingCountry' FROM [Account] WHERE ('$.Type' LIKE @filter OR @filter IS NULL) AND ('$.Name' LIKE '%'||@search||'%' OR @search IS NULL)
33 queryParameters:
34 filter: [email protected]-list.state.filter
35 search: [email protected]-list.state.searchText
36
37children:
38 - type: component.list
39 instanceId: account-list
40 options:
41 data: [email protected]-accounts
42 isSearchable: true
43 maximumItemsToRender: 50
44 filter:
45 - title: All
46 value: ""
47 - title: Prospect
48 value: Prospect
49 - title: Customer - Direct
50 value: Customer - Direct
51 item:
52 type: component.list-item
53 options:
54 title: [email protected]
55 subtitle: [email protected]
56 label:
57 title: [email protected]
58 leftElement:
59 element: avatar
60 text: SF
61
List of Opportunities
The code below shows a basic example of a list of opportunites in Salesforce with an onPress action that will allow you to update the opportunity amount.
Basic List
YAML
1title: List Salesforce opportunities
2type: jig.default
3
4header:
5 type: component.jig-header
6 options:
7 height: medium
8 children:
9 type: component.image
10 options:
11 source:
12 uri: https://images.unsplash.com/photo-1454165804606-c3d57bc86b40?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1170&q=80
13
14onFocus:
15 type: action.action-list
16 options:
17 actions:
18 - type: action.sync-entities
19 options:
20 provider: DATA_PROVIDER_SALESFORCE
21 entities:
22 - Opportunity
23
24datasources:
25 salesforce-opp-list:
26 type: datasource.sqlite
27 options:
28 provider: DATA_PROVIDER_LOCAL
29 entities:
30 - entity: Opportunity
31 query: SELECT id, '$.Name', '$.Amount' FROM [Opportunity]
32
33children:
34 - type: component.list
35 instanceId: account-list
36 options:
37 data: [email protected]-opp-list
38
39 item:
40 type: component.list-item
41 options:
42 title: [email protected]
43 leftElement:
44 element: avatar
45 text: SF
46 rightElement:
47 element: value
48 text:
49 format:
50 currency: USD
51 numberStyle: currency
52 text: [email protected]
53 onPress:
54 type: action.go-to
55 options:
56 linkTo: salesforce-opp-update
57 parameters:
58 id: [email protected]
59 entity: Opportunity
Create a Stage detail jig
stage-detail.jigx
total-sales.jigx
1title: Stage detail
2type: jig.list
3icon: house
4
5header:
6 type: component.jig-header
7 options:
8 children:
9 options:
10 source:
11 uri: https://images.unsplash.com/photo-1555421689-491a97ff2040?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1740&q=80
12 type: component.image
13 height: medium
14
15onFocus:
16 type: action.action-list
17 options:
18 actions:
19 - type: action.sync-entities
20 options:
21 provider: DATA_PROVIDER_SALESFORCE
22 entities:
23 - Account
24 - Opportunity
25 - OpportunityStage
26
27datasources:
28 account-data:
29 type: datasource.sqlite
30 options:
31 provider: DATA_PROVIDER_LOCAL
32 entities:
33 - entity: Account
34 query: |
35 SELECT Acc.id as accid
36 ,json_extract(Acc.data, '$.Name') as Name
37 ,json_extract(Opp.data, '$.AccountId') as AccountId
38 ,sum(json_extract(Opp.data, '$.Amount')) as OppValue
39 FROM [Account] Acc
40 LEFT JOIN [Opportunity] Opp
41 on AccountId = accid
42
43 stage-data:
44 type: datasource.sqlite
45 options:
46 provider: DATA_PROVIDER_LOCAL
47 entities:
48 - Opportunity
49 - OpportunityStage
50 query: SELECT opp.id as oppid ,json_extract(opp.data, '$.StageName') as x
51 ,sum(json_extract(opp.data, '$.Amount')) as y ,json_extract(opp.data,
52 '$.CloseDate') as CloseDate ,json_extract(opp.data, '$.AccountId') as
53 oppaccid ,json_extract(OppStg.data, '$.ApiName') as ApiName
54 ,json_extract(OppStg.data, '$.SortOrder') as SortOrder FROM
55 [Opportunity] opp LEFT JOIN [OpportunityStage] OppStg on x = ApiName
56 where CloseDate between '2020-01-01' and '2020-03-31' group by x order
57 by SortOrder
58
59data: [email protected]-data
60item:
61 type: component.list-item
62 options:
63 title: [email protected]
64 rightElement:
65 element: value
66 text:
67 format:
68 currency: USD
69 numberStyle: currency
70 text: [email protected]
71
72summary:
73 children:
74 type: component.summary
75 options:
76 title: >
77 ='Total: $' & $formatNumber(@ctx.datasources.total-sales.totalsales ,
78 '#,###.00')
79 subtitle: Quarter sales to date
80 layout: default
81 leftIcon:
82 element: icon
83 name: currency-dollar-circle
Updated 22 Nov 2023
Did this page help you?