Skip to main content
Glama
simonl77
by simonl77

salesforce_write_apex_trigger

Create or update Apex triggers in Salesforce to automate business logic and data validation for custom objects.

Instructions

Create or update Apex triggers in Salesforce.

Examples:

  1. Create a new Apex trigger: { "operation": "create", "triggerName": "AccountTrigger", "objectName": "Account", "apiVersion": "58.0", "body": "trigger AccountTrigger on Account (before insert, before update) { /* implementation */ }" }

  2. Update an existing Apex trigger: { "operation": "update", "triggerName": "AccountTrigger", "body": "trigger AccountTrigger on Account (before insert, before update, after update) { /* updated implementation */ }" }

Notes:

  • The operation must be either 'create' or 'update'

  • For 'create' operations, triggerName, objectName, and body are required

  • For 'update' operations, triggerName and body are required

  • apiVersion is optional for 'create' (defaults to the latest version)

  • The body must be valid Apex trigger code

  • The triggerName in the body must match the triggerName parameter

  • The objectName in the body must match the objectName parameter (for 'create')

  • Status information is returned after successful operations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationYesWhether to create a new trigger or update an existing one
triggerNameYesName of the Apex trigger to create or update
objectNameNoName of the Salesforce object the trigger is for (required for 'create')
apiVersionNoAPI version for the Apex trigger (e.g., '58.0')
bodyYesFull body of the Apex trigger

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/simonl77/mcp-server-salesforce'

If you have feedback or need assistance with the MCP directory API, please join our Discord server