Encoding & Decoding
[Technical Method]Let JSON2Apex handle JSON processing in Apex
Let JSON2Apex handle JSON processing in Apex
[Salesforce Recommended Plugins]Salesforce DevTools
Salesforce DevTools
https://chrome.google.com/webstore/detail/salesforce-devtools/ehgmhinnhggigkogkbhnbodhbfjgncjf
Powerful Salesforce developer tools, includes Query Editor, Fields definition, ERDs, Page Layout, and others.
Salesforce DevTools is a powerful Salesforce developer chrome extension for doing the below things : ・Quickly generate Apex code / SOQL, exporting query results to Excel file. ・Quickly access to new record page, list page and object setting page of any object. ・Quickly search object fields and check its usage. ・Display fields API name on Salesforce object detail page. ・Exporting Objects Definition to Excel file. ・Exporting Objects Fields Definition to Excel file. ・Exporting Objects Page Layout Definition to Excel file. ・Exporting Objects List View Definition to Excel file. ・Salesforce data modal (ERDs) generator. ・All Check / Select on profile edit page and field permissions edit page. ・Mass edit, mass delete, mass clone custom fields (Only Classic).
[Salesforce]Salesforce CLI使用の流れ
Salesforce CLI(Command Line Interface)使用の流れ
・Install
https://developer.salesforce.com/ja/tools/sfdxcli
コマンドプロンプトにて、以下のコマンドを実行します。
・sfdx update
Salesforce CLI とプラグインの最新バージョンをインストールするには、次のコマンドを実行します。
・sfdx –version
現在のバージョンを確認します
・sfdx force:auth:web:login -d -a {エイリアス名}
例)sfdx force:auth:web:login -d -a devtest
ここで、「devtest」はエイリアス名
対象組織にログインします
・プロジェクト作成
例)C:\hoge>sfdx force:project:create -n hoge-project
hogeディレクトリ直下に「hoge-project」プロジェクトを作成します。
・対象組織にログインします。
例)C:\hoge>sfdx force:org:open -u test@testtesttestkkkk.com
ここで、ユーザ名「test@testtesttestkkkk.com」の場合
・プロジェクト「hoge-project」にApexクラス取得します。
例)C:\hoge\hoge-project>sfdx force:source:retrieve -m ApexClass -u devtest
ここで、「devtest」はエイリアス名
・パス指定して、取得します。
例)C:\hoge\hoge-project>sfdx force:source:retrieve -p force-app/main/default/classes -u devtest
ここで、「devtest」はエイリアス名
[Salesforce]テストクラスカバー率確認方法
テストクラスカバー率確認方法
select id, ApexClassorTrigger.Name, NumLinesCovered, NumLinesUncovered from ApexCodeCoverageAggregate
Use Tooling API をON にしておく必要があります。

[Technical terms]NITS
「nitpick」 = 些細な指摘(重箱の隅をつつくの意味)
[Technical terms]LGTM
「Looks Good To Me」 = 良いと思います
[Salesforce]Only variable references are allowed in dynamic SOQL/SOSL
エラー:Only variable references are allowed in dynamic SOQL/SOSL
・エラーが起きるケース
List<String> accountIdList = new List<String>();
for(Account account : accountList){
accountIdList.add(account.Id);
}
String query = '';
query = '';
query += ' SELECT Id ';
query += ' , Name ';
query += ' , Account__c ';
query += ' , Account__r.Id ';
query += ' From Test__c ';
query += ' WHERE Account__r.Id IN : \'' + accountIdList + '\'';
system.debug('query:'+query);
List<Test__c> testLsit = Database.query(query);
・エラーが起きないケース
List<String> accountIdList = new List<String>();
for(Account account : accountList){
accountIdList.add(account.Id);
}
String query = '';
query = '';
query += ' SELECT Id ';
query += ' , Name ';
query += ' , Account__c ';
query += ' , Account__r.Id ';
query += ' From Test__c ';
query += ' WHERE Account__r.Id IN : accountIdList ';
system.debug('query:'+query);
List<Test__c> testLsit = Database.query(query);
[Python]except KeyboardInterrupt
except KeyboardInterrupt
Since Ctrl-C
causes KeyboardInterrupt
to be raised, just catch it outside the loop and ignore it.
[Python]KyeboardからWhile LoopでEvent作成
KyeboardからWhile LoopでEvent作成
def sample1(value):
print(value)
try:
while True:
value = input()
sample1(value)
except KeyboardInterrupt:
pass
結果
9
9
0
0