LoginSignup
1
1

Salesforceのオブジェクトにカスタム項目が追加できるかを確かめる方法【Tooling APIをPostmanから使う】

Last updated at Posted at 2023-12-18

以下の質問の回答によれば、Toolong APIを使ってEntityDefinitionオブジェクトのIsCustomizableがtrueならカスタム項目が追加できるオブジェクトとのことです。

Postmanを使って確かめたいと思います。
PostmanからSalesforceにアクセスする方法は、以下を参考にして下さい。

EntityDefinitionオブジェクトの検索

Toolongを展開して、Tooling Queryをクリックして選択します

image.png

qのパラメータに以下を設定します。SOQL文のスペースを+で置き換えた形です。

select+id,NamespacePrefix,MasterLabel,QualifiedApiName,DeveloperName,IsCustomizable+from+Entitydefinition+where+DeveloperName='Account'

image.png

検索結果は以下の通りでした。取引先なのでカスタム項目は追加できます。よってIsCustomizableはtrueです。

image.png

Tooling Queryでのエラー

qパラメータ:where句を省いた検索

select+id,NamespacePrefix,MasterLabel,QualifiedApiName,DeveloperName,IsCustomizable+from+Entitydefinition

結果の件数が多いのかもしれません

[
{
"message": "EntityDefinition does not support queryMore(), use LIMIT to restrict the results to a single batch",
"errorCode": "EXCEEDED_ID_LIMIT"
}
]

qパラメータ:取引先と取引先責任者で検索します

select+id,NamespacePrefix,MasterLabel,QualifiedApiName,DeveloperName,IsCustomizable+from+Entitydefinition+where+DeveloperName='Account'+OR+DeveloperName='Contact'

やはり検索結果の件数が多かったようです。2つのオブジェクトは問題なく検索できます。

image.png

qパラメータ:わざと存在しないオブジェクトを検索

select+id,NamespacePrefix,MasterLabel,QualifiedApiName,DeveloperName,IsCustomizable+from+Entitydefinition+where+DeveloperName='Account1'

{
"size": 0,
"totalSize": 0,
"done": true,
"queryLocator": null,
"entityTypeName": null,
"records": []
}

qパラメータ:カスタムオブジェクトの場合DeveloperNameでは__cは不要です。

select+id,NamespacePrefix,MasterLabel,QualifiedApiName,DeveloperName,IsCustomizable+from+Entitydefinition+where+DeveloperName='Candidate'

image.png

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1