Pre-fill component fields with email and event data#

Pre-fill Lightning component fields with data from the current email or event to reduce manual input.

What this feature does#

This feature allows a Lightning component to receive contextual data from Context Panel and use it to pre-fill fields.

For example, you can automatically populate:

  • Email subject and body

  • Event date and location

  • Participants and related records

This helps users complete forms faster and reduces manual data entry.

How it works#

When a component is opened in the Context Panel, Revenue Grid passes context data as component properties (LWC) or attributes (Aura).

To use this data:

  • In LWC, declare properties using the @api decorator

  • In Aura, define attributes using <aura:attribute>

The component is responsible for using these values to populate its UI.

For the full list of supported properties, see:

Before you begin#

Field auto-population is available for Lightning components that are already integrated with Context Panel.

If your component is not yet integrated, complete the configuration described in:

Define properties for prefilled fields#

Define only the properties or attributes required for your component to receive and use Context Panel data.

Lightning web component#

import { LightningElement, api } from 'lwc';

export default class PrefillExample extends LightningElement {
    // Context data passed from Context Panel
    // Include only the properties required for your use case

    @api subject;
    @api messageBody;
    @api people;
    @api dates;
    @api location;
}

Aura component#

<aura:component>
    <!-- Context data passed from Context Panel -->
    <!-- Define only the attributes required for your component -->

    <aura:attribute name="subject" type="String"/>
    <aura:attribute name="messageBody" type="String"/>
    <aura:attribute name="people" type="Object"/>
    <aura:attribute name="dates" type="Object"/>
    <aura:attribute name="location" type="String"/>
</aura:component>

Map Revenue Grid properties to Salesforce fields#

Use the following table to understand how Context Panel properties map to Salesforce field types.

Context Panel property

Data type

Mapped Salesforce field type

Example value

activityFields

Object

Custom field (any type)

{ Amount: 1500, Discount: 10 }

activityIds

Array

Lookup Relationship

[ "0011N00001p8GvXQAU" ]

categories

Array

Text

[ "Salesforce", "Sync Error" ]

dates.start / dates.end

String (ISO 8601)

Date / Date/Time

"2025-02-05T14:30:00Z"

emails

Array

Email

[ "user@example.com" ]

iCalUId / internetMessageId

String

Unique ID (External ID, Custom Field)

"0011N00001p8GvXQAU"

location

String

Text

"New York Office"

messageBody

String

Long Text Area

"Please review the attached proposal."

mode

String

Text

"edit"

people

Object

Email / Lookup Relationship

{ "From": "john.doe@example.com" }

resolvedObjects

Array of Objects

Multi-Select Picklist / Lookup Relationship

[ "Lead", "Contact" ]

sentDate

String (ISO 8601)

Date/Time

"2025-02-05T12:00:00Z"

subject

String

Text

"Follow-up Meeting"

source

String

Text

"email" or "event"

threadId

String

Unique ID (External ID, Custom Field)

"AAQkAGQ0Y..."

Example mappings#

activityFields — Custom field (any type)#

Prefills Salesforce custom fields, e.g. Amount or Discount.

<lightning-input label="Amount" type="number" 
    value={activityFields.Amount}></lightning-input>
<lightning-input label="Discount (%)" type="number" 
    value={activityFields.Discount}></lightning-input>
<aura:component>
    <lightning:input label="Amount" 
        value="{!v.activityFields.Amount}" type="number"/>
    <lightning:input label="Discount" 
        value="{!v.activityFields.Discount}" type="number"/>
</aura:component>

activityIds — Lookup Relationship#

Allows users to select an associated activity ID from a dropdown. If multiple activity IDs exist, they are displayed in a dropdown for selection.

LWC markup (.html):

<lightning-combobox label="Activity ID" 
    options={activityIdsOptions} 
    value={firstActivityId}></lightning-combobox>

LWC JavaScript (.js):

get firstActivityId() {
  return (this.activityIds && this.activityIds.length > 0) ? this.activityIds[0] : '';
}

Aura component markup (.cmp):

<aura:component>
    <lightning:select name="activityId">
        <aura:iteration items="{!v.activityIds}" var="id">
            <option value="{!id}">{!id}</option>
        </aura:iteration>
    </lightning:select>
</aura:component>

categories — Text field#

Displays categories assigned to the email or event as a comma-separated list.

LWC markup (.html):

<lightning-input label="Categories"
    value={formattedCategories}
    read-only></lightning-input>

LWC JavaScript (.js):

get formattedCategories() {
    return this.categories ? this.categories.join(', ') : '';
}

Aura component markup (.cmp):

<aura:component>
    <aura:attribute name="categories" type="List"/>
    <aura:attribute name="formattedCategories" type="String"/>

    <aura:handler name="init"
        value="{!this}"
        action="{!c.formatCategories}"/>

    <lightning:input label="Categories"
        value="{!v.formattedCategories}"
        readonly="true"/>
</aura:component>

Aura JavaScript controller (.js):

({
    formatCategories: function(component) {
        const categories = component.get("v.categories");
        component.set(
            "v.formattedCategories",
            categories ? categories.join(", ") : ""
        );
    }
})

dates — Date/Time field#

Prefills start and end date fields for events.

<lightning-input label="Start Date" 
    type="datetime" 
    value={dates.start}></lightning-input>
<lightning-input label="End Date" 
    type="datetime" 
    value={dates.end}></lightning-input>
<aura:component>
    <lightning:input label="Start Date" 
        value="{!v.dates.start}" 
        type="datetime"/>
    <lightning:input label="End Date" 
        value="{!v.dates.end}" 
        type="datetime"/>
</aura:component>

Important

Revenue Grid passes dates as ISO 8601 strings (e.g., "2025-02-05T14:30:00Z").

Previously, dates were passed as JavaScript Date objects, which were incompatible with Salesforce Outlook integration conventions.

If you need to use the previous JavaScript Date format, send a corresponding request to Revenue Grid Support.

emails — Email field#

This property prepopulates the email address field with recipient details from an email or event. If multiple recipients exist, they are displayed as a comma-separated string.

LWC markup (.html):

<lightning-input label="Recipient Emails" 
    value={formattedEmails}></lightning-input>

LWC JavaScript (.js):

get formattedEmails() {
    return this.emails ? this.emails.join(', ') : '';
}

Aura component markup (.cmp):

<aura:component controller="MyAuraController">
    <aura:attribute name="emails" type="List"/>
    <aura:attribute name="formattedEmails" type="String"/>

    <aura:handler name="init" value="{!this}" action="{!c.formatEmails}" />
    <lightning:input label="Recipient Emails" value="{!v.formattedEmails}"/>
</aura:component>

Aura JavaScript controller (.js):

({
    formatEmails: function(component) {
        let emails = component.get("v.emails");
        component.set("v.formattedEmails", emails ? emails.join(", ") : "");
    }
})

iCalUId — Custom field (any type)#

Populates the field with the event’s unique iCalUId.

<lightning-input label="Event iCalUId" 
    value={iCalUId} 
    read-only></lightning-input>
<aura:component>
    <lightning:input label="Event iCalUId" 
        value="{!v.iCalUId}" 
        readonly="true"/>
</aura:component>

internetMessageId — Custom field (any type)#

Populates the unique email message ID.

<lightning-input label="Email Message ID" 
    value={internetMessageId} 
    read-only></lightning-input>
<aura:component>
    <lightning:input label="Email Message ID" 
        value="{!v.internetMessageId}" 
        readonly="true"/>
</aura:component>

location — Text field#

Prefills the location field for meetings or events.

<lightning-input label="Event Location" 
    value={location}></lightning-input>
<aura:component>
    <lightning:input label="Event Location" 
        value="{!v.location}"/>
</aura:component>

messageBody — Long Text Area field#

Saving the full text of an email into a Long Text Area field in Salesforce.

<lightning-textarea label="Email Body" 
    value={messageBody}></lightning-textarea>
<aura:component>
    <lightning:textarea label="Email Body" 
        value="{!v.messageBody}"/>
</aura:component>

mode — Text field#

Prefills the mode of the email or event in which the component is rendered.

<lightning-input label="Mode" 
    value={mode} 
    read-only></lightning-input>
<aura:component>  
    <lightning:input label="Mode" 
        value="{!v.mode}" 
        readonly="true"/>
</aura:component>

people — Lookup Relationship#

Displays recipient emails in structured format.

<template if:true={people}>
    <lightning-input label="To" 
        value={people.To}></lightning-input>
    <lightning-input label="CC" 
        value={people.CC}></lightning-input>
</template>
<aura:component>
    <lightning:input label="To" 
        value="{!v.people.To}"/>
    <lightning:input label="CC" 
        value="{!v.people.CC}"/>
</aura:component>

sentDate — Date/Time field#

Displays the timestamp of when the email was sent.

<lightning-input label="Sent Date" 
    type="datetime" 
    value={sentDate} 
    read-only></lightning-input>
<aura:component>
    <lightning:input label="Sent Date" 
        value="{!v.sentDate}" 
        type="datetime" 
        readonly="true"/>
</aura:component>

subject — Text field#

Prefills the subject of an email.

<lightning-input label="Subject" 
    value={subject}></lightning-input>
<aura:component>
    <lightning:input label="Subject" 
        value="{!v.subject}"/>
</aura:component>

source — Text field#

Displays whether the record originates from an email or event.

<lightning-input label="Source" 
    value={source} 
    read-only></lightning-input>
<aura:component>    
    <lightning:input label="Source" 
        value="{!v.source}" 
        readonly="true"/>
</aura:component>

threadId — Custom field#

Provides the identifier of the email conversation so that the component can correlate messages that belong to the same thread.

The value depends on the email context:

  • In read mode or when composing a reply, threadId contains the conversation identifier.

  • When composing a new email, threadId is an empty string.

<lightning-input label="Conversation ID" 
    value={threadId} 
    read-only>
</lightning-input> 
<aura:component>
    <lightning:input label="Conversation ID" 
        value="{!v.threadId}" 
        readonly="true"/>
</aura:component>