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: =@ctx.datasources.stage-data
60item:
61 type: component.list-item
62 options:
63 title: =@ctx.current.item.x
64 rightElement:
65 element: value
66 text:
67 format:
68 currency: USD
69 numberStyle: currency
70 text: =@ctx.current.item.y
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