|
| 1 | +# org_config Object Reference |
| 2 | + |
| 3 | +The `org_config` object can be used in the `cumulusci.yml` file to read a large number number of attributes of the Salesforce org currently used. For example, in a [custom flow step](https://cumulusci.readthedocs.io/en/stable/config.html#add-a-flow-step), you can use a `when` clause to adapt the behavior of the new step to the type of org (scratch org or not) by referencing the `org_config.scratch` attribute. |
| 4 | + |
| 5 | +The following information is documented here in the application's source code : |
| 6 | +https://github.com/SFDO-Tooling/CumulusCI/blob/main/cumulusci/core/config/org_config.py |
| 7 | + |
| 8 | +## org_config Object Attributes |
| 9 | + |
| 10 | +- `access_token` : access token currently used to authenticate with Salesforce |
| 11 | +- `installed_packages` : comma-separated list of package names; a `dict` mapping a namespace or metadata package ID (starts with `033`) to the installed package version(s) matching that identifier. All values are lists, because multiple second-generation packages may be installed with the same namespace. The beta version of a package is represented as "1.2.3b5", where 5 is the build number. |
| 12 | +- `instance_url` : eg `https://crazy-demo.scratch.my.salesforce.com` |
| 13 | +- `instance_name` : eg `crazy-demo` |
| 14 | +- `is_advanced_currency_management_enabled` : `true` or `false` |
| 15 | +- `is_multiple_currencies_enabled`: `true` or `false` |
| 16 | +- `is_person_accounts_enabled` : `true` or `false` |
| 17 | +- `is_sandbox` : `true` if the org is a sandbox |
| 18 | +- `is_survey_advanced_features_enabled`: `true` or `false` |
| 19 | +- `lightning_base_url` : base url ending with `.lightning.force.com` |
| 20 | +- `namespace` : namespace of the org |
| 21 | +- `namespaced` : `true` if the org has a namespace |
| 22 | +- `org_id` : Organization ID of the Salesforce org |
| 23 | +- `org_type` : eg "Enterprise Edition" or "Developer Edition" |
| 24 | +- `organization_sobject` : The Organization object (see the [Salesforce documentation for the Organization SObject](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_organization.htm)) for the org. |
| 25 | +- `scratch` : `True` when the org is a scratch org. |
| 26 | +- `start_url`: the frontdoor URL that results in an instant login, like `https://mydomain.my.salesforce.com/secur/frontdoor.jsp?sid=...` |
| 27 | +- `user_id` : user ID of the current Salesforce user |
| 28 | +- `userinfo`: user OAuth2 information (see https://help.salesforce.com/s/articleView?id=sf.remoteaccess_using_userinfo_endpoint.htm) |
| 29 | +- `username` : username of the current Salesforce user |
| 30 | + |
| 31 | +## Other org_config Object Attributes |
| 32 | + |
| 33 | +- `config_file` |
| 34 | +- `config_name` |
| 35 | +- `latest_api_version` |
| 36 | +- `name` |
| 37 | +- `salesforce_client` |
| 38 | +- `sfdx_alias` |
| 39 | + |
| 40 | +## org_config Object Methods |
| 41 | + |
| 42 | +- `has_minimum_package_version(package_identifier, version_identifier)`: `true` if the org has a version of the specified package that is equal to or newer than the supplied version identifier. |
| 43 | + The package identifier may be either a namespace or a `033` MetadataPackage ID. |
| 44 | + The version identifier should be in "1.2.3" or "1.2.3b4" format. |
| 45 | + |
| 46 | + `when` expressions can use the `has_minimum_package_version` method to check if a package is installed with a sufficient version. |
| 47 | + |
| 48 | + For example: |
| 49 | + `when: org_config.has_minimum_package_version("namespace", "1.0")` |
| 50 | + |
| 51 | + See a real-life example here : https://trailhead.salesforce.com/fr/trailblazer-community/feed/0D54V00007erukZSAQ |
| 52 | + |
| 53 | +- `get_community_info(community_name, force_refresh=False)`: Returns the community information for the given community (see https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_responses_community.htm) |
| 54 | + |
| 55 | + An API call will be made the first time this method is used, |
| 56 | + and the return values will be cached. Subsequent calls will |
| 57 | + not call the API unless the requested community name is not in |
| 58 | + the cached results, or unless the force_refresh parameter is |
| 59 | + set to True |
0 commit comments