You need to sign in to do that
Don't have an account?
Creating Apex Class and Trigger using SOAP API
Hi,
My requirement is to create ApexTrigger in Salesforce dynamically after taking the required inputs from the user.
Is it possible using the SOAP API "create" operation since ApexClass and ApexTrigger are standard objects in Salesforce,
Regards
Shalindra Singh
My requirement is to create ApexTrigger in Salesforce dynamically after taking the required inputs from the user.
Is it possible using the SOAP API "create" operation since ApexClass and ApexTrigger are standard objects in Salesforce,
Regards
Shalindra Singh
You can do this operation using metadata api, ant, eclipse and other tool use that api.
https://developer.salesforce.com/page/An_Introduction_to_Force.com_Metadata
Thanks!
Here are some links:
https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/intro_soap_overview.htm
http://salesforce.stackexchange.com/questions/57478/can-i-save-a-new-apex-class-using-tooling-api-in-java
http://salesforce.stackexchange.com/questions/31734/how-to-get-the-content-of-an-existing-apex-class-using-metadata-api
Thanks for your reply. I am able to create Apex Class and Apex Trigger dynamically using Metadata API.
I am implementing the following things:
- I'll take input from the user, such as version no., object name (eg, Account, Contact) trigger event (eg, before insert, after insert etc.), url for publishing the messages etc.
- Based on the input, I'll create an Apex Class and Apex Trigger in Salesforce.
- Whenever any event occurs in Salesforce (such as a new Account is created), the trigger will be executed, and it will publish the message to the url that user has provided.
I want to know what are the permission levels for Apex Trigger and Apex class ? For example:- If the user is integrating salesforce with my application and he is sales person and not the administrator of salesforce account, would he still be able to create trigger and classes?
- If my application ask for salesforce credential and user enters the credential of salesforce which is in production, would my application still be able to create apex trigger and apex class on behalf of user?
- Also, Is there any other limitation that Metadata API exposes on creating Apex Classes/Apex Triggers?
ThanksShalindra Singh
- In production environment I don't think user will able to create apex class. or you can check below link(https://www.sundoginteractive.com/blog/creating-classes-and-triggers-in-apex-using-the-tooling-api)
3. Also, Is there any other limitation that Metadata API exposes on creating Apex Classes/Apex Triggers?