代码中是否有一种方法可以在 Salesforce 中识别沙盒的许可证类型? (Developer、Developer Pro、部分副本、完整)

Is there a way in code to recognize in Salesforce the type of licenses of a sandbox? (Developer, Developer Pro, Partial Copy, Full)

我正在尝试创建一个 class 来根据沙箱刷新后沙箱拥有的许可类型在沙箱上设置特定配置。

我所能做的就是判断它是生产版还是沙盒,但不知道是哪种沙盒。

我愿意接受建议。

InstanceName 应包含 QA、UAT、Dev 等

对此没有直接的方法。

您可以在 Organization 字段中通过 InstanceName 进行检查:

SELECT InstanceName FROM Organization

参考:https://salesforce.stackexchange.com/questions/110760/how-to-identify-the-type-of-sandbox-in-apex