Posts

Showing posts with the label spring24

Salesforce Fact #813 | Null Coalescing Operator in Apex

In Spring'24 release, we have one new operator in Apex i.e. Null coalescing operator. This is an alterative of the null check of any variable. If the left hand side operator is not null return its value else return the value on the right hand side. Previously: String name; String result =  String.isBlank(name) ? 'test' : name; Now: String name; String result = name ?? 'test'; Reference:  https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_NullCoalescingOperator.htm Note: It only works with null value, not with other values like 0 or false. Also, this operator is not supported in bind expression in SOQL queries.

Salesforce Fact #812 | Repeater(Beta) component in screen flow

Image
In Spring'24 release, we have the new Repeater(Beta) component introduced in screen flow builder. The input components inside the repeater component are tracked using the AllItems attribute. So, in order to get the length of the repeater collection, we need to iterate over the AllItems list and count its length, since the equals count operator is not supported yet to get the collection length. Reference:  https://help.salesforce.com/s/articleView?id=sf.flow_ref_elements_screencmp_repeater.htm&type=5 Attached are the screenshots. Output: