I have an aggregate model that groups Opportunity data by month and year. I’d like to:
- Pass the month and year to a drawer to display data from a basic model to display a list of Opportunities by month. The aggregated fields are:
<groupby method="simple">
<field id="CloseDate" name="cyCloseDate" function="CALENDAR_YEAR"/>
<field id="CloseDate" name="cmCloseDate" function="CALENDAR_MONTH"/>
</groupby>
But when I try to activate and set model conditions based on these dates, both {{cyCloseDate}} and {{cmCloseDate}} are sent as NaN when I view the condition in the debug console. In the aggregate table output, these render as “6” “2023” if the row is for June 2023. But I cannot seem to get the drawer activate condition right.
What should the context condition be for the drawer table? I can only use a single value for the context, not month + year (related to question #3, is how to add a formula field to an aggregate model)
How do I create a formula field on this model so that I can display a column on the Aggregate table with the data of Month Name rather than than the month? I do not see a grouping formula for month name.
I see others in the community have done this but they are too smart for me and haven’t posted their code examples!
Happy to send samples of the code. This is the opportunity aggregate model:
<model id="Opp_FY" limit="" query="false" createrowifnonefound="false" processonclient="true" datasource="salesforce" type="aggregate" sobject="Opportunity" orderby="CALENDAR_YEAR(CloseDate),CALENDAR_MONTH(CloseDate)">
<fields>
<field id="Amount" name="sumAmount" function="SUM"/>
<field id="ExpectedRevenue" name="ExpectedRevenue" function="SUM"/>
</fields>
<conditions>
<condition type="fieldvalue" value="2024" field="Intended_Fiscal_Year__c" operator="=" mergefield="ProposalIFY" novaluebehavior="noquery" enclosevalueinquotes="true"/>
<condition type="fieldvalue" value="60" enclosevalueinquotes="false" field="Probability" operator="gte"/>
<condition type="fieldvalue" value="100" enclosevalueinquotes="false" field="Probability" operator="lt"/>
</conditions>
<actions/>
<groupby method="simple">
<field id="CloseDate" name="cyCloseDate" function="CALENDAR_YEAR"/>
<field id="CloseDate" name="cmCloseDate" function="CALENDAR_MONTH"/>
</groupby>
</model>
Thank you!
- Meredith