You need to sign in to do that
Don't have an account?
Jake Gmerek
Dynamic Field Creation
Can you Dynamically create a field in a Trigger?
something like mySobject.addField(name = 'myName', etc);
I don't think that you can do that, but I thought I would ask before I gave up.
Thanks
You can use the Metadata API to create objects / fields.
http://www.salesforce.com/us/developer/docs/api_meta/index.htm
If you want to perform this in the context of a trigger (which is kinda crazy use case for most situation, and I'd advise against it if possible), you'll need to use a @future method since the metadata api is a Web Service.
All Answers
You can use the Metadata API to create objects / fields.
http://www.salesforce.com/us/developer/docs/api_meta/index.htm
If you want to perform this in the context of a trigger (which is kinda crazy use case for most situation, and I'd advise against it if possible), you'll need to use a @future method since the metadata api is a Web Service.
Thanks!
Check these two pieces out:
http://www.salesforce.com/us/developer/docs/api_meta/Content/customfield.htm
http://www.salesforce.com/us/developer/docs/api_meta/Content/meta_update.htm
With that info you should be able to piece it together.