How to Show/Hide a Button Using the Business Process Flow Stage

In today’s blog, we’ll discuss how to show and hide a button using the Business Process Flow (BPF) stage. In the example, we are going to hide the Close as Won  button for all BPF stages on the Opportunity entity except for the last stage, Opportunity Close, where we will show the Close as Won button. 

First, we will create one new record in the Opportunity entity. After creating the new Opportunity record, the Close as Won button is displayed.

To achieve the Show/Hide button functionality as per Business Process Flow (BPF) stages:

Create a custom JavaScript in which we will check the BPF stage and accordingly we are showing and hiding the button.

Go to the customizations and create one new solution and add an Opportunity form; also, create one new web resource for Javascript.

JavaScript :

function closeAsWonCustomEnable(primaryControl) {
try {
debugger;
var formContext = primaryControl;
var isShowCloseAsWon = false; // Show/Hide Variable for "Close as won " Button
 
//Get active process details
var activeProcess = formContext.data.process.getActiveProcess();
var getActiveProcessName = activeProcess.getName();
 
//Get active Stage details
var activeStage = formContext.data.process.getActiveStage();
var getactivestagename = activeStage.getName();
 
var state = formContext.getAttribute("statecode").getValue();
 
//If Opportunity is already Won then return false
if (state !== 0) // 0 = Open
{
return isShowCloseAsWon;
}
 
//Check the BPF stage name
if (activeProcess != null && getActiveProcessName == "Opportunity Sales Process") {
 
if (getactivestagename === "Opportunity Close") {
isShowCloseAsWon = true;
}
 
}
return isShowCloseAsWon;
} catch (e) {
alert("An error has occurred : " + e.message)
 
}
 
}

  1.2 Creating new web resource (JavaScript)

Once JavaScript is created, open the ribbon workbench and select the solution that contains the Opportunity form.

  1.3 Customize the “close as won” button on form.

Select the button and click Customise command. Next, create a new Enable Rule and add CustomRule inside that. Use below property for CustomRule:

Default : True , invertResult="" , funcationName: closeAsWonCustomEnable ,Javascriptname : new_ showhidebutton

Once you create a new Enable Rule, add that rule inside “Close as won” button command and publish.

  1.4 Create new enable rule for “close as won” button and add that to “close as won” button command.

After publishing the custom rule for Close as Won button, we will go to the Opportunity entity and create one new record.

Once we create a new Opportunity record, we can see in the below screenshot that the Close as won button is not showing:

Now, move to the next stage, and when the last BPF stage arrives for this opportunity (BPF last stage: Opportunity Close) then the JavaScript (new_showhidebutton) will return TRUE and Close as Won button will show:

1.6 “Close as won” button showing on last BPF stage.

How to Show/Hide a Button Using the Business Process Flow Stage的更多相关文章

  1. jquery的hide()和show()

    jquery用hide()和show()函数来控制html元素的显示和隐藏. hide()和show()都可以带参数的,hide(1000)表示隐藏所需的时间为1秒.此外还可以用slow,fast参数 ...

  2. Super Hide IP 3.4.7.8允许您以匿名方式进行网上冲浪、 保持隐藏您的 IP 地址

    Super Hide IP 3.4.7.8 转自:http://www.0daydown.com/04/695.html Super Hide IP允许您以匿名方式进行网上冲浪. 保持隐藏您的 IP ...

  3. ftk学习记录(button一片)

    [ 声明:版权所有所有.欢迎转载,请勿用于商业用途.  联系信箱:feixiaoxing @163.com] 前面,我们说到了label,这里能够看一下label执行的效果是怎么样的. waterma ...

  4. jquery-hide//一段hide代码实现异步隐藏

    (本篇博客没有什么参考价值,只用于自己未来复习.) 说白了就是通过“父亲”实现异步 代码: <!DOCTYPE html> <html> <head> <sc ...

  5. java:JQuery(声明,JQ和JS对象的区别,prop,attr,addClass,offset,trigger,dblclick和change事件,hide,show,toggle,slideUp,slideDown,slideToggle,三种选择器,标签的获取,三张图片的放大与缩小)

    1.JQuery: jQuery是一个快速.简洁的JavaScript框架,是继Prototype之后又一个优秀的JavaScript代码库(或JavaScript框架).jQuery设计 的宗旨是“ ...

  6. 十分钟玩转 jQuery、实例大全

    一.简介 定义 jQuery创始人是美国John Resig,是优秀的Javascript框架: jQuery是一个轻量级.快速简洁的javaScript库.源码戳这 jQuery对象 jQuery产 ...

  7. webParts与Web部件

    web部件是ASP.NET WebForm里面的服务器控件,它涵盖的内容比较多,鉴于这种状况的话鄙人不打算深究下去了,只是局限于了解web.config配置里面的配置内容则可. 那么也得稍微说说啥是W ...

  8. 前端之jquery

    前端之jquery 本节内容 jquery简介 选择器和筛选器 操作元素 示例 1. jquery简介 1 jquery是什么 jQuery由美国人John Resig创建,至今已吸引了来自世界各地的 ...

  9. 【jquery】基础知识

    jquery简介 1 jquery是什么 jquery由美国人John Resig创建,至今已吸引了来自世界各地的众多 javascript高手加入其team. jQuery是继prototype之后 ...

  10. 第五篇:在SOUI中使用XML布局属性指引(pos, offset, pos2type)

    窗口布局的概念 每一个UI都是由大量的界面元素构成的,在Windows编程,这些界面元素的最小单位通常称之为控件. 布局就是这些控件在主界面上的大小及相对位置. 传统的布局一般使用一个4个绝对坐标来定 ...

随机推荐

  1. abap screen表格控件后续增加栏位

    当我们通过screen的表控件(含向导)创建完表格之后,后续想再增加栏位,要先把输入控件拖入表格控件内,再按钮控控件拖进去即可. 注:输入控件的名称和格式要和程序中的一致,否则会显示不出数据 效果图如 ...

  2. ORACLE 配置ST_GEOMETRY以支持SQL方式操作SDE数据库

    这里假设已经在ORACLE里边创建了SDE数据库,在此基础上进行配置: 1.以sde用户登录到oracle,运行一下语句: SELECT * FROM USER_LIBRARIES; CREATE O ...

  3. vue中常用的插件

    1. wangeditor 富文本编辑器,https://www.wangeditor.com/

  4. Java语言出现的背景、影响及应用前景分析

    一.背景 1991年 ,SUN MicroSystem公司的 Jame Gosling. Bill Joe等人 ,为在电视.控制烤面包箱等家用消费类电子产品上进行交互式操作而开发了一个名为Oak的软件 ...

  5. 此平台不支持虚拟化的 Intel VT-x/EPT。不使用虚拟化的 Intel VT-x/EPT,是否继续?

    1.cpu虚拟化是否打开 2.Windows安全中心>设备安全性>内核隔离

  6. vue项目前台带表格的页面,让表格根据屏幕大小自适应高度,小屏幕时不出现多个滚动条

    参见馆藏库房系统, 右侧整体结构一般如下 <el-container class="ml10 mr10 br7 bgw"> <el-main> // el- ...

  7. Python面向对象编程——__init()__方法

    隐式基类object 每个python类都隐式继承object 全文代码实例实现:枚举扑克牌的花色和牌面值 一._init()__方法:对象初始化 显示而非隐式:__init()__应显示展示初始化变 ...

  8. 学习lua-01,遍历集合,多入参循环处理,类型判断,数字运算

    --function maxnum(tab1) -- local b = 1 -- local a = tab1[b] -- for i, v in ipairs(tab1) do -- if v & ...

  9. 命令提示符怎么打开和Dos命令的基本使用

    Dos命令 Dos命令窗口我们可以通过win+R输入cmd来打开 如果要用管理员身份打开直接在开始里搜索命令提示符,以管理员身份打开! 一些简单的Dos命令 //切换盘符 盘符名: //进入 cd / ...

  10. Python 的入门学习之 Day4~6 ——from”夜曲编程“

    Day 4 time: 2021.8.1. 打卡第四天.今天起得很早(7点多一些),很棒,而梳头发更快些就更好了.我也算渐渐养成了晨间学习的习惯吧,一起床就心心念念着Python课程,这让我感觉到了生 ...