Add a Salesforce SObject to an Existing Ballerina Project
sf_add_custom_objectAdds a Salesforce SObject to an existing Ballerina project, generating resource-route code for standard or custom objects.
Instructions
Adds a new SObject to an already-scaffolded project. For standard SObjects: creates a .bal file that uses the pre-built type from ballerinax/salesforce.types (no types.bal change needed). For custom (__c) objects: also appends a typed record to types.bal.
Returns the resource-route snippet to paste into main.bal.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"project_path": "<project_path>",
"sf_client_id": "<sf_client_id>",
"sf_client_secret": "<sf_client_secret>",
"sf_refresh_token": "<sf_refresh_token>",
"sf_base_url": "<sf_base_url>",
"object_name": "<object_name>"
},
"name": "sf_add_custom_object"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | Yes | Path to the existing Ballerina project | |
| sf_client_id | Yes | Salesforce Connected App Consumer Key (Client ID) | |
| sf_client_secret | Yes | Salesforce Connected App Consumer Secret (Client Secret) | |
| sf_refresh_token | Yes | Salesforce OAuth2 Refresh Token obtained after authorization | |
| sf_base_url | Yes | Salesforce org instance URL, e.g. https://myorg.my.salesforce.com (sandbox auto-detected from hostname) | |
| object_name | Yes | SObject API name to add, e.g. 'My_Custom__c' |