+ Start a Discussion
Dhaval PanchalDhaval Panchal 

Create Static Resource Dynamically

Hi,

 

I want to create Static Resource using apex code, but it gives me below error.

 

Error: Compile Error: DML not allowed on StaticResource

 

from below link I found that we can create static resource using metadata api.

 

http://boards.developerforce.com/t5/General-Development/Compile-error-DML-not-allowed-on-StaticResource/m-p/162206#M37251

 

But how to use metadata api in salesforce?

Any one have sample code for that?

Sonam_SFDCSonam_SFDC

Hey Dhaval,

 

Found the following blog which talks about static resource creation using from metadata API - http://andyinthecloud.com/tag/static-resource/

 

the blog has some sample code as well, worth a read!