【问题标题】:Committing multiple object in one go一次提交多个对象
【发布时间】:2013-05-20 19:07:54
【问题描述】:

我有一种情况,我使用 force.com 网站来运行购物车。在购物车的前 5 页,我收集了信用卡号送货地址等数据。

最后一个按钮称为“下订单”。这是我想将所有内容提交到数据库并向信用卡收费的地方。所以这里是执行顺序:

1) Insert an account.
2) Charge the credit card using a call out webservice.
3) If the charge worked, create a Receipt__c object which is a slave object on the Account.
4) Create a pdf of the Receipt__c object.
5) Display the pdf in an iframe of the client's browser.

现在,如果我正在执行 DML 进程,那么顶点代码将无法调用 Web 服务。所以我不得不在两个按钮中移动这个过程。

其次,在收据为 DML 插入完全执行到数据库之前,apex 代码无法生成 pdf。

最终结果是客户必须快速连续单击 3 个按钮才能处理所有报表。这是有问题的,因为自 1999 年以来,单击按钮就是要走的路。有没有办法在单个顶点代码执行中处理所有这些?

【问题讨论】:

    标签: salesforce force.com


    【解决方案1】:

    你可以这样做:

    <apex:actionFunction name="action1" action="{!action1}" rerender="message" oncomplete="action2()" />
    <apex:actionFunction name="action2" action="{!action2}" rerender="message" />
    <input value="Save" class="btn" onclick="action1();" type="button" />
    

    【讨论】:

      猜你喜欢
      • 2013-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多