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

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!