Skip to main content
Glama

Salesforce MCP Server

salesforce_write_apex_trigger

Create or update Apex triggers in Salesforce to automate workflows by defining custom logic for specific Salesforce objects. Specify trigger name, object, and code body for efficient management.

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

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

Input Schema (JSON Schema)

{ "properties": { "apiVersion": { "description": "API version for the Apex trigger (e.g., '58.0')", "type": "string" }, "body": { "description": "Full body of the Apex trigger", "type": "string" }, "objectName": { "description": "Name of the Salesforce object the trigger is for (required for 'create')", "type": "string" }, "operation": { "description": "Whether to create a new trigger or update an existing one", "enum": [ "create", "update" ], "type": "string" }, "triggerName": { "description": "Name of the Apex trigger to create or update", "type": "string" } }, "required": [ "operation", "triggerName", "body" ], "type": "object" }

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/tsmztech/mcp-server-salesforce'

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