Skip to content
This repository was archived by the owner on Feb 11, 2026. It is now read-only.
This repository was archived by the owner on Feb 11, 2026. It is now read-only.

Can't seem to access and populate template on SendGrid via Apex #6

@seancanny091

Description

@seancanny091

Hi,

I've successfully sent an email from SendGrid with parameters passed from SF using the following core code:

SendGrid sendgrid = new SendGrid('username', 'password');
SendGrid.email email = new SendGrid.Email();

email.addTo('receiver@mail.com');
email.setFrom('sender@mail.com');
email.setSubject('Apex SendGrid Test');

SendGrid.SendGridResponse response = sendgrid.send(email);

I then created a template in SendGrid and attempted to send parameters to it from Salesforce using the following code:

SendGrid sendgrid = new SendGrid('username', 'password');
SendGrid.email email = new SendGrid.Email();

email.addFilter('templates', 'enable', '1');
email.addFilter('templates', 'template_id', '38e0b815-2551-4a9b-aa7a-e74db88329d4');

email.addTo('sender@mail.com');
email.setFrom('receiver@mail.com');
email.setSubject('Apex SendGrid Test');

SendGrid.SendGridResponse response = sendgrid.send(email);

This processes ok within Salesforce but nothing happens when it gets passed to SendGrid. Any guidance would be much appreciated.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions