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
Chandrashekhar GoudChandrashekhar Goud 

Is there any way to create un managed package using Apex code or any API call ?

Raj VakatiRaj Vakati
DO you want the only API ?? 

Or Salesforce DX also fine .. you can create a package using SFDX 

 
Chandrashekhar GoudChandrashekhar Goud

Hi Raj

SaleforceDx also fine, but using Dx we can create unlocked or managed package

create a package

sfdx force:package:create
 Flags:
  -d, --description DESCRIPTION                    package description
  -n, --name NAME                                  (required) package name
  -e, --nonamespace                                creates the package with no namespace; available only for unlocked packages.
  -t, --packagetype PACKAGETYPE                    (required) package type (Managed,Unlocked)


Is there any way to create unmanaged package using apex or any api, which is we can create manually from salesforce UI.



 

Raj VakatiRaj Vakati
Yes 

 Refer this link 



https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_dev2gp.htm

https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_dev2gp_create_pkg_base.htm

​​​​​​​
sfdx force:package:create --name "My Awesome App" --description "My Package" \
--packagetype Unlocked

 
Chandrashekhar GoudChandrashekhar Goud
I knew this process, but our expectation is to create a unmanaged package in a salesforce org add the metadata which is already available on the same org without modifying anything on the actual metadata.