Posts

Showing posts from November, 2022

Salesforce Fact #571 | Approval request in chatter

How can we ensure the approver receives the approval request as a chatter post. Setup -> Chatter Settings -> Enable Allow Approvals. Reference:  https://help.salesforce.com/s/articleView?id=sf.approvals_for_chatter_enabling.htm&type=5

Salesforce Fact #570 | Delete selected related records using screen flow datatable

Image
With the new datatable feature in screen flow, we can create an automation to selectively delete related records from the parent record. In this example, we are showing the related contacts in the datatable inside screen flow and the user can choose and delete particular contact records. The flow is invoked as quick action from the account record detail page. Note: This will work fine when the number of related records are not very high, else this will encounter limit errors. Attached are the screenshots.

Salesforce Fact #569 | Datatable(Beta) in screen flow

Image
With the Winter'23 release, now we can show records in lightning datatable from screen flow. It can take a collection of records as source and also it supports preselected rows. Also , we can select columns to be shown and configure certain properties. Reference:  https://admin.salesforce.com/blog/2022/learn-moar-in-winter-23-with-flow-enhancements?utm_source=trailhead&utm_medium=trailmix&utm_campaign=learn_moar_winter_23&_ga=2.56687146.1493055349.1669019286-156340033.1662614994 Attached are the screenshots.

Salesforce Fact #568 | Format date using RIGHT()

Image
Suppose there is a date field in the object and we want to format the date value to DD.MM.YYYY format. And also prefix 0 is to be considered for Day < 10 and also for Month  < 10.  Now, we can use IF check to implement this. However, we can append '0' and use RIGHT() function to get the result in a bit simpler way. Attached are the screenshots.

Salesforce Fact #567 | Display picklist based on record type in screen flow

Image
Now we can filter out picklist values based on record type in screen flows. We can use record variable and set the RecordTypeId field with the corresponding id and use the same record variable in the screen and the picklist values will appear accordingly. In this example, we have two record types on account: Test_RT1 & Test_RT2. The rating picklist values are respectively Hot, Warm and Cold. The same appears in the screen flow. Reference:  https://help.salesforce.com/s/articleView?id=release-notes.rn_automate_flow_builder_filter_picklists_by_record_type.htm&type=5&release=240 Attached are the screenshots. Note: do not use hardcoded ids. it is only for demonstration purpose.

Salesforce Fact #566 | Guest users cannot be record owners

Image
Guest users cannot be the record owners. So, in order to set the owner for the records created by guest users we can specify a default record owner in Community settings. Reference:  https://help.salesforce.com/s/articleView?id=sf.networks_assign_guest_records.htm&type=5 Attached is the screenshot.

Salesforce Fact #565 | Mass close open tasks using flow

Image
Suppose we need to close all open tasks at once for multiple records. Why not have a flow automation for this. In order to implement this, we can have a screen flow which can be reused across multiple objects and which will be invoked from the list view button. We can pass the objectCode as an input variable value which would be used for navigating back to the list view page on completion of the flow and also we can pass an input variable which will denote whether WhatId/WhoId needs to be considered. Attached are the screenshots.

Salesforce Fact #564 | Flow return from list view button

Image
We have a limitation related to screen flows launched from list view button. The retUrl attribute does not work in the url and once finished, the flow does not go back to the list view screen from where it was invoked. As a workaround, we can create a hyperlink in the screen flow and the user can click that link to go back to the list view page. Attached are the screenshots.

Salesforce Fact #563 | @wire apex error

So what is the error you get if you call an apex method in @wire which is not annotated with (@AuraEnabled(cacheable=true). 'Apex methods that are to be cached must be marked as  @AuraEnabled(cacheable=true)'.

Salesforce Fact #562 | File sharing restriction

Image
There is an option in ContentVersion object to restrict the sharing and unsharing of files. A picklist field named ' Prevent others from sharing and unsharing ' can be set to impose the restriction. The picklist has two values: Freeze Sharing Off, Freeze Sharing On. If  Freeze Sharing On is selected, the file once shared with some users or groups, they cannot share or unshare it further. However, frozen files can still be shared by system admins and file owners, if they have collaborator access to the file. Reference:  https://help.salesforce.com/s/articleView?id=sf.collab_files_freeze_sharing.htm&type=5 https://help.salesforce.com/s/articleView?id=sf.collab_files_freeze_sharing.htm&type=5 Attached are the screenshots.

Salesforce Fact #561 | TaskWhoIds

Image
There is a field named ' TaskWhoIds ' present in Task object. If the 'Shared Activities' setting is enabled, this field stores the array of related contact or lead Ids associated to the task. When multiple contacts are associated to a task, the Name field shows the name of one contact + the count of remaining contact. The TaskWhoIds field is not accessible from query editor but accessible from execute anonymous window. Reference:  https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_task.htm Attached are the screenshots.

Salesforce Fact #560 | Shared activities

Image
There is a setting under ' Activity Settings ' which enables to share a task/event with multiple contacts and a lead. Using this option, A task/event can be shared with upto 50 contacts and one lead. Note: Once enabled, this feature cannot be disabled from setup. Salesforce support needs to be contacted for the same. Reference:  https://help.salesforce.com/s/articleView?id=sf.activities_enable_shared_activities.htm&type=5 Attached is the screenshot.

Salesforce Fact #559 | apex:outputPanel rendered

Image
In VF page, rendered attribute does not work with HTML tags. So, if we need to conditionally render content from html tags we can make use of apex:outputPanel to apply the rendered attribute. Attached is the screenshot.

Salesforce Fact #558 | Auto calculate end date LWC

Image
Suppose we have an input date field in LWC which is startdate and can be editable by user. Now, there is another field enddate which would be set to 30 days later the selected start date and it should be read only. We can implement the same using some JS logic. Attached are the screenshots.

Salesforce Fact #557 | Show dayofweek of selected date in LWC

Image
Suppose we have an input date field in LWC and we need to show the corresponding day of the week based on the selected date. We can implement the same using some JS logic. Attached are the screenshots.

Salesforce Fact #556 | Conditional rendering in p tag

Image
Unlike VF page, we can apply conditional rendering in <p> tag in LWC.  The below VF code will behave as: However the LWC code willl work properly:

Salesforce Fact #555 | validate() lwc inputs in screen flow

Image
Do you know we can use a validate() method to put some validation on lwc input components in screen flow. Suppose, we have a combobox in lwc which we are using in the screen flow and it is marked as required. But if we click the next button in screen flow, it goes to the next screen even if no value is selected. To add validation, we can use the validate() method. The UI can be improved in terms of showing the message. Reference:  https://developer.salesforce.com/docs/component-library/documentation/lwc/use_flow_validate_user_input_for_custom_components.html Attached are the screenshots.