function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
OfraOfra 

In Sortable Data Grids/Enhanced Lightning Grids - what actions can I use?

I installed Enhanced Lightning Grid (https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000EVK8iUAH) from the AppExchange.
As you can see from their User Guide (https://appexchange.salesforce.com/partners/servlet/servlet.FileDownload?file=00P3A00000aW6whUAC), this adds an App to the org that is named "Sortable Data Grids" where one may configure data grids of objects by using a filter, and by adding fields and actions to each grid.
I am trying to figure out which actions can I use, and what is the correct way to use them
There is a help page that states the following: 
ATTRIBUTE: Event
PURPOSE: Fully qualified event name. Component is only able to throw global events and evtObjectManager events. If you want to use another event, then raise an evtObjectManager event and catch the payload.
EXAMPLES: e.force.editRecord,  e.c:evtObjectManager
  • What are global events? 
  • What are evtObjectManager events?

Help LinkHelp Contents

 
SubratSubrat (Salesforce Developers) 
Hello Ofra,

In Salesforce, events are used to communicate between components and trigger actions or pass data. Events can be categorized as global events and component-specific events (also known as "evtObjectManager" events in the Enhanced Lightning Grid documentation).

Global Events:
Global events are system-level events provided by the Salesforce platform. They can be triggered by any component and listened to by any other component in the application. Global events are prefixed with "e." and are used to perform common actions or navigate to standard Salesforce pages.
For example, the e.force.editRecord event is a global event that triggers the standard Salesforce record edit page for a specific record. By firing this event and passing the appropriate record ID, you can open the record in edit mode.

evtObjectManager Events:
"evtObjectManager" events, as mentioned in the Enhanced Lightning Grid documentation, are component-specific events. These events are custom events defined and used within the Enhanced Lightning Grid component or related components.
The documentation suggests that if you want to use a different event than the ones provided, you can raise an "evtObjectManager" event and catch the payload. This approach allows the Enhanced Lightning Grid component to handle custom events and perform the desired actions.

To summarize:

Global events are system-level events provided by Salesforce and can be used to perform common actions or navigate to standard pages.
evtObjectManager events are component-specific events used within the Enhanced Lightning Grid component or related components. They allow for custom event handling and actions specific to the component.
For more information on events in Salesforce, you can refer to the Salesforce documentation on events and event-driven architecture.

If this helps , please mark this as Best Answer.
Thank you.
OfraOfra
Hi Subrat and thank you for your reply!

I wish the Row Actions in the Enhanced Lightning Grid could perform custom actions (I am refering to those actions that can be defined via Object Manager > Custom Object > Links, Buttons & Actions > New Action). 

As far as Global events go, I'm assuming this is a comprehensive list of available global actions: https://developer.salesforce.com/docs/component-library/overview/events 
In which case there is no type of global action that can be used to launch a custom action for the record. 

If that is true, then I am interested in understanding the evtObjectManager events further. 
In the simplest form, when I try giving the example event that is specified in the documentation, i.e. "e.c:evtObjectManager", I receive an error saying "invalid event name" when I click it. 
Other than figuring out the correct way to refer to this event, I would also be interested in learning where and how I can implement code that will listen to and handle the event. 

Error Message
Definition of Row Action
 
OfraOfra
I've made some progress, managing to trigger a flow from a Row Action button. Here is what I did: 

In developer console:
  • File > New > Lightning Event > I named it myEvent, and this is the .evt file contents:
<aura:event type="APPLICATION" access="global">
    <aura:attribute name="recordId" type="string" />
</aura:event>
  • File > New > Lightning Component > I named it myComponent. This is the contents of the .cmp file:
<aura:component 
                implements="flexipage:availableForAllPageTypes"
                access="global">
	<aura:handler event="c:myEvent" action="{!c.handleApplicationEvent}"/>
    <lightning:flow aura:id="myFlowContainer"/>
</aura:component>
  • This is the contents of the Controller.js file:
({
    handleApplicationEvent: function (cmp, event) {
        var flow = cmp.find("myFlowContainer");
        var inputVariables = [
        {
        name : "recordId",
        type : "String",
        value : event.getParam("recordId")
        }
     ];

     flow.startFlow("My_Flow_API_Name", inputVariables );
    }
})
  • Note that my flow has an input variable of type record, named "recordId".
In Lightning app builder I created an App Page that contains the Enhanced Lightning Grid and an instance of "myComponent".
The ELG has a Row Button Action with Event = e.c:myEvent and Payload = {"recordId": "#id#"}. 
  • Note that the payload should correspond to the attributes in the aura:event
Result: After clicking the button, the flow runs, and the myComponent displays a box with the flow name as the title and "YOUR FLOW FINISHED" as the body.