gpt4 book ai didi

salesforce - 检测沙盒类型 (Salesforce)

转载 作者:行者123 更新时间:2023-12-04 07:39:32 68 4
gpt4 key购买 nike

Salesforce 支持不同的沙箱。
例如“部分”或“开发”沙箱。
有没有办法检测我的脚本连接到哪种沙箱?
我使用 Python 和 simple_salesforce。

最佳答案

我的 Python 不够好。我可以给出提示,但你必须自己尝试一下。
https://github.com/simple-salesforce/simple-salesforce “附加功能”表示有内部类可以向您公开 session_id 和实例。
您可以使用这些来制作 HTTP GET 调用

Authorization: Bearer {session_id}
{instance}/services/data/v51.0/limits
"limits"资源将告诉您(除其他外)该组织中可用的数据和文件存储是什么。它会返回一个类似于
{
...
"DataStorageMB" : {
"Max" : 200,
"Remaining" : 196
},
...
}
使用 DataStorageMB.Maxhttps://help.salesforce.com/articleView?id=sf.data_sandbox_environments.htm&type=5 底部的 table 弄清楚你在哪里。 200 => 开发人员,1024 => 开发人员专业...

编辑 - 如果您使用 Apex(可能作为 REST 服务公开,“简单的销售人员”具有很好的内置功能来访问它们)
Integer storageLimit = OrgLimits.getMap().get('DataStorageMB').getLimit();
System.debug(storageLimit);
String sandboxType;
switch on storageLimit{
when 200 {
sandboxType = 'Developer';
}
when 1024 {
sandboxType = 'Developer Pro';
}
when 5120 {
sandboxType = 'Partial Copy';
}
when else {
sandboxType = 'Full Copy';
}
}
System.debug(sandboxType);

关于salesforce - 检测沙盒类型 (Salesforce),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67567068/

68 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com