【Salesforce】開発コンソールエラー:TotalRequests Limit exceeded

Salesforce】開発コンソールエラー:TotalRequests Limit exceeded

 

設定>管理>組織プロファイル>組織情報

API 要求数 (この 24 時間以内) 15,042 (15,000 最大)

原因:

API要求数(24時間以内)制限値を超えたため。

 

参考URL

https://developer.salesforce.com/forums/?id=906F00000008mDCIAY

【Salesforce】List index out of bounds: 0

Salesforce】List index out of bounds: 0

 

例:

List<custom obj__c> lrecords=[
select Id,name,
from custom obj__c
];

lrecords[0].Fileld1__c = 2;
lrecords[0].Fileld2__c =3;
update lrecords;

上記を実行してlrecordsのリストサイズが0件の場合、lrecords[0]を呼び出し、または値を登録時に発生するエラー

System.ListException: List index out of bounds: 0

 

(対応)案:

List<custom obj__c> lrecords=[
select Id,name,
from custom obj__c
];

if (lrecords.size()>0)
{
lrecords[0].Fileld1__c = 2;
lrecords[0].Fileld2__c =3;
update lrecords;
}

上記のように、リストの結果のサイズを確認して、0件以上だったら、処理する。

 

参考URL

https://developer.salesforce.com/forums/?id=906F000000092gOIAQ

【Salesforce】beforeトリガとafterトリガ

Salesforce】beforeトリガとafterトリガ

 

beforeトリガ

レコードがDBに保存される前に起動

 

afterトリガ

レコードがDBに保存された後に起動

 

実行手順

beforeトリガ → 必須、入力規則のチェック → afterトリガ

 

使い分け

beforeトリガ : 入力規則のチェックより前に実施したい場合

afterトリガ : DBで設定された値にアクセスしたい場合

 

参考URL

http://blog.flect.co.jp/salesforce/2011/04/beforeafter-0f2d.html

 

https://stackoverflow.com/questions/43375534/trigger-on-account-to-update-contact

【Salesforce】Ending position out of bounds: 3

Salesforce】Ending position out of bounds: 3

 

例:

String areaCodeA = phone.substring(0,3); 

 

エラー:

Ending position out of bounds: 3

 

対策:

if(phone.Length()>=3){

    String areaCodeA = phone.substring(0,3); 

}

 

参考URL

https://developer.salesforce.com/forums/?id=906F0000000kAICIA2