从自定义按钮调用顶点方法 [英] Call a apex method from a custom button

查看:52
本文介绍了从自定义按钮调用顶点方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从自定义按钮调用顶点方法

i want to call a apex method from a custom Button

我意识到我们可以实现这两种方式

I realise we can achieve this 2 ways

  1. 调用VF页面,该页面又调用page属性上的方法
    <apex:page standardController="Opportunity" extensions="oppExt" action="{!changeStatus}"/>

  1. Calling a VF page which in turn calls the method on the page attribute
    <apex:page standardController="Opportunity" extensions="oppExt" action="{!changeStatus}"/>

使用javascript调用webservices方法

use javascript to call the webservices method

我的问题是在这种情况下哪种最佳实践.

The question i have is on the which is best practice to it for this scenario.

谢谢

推荐答案

这取决于您的用例.该API同时支持控制器和扩展 JavaScript远程

It depends on your use case. The API supports both Controllers and Extensions and JavaScript Remoting or JavaScript with Web Services. These methods are all based on defined standards; it's really up to the developer or development team.

JavaScript更适合显示少量数据的界面,但通常更易于使用.

JavaScript is more suited for interfaces that display smaller amounts of data, but it is generally more user friendly.

我建议使用 AJAX工具包 JavaScript远程处理上进行操作.它更适合单字段更新; JavaScript远程处理更适合通过JavaScript访问Apex方法.但是,使用任一方法都可以实现相同的结果.

I'd recommend the AJAX Toolkit over JavaScript Remoting for this task. It's better suited for single field updates; JavaScript Remoting is better suited for accessing Apex methods through JavaScript. However, the same result can be accomplished with either.

这篇关于从自定义按钮调用顶点方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆