[Salesforce]outputPanelのrendered属性

outputPanelのrendered属性

<apex:commandButton reRender="page1,page2" value="Search"/>
<br/>

<apex:OutputPanel id="page1">
	<apex:OutputPanel rendered="{!isDone}">
	<apexageBlock title="title1">
	   title1
	</apex:PageBlock>
	</apex:OutputPanel>
</apex:OutputPanel>


<apex:OutputPanel id="page2">
	<apex:OutputPanel rendered="{!NOT(isDone)}">
	<apex:PageBlock title="title2">
	   title2
	</apex:PageBlock>
	</apex:OutputPanel>
</apex:OutputPanel>

[Salesforce]ApexでawsへファイルDelete

ApexでawsへファイルDelete

    public Integer fileUpload(Attachment file){

        String attachmentBodyEncoded = EncodingUtil.base64Encode(file.Body);
        String formattedDateString = Datetime.now().formatGMT('EEE, dd MMM yyyy HH:mm:ss z');
        String key = awsAccessKey;
        String secret = awsSecretAccessKey;
        String bucketname = awsBucket;
        String host = awsService + '-' + awsReign + '.amazonaws.com'; 
        String method = 'DELETE';
        String fileNameEncoded	= EncodingUtil.urlEncode(file.Name, 'UTF-8');

        HttpRequest req = new HttpRequest();
        req.setMethod(method);
        req.setEndpoint('https://' + bucketname + '.' + host + '/' + bucketname + '/' + fileNameEncoded);
        req.setHeader('Host', bucketname + '.' + host);
        req.setHeader('Content-Length', String.valueOf(attachmentBodyEncoded.length()));
        req.setHeader('Content-Encoding', 'UTF-8');
        req.setHeader('Content-type', file.ContentType);
        req.setHeader('Connection', 'keep-alive');
        req.setHeader('Date', formattedDateString);
        req.setHeader('ACL', 'public-read-write');
        req.setBodyAsBlob(EncodingUtil.base64Decode(attachmentBodyEncoded));
         
        String stringToSign = 'DELETE\n\n' +
        file.ContentType + '\n' +
        formattedDateString + '\n' +
        '/' + bucketname + '/' + bucketname + '/' + fileNameEncoded;
         
        Blob mac = Crypto.generateMac('HMACSHA1', blob.valueof(stringToSign),blob.valueof(secret));
        String signed = EncodingUtil.base64Encode(mac);
        String authHeader = 'AWS' + ' ' + key + ':' + signed;
        req.setHeader('Authorization',authHeader);
         
        Http http = new Http();
        HTTPResponse res = http.send(req);

        return res.getStatusCode();

    }

[Salesforce]Apexをスケジュール設定でApexクラスが検索されない件の対応

Apexをスケジュール設定でApexクラスが検索されない件の対応

検索されないケース

public class  SampleBatchSchedule implements Schedulable {
    public void execute(SchedulableContext sc) {
        SampleBatch batch = new SampleBatch();
        database.executebatch(batch);
    }
 }

検索されるケース

global class  SampleBatchSchedule implements Schedulable {
    public void execute(SchedulableContext sc) {
        SampleBatch batch = new SampleBatch();
        database.executebatch(batch);
    }
 }

[Salesforce]CANNOT_EXECUTE_FLOW_TRIGGER

CANNOT_EXECUTE_FLOW_TRIGGER

テストクラス実行時、エラー詳細

System.DmlException: Insert failed. First exception on row 0; first error: 
CANNOT_EXECUTE_FLOW_TRIGGER, 
「Campaign Create、Member Status Auto Set」処理失敗により、このレコードを保存できません。
Salesforce システム管理者に次の詳細を報告してください。
Salesforce には、削除条件に一致するレコードがありません。
Salesforce には、削除条件に一致するレコードがありません。: []

対応案の一つは以下です。

@isTest(SeeAllData=true)
※場合によって効く。

[Salesforce]Apexバッチの処理内でAPIを実行

Apexバッチの処理内でAPIを実行

Apexバッチの処理内でAPIを実行する場合は『Database.AllowsCallouts』の宣言が必要になります。

global with sharing class testBatch implements Database.Batchable<sObject>, Database.Stateful, Database.AllowsCallouts{
    public testBatch() {

    }
}