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
Shebin-KVP Business SolnsShebin-KVP Business Solns 

Apex code to create site

Hi All,


 Does anybody know  how to create  a site using apex code.


 My requirement is such that my app when installed in new instance it should check for any existing site, if note there it should create new one.


Please let me know if any solutions,

Thanks in Advance,


Shebin Mathew.

KVP Business Solutions.

Best Answer chosen by Admin (Salesforce Developers) 

You can't create sites via Apex, they are managed via the metadata api.