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. <<运算?&=、|=、 ^=、<<=、>>=的意思? 十六进制前缀是 0x。

    <<运算? a<<b 表示把a转为二进制后左移b位(在后面添加 b个0).例如100的二进制表示为1100100,100左移2位后(后面加2个零):1100100<< ...

  2. pgsql 查询结果转换为json数组

    select array_to_json(array_agg(row_to_json(t))) from (SELECT * FROM test) t

  3. 第一章MySQL架构

    1.MySQL架构1.1连接管理与安全性 cpu维护缓存区,存储已就绪的线程,线程驻守在一个cpu上,创建销毁不用重新创建线程.1.2优化与执行 MySQL解析查询进行各种优化包括重写查询.决定表的读 ...

  4. antdVue--Upload使用

    1.实现功能:文件上传.下载以及删除  不过API中的下载监听方法download一直没有触发,(不确定是我写的有问题还是咋地,反正就是触发不了下载)随用预览的监听方法preview来实现了下载. 组 ...

  5. React中使用CSS的N种方式

    1.在组件中直接使用style,注意,div1各个属性值加双引号 const div1 = { width: "300px", margin: "30px auto&qu ...

  6. JDK8的异步处理方式-CompletableFuture的使用

    一.背景 jdk8中加入了实现类CompletableFuture,用于异步编程.底层做任务使用的是ForkJoin, 顾名思义,是将任务的数据集分为多个子数据集,而每个子集,都可以由独立的子任务来处 ...

  7. el-dialog 嵌套子组件数据不刷新

    <!-- 展示通道测量值 -->     <el-dialog :title="analogTitle" :visible.sync="analogOp ...

  8. 《Unix/Linux系统编程》第十四章学习笔记 20201209戴骏

    MySQL数据库系统 知识点总结 一.MySQL MySQL是一个关系型数据库管理系统,由瑞典MySQL AB 公司开发,目前属于Oracle 旗下产品.MySQL 是最流行的关系型数据库管理系统之一 ...

  9. Java-Java数据类型对应MySql数据类型

    开发过程中常用的数据类型:   Java Mysql 备注 整型 java.lang.Integer tinyint(m) 1个字节  范围(-128~127)  java.lang.Integer ...

  10. python菜鸟学习: 5.字符串的基本用法,进度条显示

    # -*- coding: utf-8 -*-import sys,timestr1 = "my name is liyuzhoupan"# 首字母大写print(str1.cap ...