function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dhaval PanchalDhaval Panchal 

Create Static Resource Dynamically



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.


But how to use metadata api in salesforce?

Any one have sample code for that?


Hey Dhaval,


Found the following blog which talks about static resource creation using from metadata API -


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