CorsWhitelistEntry cors = new CorsWhitelistEntry();
cors.UrlPattern = 'sdfsdf.com';
insert cors;

Wherever I try the above (or any other DML operation), I get an error message:

DML operation ... not allowed on CorsWhitelistEntry

Any way to get past this? (I'm aware of REST/SOAP, but I'd really like to do this through APEX)


No,I dont think you can do it through Apex. Try using Metadata API.

  • Metadata API works, yes. I'm just asking for people's experience on this. – Dmitriy Khudorozhkov Jun 29 '17 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.