1

I've created one custom action into Salesforce Maps package here: enter image description here

As you see, this action leads to a Lightning component. The question is, how to get the recordId of the item clicked on Maps?

clicked on the Asset

I've tried the same way as used on a record page screen. However in this case this attribute is undefined.

<aura:attribute name="recordId" type="String" />

2 Answers 2

3

To get the record ID attribute all you need to do is mark the attribute as global. Example:

<aura:component access="global">
  <aura:attribute name="recordId" type="String" access="global" />

  <p>recordId: {!v.recordId}</p>
</aura:component>

Note that the aura:component access had to be global in order to show the component.

Result:

Result

Mass Actions

In case anyone is stuck on doing the same thing when selecting multiple locations on the map. The attribute name is ids. Example:

<aura:component access="global">
  <aura:attribute name="ids" type="String[]" access="global" />
  
  <p>ids:</p>
  <aura:iteration items="{!v.ids}" var="id">
    <p>{!id}</p>
  </aura:iteration>
</aura:component>

Result:

Mass Actions result

1
  • This is working, Thanks
    – Srujan
    Commented May 8, 2023 at 14:43
0

I had the same problem, so far after searching I have reached the solution to do it as explained in this link, with a visualforce component, the recordId arrives in the options parameter.

https://help.salesforce.com/s/articleView?id=000353872&type=1

Here is the key paragraph: "in this example the code is displaying the options object which is providing an array of markers that the user clicked on and for each marker it's displaying its record id, name and tooltips etc."

In the console the record id is showed in 'records' array.

I don't know if there is a more direct solution, hope it helps

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .