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. ORACLE之自治事务

    在创建存储过程时,可以用关键字: PRAGMA AUTONOMOUS_TRANSACTION 创建自治事务. 常用场景: 触发器抛错导致事务回滚,日志的记录需要用自治事务进行记录 代码抛错,导致数据库 ...

  2. C# 实现窗体底部滚动字幕

    使用的控件 panel和label及其定时器. 实现原理 通过定时器定时将label的位置在panel上进行移动,实现滚动的视觉效果,此处将label放在panel上的好处是可以单独设置滚动字母的背景 ...

  3. No.1.5

    优先级:不同选择器具有不同的优先级,优先级高的选择器样式会覆盖优先级低选择器的样式 优先级公式:!imporant>行内样式>id选择器>类选择器>标签选择器>通配符选择 ...

  4. UE4.27 新版本像素流送插件配置

    UE4.27 像素流送新版插件部署命令 以下内容参考自UE5官方文档:https://docs.unrealengine.com/5.0/en-US/unreal-engine-pixel-strea ...

  5. js apply 与 call

    简介 用来调用方法,第一个参数替换掉用方法的this对象 区别:call:A.fn.call(B, arg1,arg2,argn...),后面的参数用逗号分隔 apply:A.fn.apply(B, ...

  6. 05 RDD练习:词频统计

    一.词频统计: 1.读文本文件生成RDD lines 2.将一行一行的文本分割成单词 words flatmap() 3.全部转换为小写 lower() 4.去掉长度小于3的单词 filter() 5 ...

  7. pytest与allure的使用

    --需要先安装pytest [1]数据驱动@pytest.mark.parametrize: @pytest.mark.parametrize只对于同一用例不同数据的传参 ①只有一个参数时 datat ...

  8. python中的字典数据读取

    ①字典中嵌套字典 res1={'content': {'age': '47岁', 'ageOne': 47, 'ageOneUnit': '1', 'ageTwo': '8', 'ageTwoUnit ...

  9. matlab读写文件

    dsp,fpga这些产生的文件大部分都是二进制存储的,知道格式后可以直接读取. 读取后的"可懂"数据如何以"可懂"的形式保存在.dat,.txt,.csv之类文 ...

  10. WPF_MahApps.Metro界面主题使用

    一.创建WPF项目: 二.下载MahApps.Metro: 三.修改MainWindow.xaml 1.添加一栏: xmlns:mah="clr-namespace:MahApps.Metr ...