I am working on adding a custom aura component into the Event Record Page. The below is what I have for .cmp

  <aura:attribute name="canvasParams" type="String"/>
  <aura:attribute name="id" type="String"/>
  <aura:attribute name="recordId" type="Id" />
  <aura:handler name="init"     value="{!this}"         action="{!c.doInit}"/>

    parameters="{!v.canvasParams}" scrolling="yes" height="100%" width="100%"

The following is the controller

    doInit: function(component, event, helper) {
        const id = `MeetingInsightsController${Math.floor(
            Math.random() * 1000
        component.set("v.id", id);

        component.set("v.canvasParams", JSON.stringify({
            id: id,
            localhost: true,
            redirectPath: "to/our/own/web.html",

        console.log(component.get("v.recordId")) // not the id I want

v.recordId isn't working because it gets the record id for the event rather than the contact associated to the event. I will prefer not to use server side controller

Thanks for any help!

1 Answer 1


You will need to use a custom Apex method to get this information. Something like:

public static Id getContactId(Id eventId){
    return [SELECT WhoId FROM Event WHERE Id = :eventId].WhoId;

Then call this method from your Javascript, following these instructions: Calling Server Actions

Usually, we could use the standard Record Data component for this, but this does not work for the Event object.

  • Thank you. This will get me the id for the contact, but I am curious is there a way to get the type, for example, lead or contact?
    – Liu Hantao
    Commented Sep 7, 2023 at 19:50
  • I would ask that as a separate question. But I think you'll find that it's already answered: salesforce.stackexchange.com/questions/239069/…
    – fred
    Commented Sep 8, 2023 at 9:50
  • Basically you can do WhoId.getSObjectType()
    – fred
    Commented Sep 8, 2023 at 9:51

You must log in to answer this question.

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