You need to sign in to do that
Don't have an account?
adampro
Converting ApexTrigger to byte[]
Hi,
I'm trying to create an ApexTrigger using the Metadata API. I have the trigger populated with data but I'm having trouble deploying it. I know I need to convert the ApexTrigger to byte[] but don't know how.
I tried:
String s = trigger.ToString(); System.Text.ASCIIEncoding encode = new System.Text.ASCIIEncoding(); byte[] bytes = encode.GetBytes(s);
but that doesn't work since ToString() only retrieves the name of the trigger, not the entire thing.
Does anyone know how to do this?
Thanks.
if you have to get the body of the apex trigger then you have use
triigger.content --> this will return you the trigger body in base64. once you get the trigger.content you can do your remaining logic.