Posts

Showing posts with the label filter

Salesforce Fact #790 | passing value in lightning record picker filter

Image
We can pass value dynamically as well in the filter of lightning-record-picker. For example, suppose we are using a contact record picker and we would like to select only the related contacts for the current account. The LWC is placed in the account record detail page. We can pass the current accountId in the filter. Attached are the screenshots.

Salesforce Fact #712 | Dynamic SOQL with multiple AND filters

Image
Suppose we need to construct an SOQL so that it contains multiple AND conditions based on the multiple filter values passed. If a particular filter value is passed only then it will be considered. We can have an apex method to construct the dynamic SOQL considering the possible scenarios. Attached are the screenshots.

Salesforce Fact #683 | Simple & composite filters

From the perspective of query optimizer, A query filter can be simple or composite. A simple filter is one where each of the field expression in the condition filters uses the 'AND' operator. Whereas, a composite filter is one where two or more field expressions in the condition filters uses the 'OR' operator. Reference:  https://help.salesforce.com/s/articleView?id=000385218&type=1

Salesforce Fact #636 | Passing filter value to Power BI field

If we are rendering some Power BI report in Salesforce record detail page and if the Power BI field name contains space then we need to tweak a bit while passing the filter value. For example, if we have a table named 'financials' and a field named 'Discount Band' in Power BI and we are filtering the data based on Name field on account, we need to use the below text formula as the filter: "financials/Discount_x0020_Band eq '"&Name&"'"

Salesforce Fact #629 | Translation does not impact record type name filter in app builder

Image
If we are using record type name filter on the lightning app builder as part of conditional visibility of any component/section, it is not impacted by translation. In this example, we have put a filter on a component so that it will be visible on the record page only if the account record type name is 'Test RT1'. Now, if the translation is added for record type label in translation workbench for French language and the user language is also changed to french. The filter works perfectly in the french language context as well. However, as a best practice Record type developer name should be used  instead of record type label  to avoid any inconsistency. Attached are the screenshots.

Salesforce Fact #602 | Filter on currency field for particular currencyisocode

Image
We can filter records based on a currency field for a particular value of a currency in SOQL.  For example, if we want to fetch the opportunity records whose amount is greater than the equivalent value of 500000 in EUR, we can use the below SOQL: SELECT Id, Amount, CurrencyIsoCode  FROM Opportunity  WHERE Amount > EUR500000 LIMIT 3 It takes into consideration the currency conversion rate and fetches data accordingly. Reference:  https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_querying_currency_fields.htm Attached is the screenshot.