こんにちは、管理人の@Salesforce.Zです。
SalesforceのB2B Commerceを使うと今のところでは、情報が少ないため、分かるものをメモします。
読んだら得ること
★ Apex でのCCRZ.RemoteInvocation ★ VFでのinvokeCtxのコール
目次
CCRZ.RemoteInvocation
Salesforce Remote Actionをベースにしているです。
サンプルAPEXコード
global class MyClass{ @RemoteAction global static ccrz.cc_RemoteActionResult doSomething( ccrz.cc_RemoteActionContext ctx, String whatToDo ){ ccrz.cc_RemoteActionResult res = ccrz.cc_CallContext.init(ctx); try{ //Execute business logic using whatToDo here res.success = true; }catch(Exception e){ ccrz.ccLog.log(LoggingLevel.ERROR,'Err',e); //Exception handling here }finally{ ccrz.ccLog.close(res); } return res; } }
サンプルVFコード
var remoteModel = = _.extend(CCRZ.RemoteInvocation, { className : 'MyClass'}); remoteModel.invokeCtx('doSomething', 'test what todo', function (resp, evt) { if (evt.status) { console.log(' remote '); if (resp && resp.success) {//response was successful //Execute next business call here } else { //handle response error here } } else { //handle standard RemoteAction failure here } }, { buffer: false, //this call will be executed by itself nmsp: false //defines that this is a call to a subscriber class } );
終わりに
例文が少ないので、ひとまずメモしました。