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. 全国分乡镇第六次人口普查数据shp数据库省市区县街道

    全国分乡镇第六次人口普查数据shp数据库省市区县街道 ==名称:全国第六次人口普查任意十个乡镇的乡镇界地图==数据说明:精确到乡镇级别.==数据:面数据,属性列表(乡镇名.乡镇代码,第六次人口普查分乡 ...

  2. Dynamics 365 如何代表其他用户发送邮件

    举个例子,用户A和用户B,用户B在新建电子邮件时,发件人以用户A的身份去发送邮件,这个时候需要做如下配置才可以. 首先登录用户A,在高级设置->个人设置中,配置允许其他人代表自己发送电子邮件. ...

  3. 【快速学】指针是什么?指针常量、常量指针是什么?(C++)

    0.先上总结 指针是什么?指针是个数据类型.你可以定义一个指针变量,它里面存储的是个地址 如int a=3;,定义了一个int类型的变量a,值为3,它在内存中的地址为&a 同理,int *b= ...

  4. Vue3+vite+Echarts案例大屏可视化--千峰(推荐)

    https://www.bilibili.com/video/BV14u411D7qK?p=33&spm_id_from=pageDriver&vd_source=e2cfe74d93 ...

  5. 关于flex元素超出父元素的解决方法

    左边是label, 右边是input. 设置父级为display:flex; input为flex:1; 然后label 为 white-space: nowrap; 这时input就有可能超出父级. ...

  6. ubuntu 快速安装ninja和gn

    安装ninja: sudo apt install ninja-build 安装gn: sudo apt install generate-ninja

  7. SpringBoot - 参数校验、统一异常、统一响应

    转载自: https://blog.csdn.net/chaitoudaren/article/details/105610962 前言 本篇主要要介绍的就是controller层的处理,一个完整的后 ...

  8. springboot 整合 oss

    一.阿里云配置 获取 accessKeyIdaccessSecret 创建桶 bucketName 二.demo 1.oss.config import org.springframework.bea ...

  9. sequelize的创建接口以及模糊查询

    第一步: 在routes里面复制index.js更改为xxx.js(例如arctile.js) res.json()返回的就是json文件 第二步: 在views里app.js引用路由 第三步:查找数 ...

  10. 5.26 学习SSH

    1.ssh客户端是一种使用Secure Shell协议 连接到运行了ssh服务端的远程服务器上 ssh是比较可靠的,专为远程登录会话和其他网络服务提供安全性的协议 2.