Documentation

 
Paul Nieuwelaar edited this page on 20 Sep 2017 · 4 revisions

Installation & Usage

  1. Download and install the unmanaged solution (recommended), or download the source files from other downloads, and create the required web resources manually using your own publisher prefix and naming style (not recommended as there are hardcoded references in the files).
  2. Make sure to publish all customizations if installing the unmanaged solution, or creating the web resources manually.
  3. Create a new JavaScript web resource or use an existing web resource to create your custom functions which will call the process.js functions.
  4. Add a reference to the process.js web resource on your form or view (the other required files are loaded automatically).
    • For forms, this is simply added through the form properties.
    • For views, add a "JavaScript Function Action" to the "Command Actions" for your button command, calling the process.js web resource, where the function is "isNaN" (without quotes). Using the Ribbon Workbench to edit the command is recommended. 
  5. Add a reference to your custom JavaScript web resource where you're making the calls to process.js. This should be added after the reference to process.js.
  6. Call your custom function from your JavaScript library, e.g. from the command bar button, or from the form onload event.

Supported Functions

Process.callAction

Use this method to execute a custom action (process) and get the response back from the action. The action is called asynchronously, so any code you want executed after the action is called needs to be placed inside the successCallback or errorCallback functions.

Process.callAction(actionName, inputParams, successCallback, errorCallback, url);

Parameters

actionName

  • Type: String. The schema name of the action to call. You can find this on the process.
"new_MyProcess"

inputParams

  • Type: Array of Objects. The input parameters of the action. These should match the input parameters defined in the process. You must include at least all required input parameters. Unless the action is "global", you must also specify a "Target" input parameter of type EntityReference. If no input parameters are required, e.g. if the action is global and there are no other required input parameters, this can be null.
[
{ key: "ParamOne", type: Process.Type.String, value: "Something" },
{ key: "ParamTwo", type: Process.Type.Int, value: 100 },
{ key: "ParamThree", type: Process.Type.EntityReference, value: new Process.EntityReference(entityType, id) }
]
  • Each input parameter Object should contain the following properties:

    • key: The name of the input parameter, exactly as it is specified in the process.
    • type: The type of input parameter, as defined in the process. One of the following types:
      • Process.Type.Bool
      • Process.Type.Float
      • Process.Type.Decimal
      • Process.Type.Int
      • Process.Type.String
      • Process.Type.DateTime
      • Process.Type.EntityReference
      • Process.Type.OptionSet
      • Process.Type.Money
      • Process.Type.Entity
      • Process.Type.EntityCollection
    • value: The value to be passed to the action for the specified input parameter. The type of the value will differ depending on the type of input parameter.
      • Bool: Boolean (e.g. true or false)
      • Float: Number (e.g. 100.123)
      • Decimal: Number (e.g. 100.123)
      • Int: Number (e.g. 100)
      • String: String (e.g. "some value")
      • DateTime: Date Object (e.g. new Date())
      • EntityReference: Object containing the entityType and id of the EntityReference. Can also be created using the helper method: new Process.EntityReference(entityType, id, name);
        • entityType (String): The entity schema name of the EntityReference (e.g. "account")
        • id (String): The GUID of the EntityReference (e.g. "3aff757c-9b55-44c1-af0f-260dca5023eb")
        • name (String): The name of the record, not required (e.g. "Frosty's Ice Cream Store")
      • OptionSet: Number representing the optionset value (e.g. 100000001)
      • Money: Number representing the value (e.g. 200.45)
      • Entity: Object containing the entity definition. Use new Process.Entity(entityName, id, attributes) to create the correct structure.
        • entityName (String): The schema name of the entity (e.g. "account")
        • id (String): The Guid of the record, not required (e.g. "3aff757c-9b55-44c1-af0f-260dca5023eb")
        • attributes (Object): The attributes for the record, not required. Each attribute should be set using the attribute schema name as the key, and the value should be an object containing the value and the type of the attribute. Use new Process.Attribute(value, type) to create the attribute value (e.g. entity.attributes["new_name"] = new Process.Attribute("Some name", Process.Type.String))
          • value: The value of the attribute. This will differ depending on the field type. Use the same formats specified above for input parameters (e.g. new Process.EntityReference(entityType, id) for EntityReferences)
          • type: The type of the field. Use the Process.Type's to define these (e.g. Process.Type.EntityReference)
      • EntityCollection: Array of Entity Objects. Create entity objects using the structure above, and add them to an Array (e.g. [entity1, entity2, entity3]). Note that there is no "new Process.EntityCollection" Object used here, it is just simply an array.

successCallback

  • Type: function. A function to call if the action completes successfully. This should include any code you wish to execute after the action completes. The function should take one parameter, which is a collection of output parameters returned from the action. This function can be declared inline as a dynamic function.
function (params) {
var outputParamOne = params["OutputParamOne"];
alert(outputParamOne);
}
  • params (Object): The output parameters property is an Object containing each of the output parameters.

    • The value of each output parameter can be accessed using the parameter name as defined in the process (e.g. params["OutputParamName"])
    • The type of each value will differ depending on the type of output parameter as defined in the process. These are the same types used for the input parameters, and can be used in the same way, e.g.:
      • String, Int, Decimal, etc: The value represents the actual string/number.
      • EntityReference: The value represents the Process.EntityReference object, containing the entityType, id, and name. Note: Be sure to check for null before accessing the properties (entityType, id, name)
        • entityTypeparams["OutputParam"].entityType returns the entity name (String) of the EntityReference.
        • idparams["OutputParam"].id returns the Guid (String) of the EntityReference.
        • nameparams["OutputParam"].name returns the name (String) of the EntityReference/record.
      • Entity: The value represents the Process.Entity object, containing the entityType, id, attributes, and formattedValues.
        • entityTypeparams["OutputParam"].entityType returns the entity name (String).
        • idparams["OutputParam"].id returns the Guid (String) of the record.
        • attributesparams["OutputParam"].attributes returns the Object of attributes for the record.
          • Access attribute values using: params["OutputParam"].attributes["fieldname"].value. Note: Make sure to check for null before accessing the properties (value, type)
          • Or use the extension method to get the value directly, without requiring a null check: params["OutputParam"].get("fieldname")
        • formattedValuesparams["OutputParam"].formattedValues returns an Object of attributes for the record which have a corresponding formatted value. This includes OptionSet, Bool, and Money fields.
          • Access formatted values using: params["OutputParam"].formattedValues["fieldname"]. The value returned will be the String representation of the field (e.g. "Yes" for Boolean fields, and "$100.00" for Money fields).
      • EntityCollection: The value represents an array of Process.Entity objects. Access each entity using: params["OutputParam"][0] etc, and access individual properties of each entity using the values specified above.

errorCallback

  • Type: function. A function to call if the action fails. This should include any code you wish to execute after the action fails, including any error handling. The function should take up to two parameters, with the first being the error message returned from the action, and the second being the plugin trace. This function can be declared inline as a dynamic function.
function (error, trace) {
alert(error); // Write the trace log to the dev console
if (window.console && console.error) {
console.error(error + "\n" + trace);
}
}

url

  • Type: String. The CRM server base URL. Not required on forms or views. If not specified, it will default to Xrm.Page.context.getClientUrl(). Must be specified where Xrm.Page is not available, e.g. from web resources.
"http://server/org"

Process.callWorkflow

Use this method to execute a custom workflow (process) for a particular record. The workflow is called asynchronously, so any code you want executed after the workflow is called needs to be placed inside the successCallback or errorCallback functions.

Process.callWorkflow(workflowId, recordId, successCallback, errorCallback, url);

Parameters

workflowId

  • Type: String. The Guid of the workflow to call. You can find this in the URL when editing the workflow. Note: Workflow Guid's do not change between systems when deploying customizations. However, if you frown upon hardcoded Guids, you can retrieve the Guid in some other way (using a custom Action, for example).
"ac03c16e-40b2-41c4-9831-4f651b77f394"

recordId

  • Type: String. The Guid of the record to run the workflow against. To run the workflow against the current record (i.e. from a form), you can use Xrm.Page.data.entity.getId().
Xrm.Page.data.entity.getId()

successCallback

  • Type: function. A function to call if the workflow executes successfully. This should include any code you wish to execute after the workflow fires. Note that if the workflow is asynchronous, the successCallback may be called before the workflow actually executes. The successCallback function accepts no parameters, and can be declared inline as a dynamic function.
function () {
alert("Successfully executed workflow.");
}

errorCallback

  • Type: function. A function to call if the workflow fails to execute successfully. This should include any code you wish to execute if the workflow cannot be fired. Note that if the workflow is asynchronous, the errorCallback function will only be called if the workflow cannot be executed, e.g. if the workflow is deactivated. If there are errors in the workflow, the error callback will not be called unless the workflow is real-time (synchronous). The errorCallback function accepts no parameters, and can be declared inline as a dynamic function. function () {
    alert("Error executing workflow.");
}

url

  • Type: String. The CRM server base URL. Not required on forms or views. If not specified, it will default to Xrm.Page.context.getClientUrl(). Must be specified where Xrm.Page is not available, e.g. from web resources.
"http://server/org"

Process.callDialog

Note: This function has been deprecated, and will not be supported going forward (however the function will remain in the solution for the foreseeable future). Please use my other library Alert.js to display dialogs in a more supported way.

Use this method to pop open a custom dialog (process) for a particular record. The dialog is opened in a nice looking CRM light-box where possible, or in a modal dialog when light-box is not available (e.g. from Outlook). Because the dialog is modal, you can also specify a custom callback function when the dialog is completed or cancelled.

Note: Using CRM light-box is UNSUPPORTED, however where it is not supported (such as Outlook), a standard (supported) browser modal dialog is displayed instead. Modal dialogs are not supported in some browsers, so if the lightbox breaks in a future update, this function may only work in IE and Outlook until a patch is released.

Process.callDialog(dialogId, entityName, recordId, callback, url);

Parameters

dialogId

  • Type: String. The Guid of the dialog to call. You can find this in the URL when editing the dialog. Note: Dialog Guid's do not change between systems when deploying customizations. However, if you frown upon hardcoded Guids, you can retrieve the Guid in some other way (using a custom Action, for example).
"ac03c16e-40b2-41c4-9831-4f651b77f393"

entityName

  • Type: String. The schema name of the entity the dialog is being run for.
"account"

recordId

  • Type: String. The Guid of the record to run the dialog against. To run the dialog against the current record (i.e. from a form), you can use Xrm.Page.data.entity.getId().
Xrm.Page.data.entity.getId()

callback

  • Type: function. A function to call when the dialog is closed. This should include any code you wish to execute after the user is finished with the dialog, e.g. to refresh the form. Note that this function will fire whether the user completed the dialog, or closed it without completing it. The callback function accepts no parameters, and can be declared inline as a dynamic function.
function () {
Xrm.Page.data.refresh();
}

url

  • Type: String. The CRM server base URL. Not required on forms or views. If not specified, it will default to Xrm.Page.context.getClientUrl(). Must be specified where Xrm.Page is not available, e.g. from web resources.
"http://server/org"

processjs Documentation的更多相关文章

  1. OpenCASCADE Documentation System

    OpenCASCADE Documentation System eryar@163.com Abstract. Doxygen is the de facto standard tool for g ...

  2. https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform

    https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform

  3. Spring Framework------>version4.3.5.RELAESE----->Reference Documentation学习心得----->Spring Framework中web相关的知识(概述)

    Spring Framework中web相关的知识 1.概述: 参考资料:官网documentation中第22小节内容 关于spring web mvc:  spring framework中拥有自 ...

  4. Spring Framework------>version4.3.5.RELAESE----->Reference Documentation学习心得----->关于spring framework中的beans

    Spring framework中的beans 1.概述 bean其实就是各个类实例化后的对象,即objects spring framework的IOC容器所管理的基本单元就是bean spring ...

  5. Spring Framework------>version4.3.5.RELAESE----->Reference Documentation学习心得----->使用spring framework的IoC容器功能----->方法一:使用XML文件定义beans之间的依赖注入关系

    XML-based configuration metadata(使用XML文件定义beans之间的依赖注入关系) 第一部分 编程思路概述 step1,在XML文件中定义各个bean之间的依赖关系. ...

  6. Spring Framework------>version4.3.5.RELAESE----->Reference Documentation学习心得----->使用Spring Framework开发自己的应用程序

    1.直接基于spring framework开发自己的应用程序: 1.1参考资料: Spring官网spring-framework.4.3.5.RELAESE的Reference Documenta ...

  7. Apache安装问题:configure: error: APR not found . Please read the documentation

    Linux上安装Apache时,编译出现错误: checking for APR... no configure: error: APR not found .  Please read the do ...

  8. 解决编译apache出现的问题:configure: error: APR not found . Please read the documentation

    今日编译apache时出错: #./configure --prefix……检查编辑环境时出现: checking for APR... no configure: error: APR not fo ...

  9. 发现不错的cache系统Cache Manager Documentation

    http://cachemanager.net/Documentation/Index/cachemanager_architecture https://www.nuget.org/packages ...

随机推荐

  1. ORACLE中使用row_number over()排序

    from:http://blog.csdn.net/iw1210/article/details/11937085 意图:实现select top 1 * from tablename Oracle  ...

  2. Oracle优化之旅:使用leading, use_nl, rownum调优例子

    1.使用leading和use_nl来设置表的查询顺序,来加快查询速度,一般把小表设为第一个表. /*+LEADING(TABLE)*/  将指定的表作为连接次序中的首表. /*+USE_NL(TAB ...

  3. CSS 选择器 选择 拥有多个类名 的元素

    今天开发的时候,碰到这个连起来的类名. 才想起来,这个类似于 <div class="node hide"></div> 连起来写,表示找到  拥有这两个类 ...

  4. Mac High Sierra 降级安装Mac Sierra

    1>.将你装备好的U盘用Mac自带的磁盘管理工具格式化成Mac OS扩展(日志式),名称输入disk:2>.打开终端工具,按以下步骤操作:(均不含引号,如未设置系统密码,请前往设置> ...

  5. 3 第一个Django应用 第2部分(管理站点)

    Django会根据你写的模型文件完全自动地生成管理界面. 管理界面不是让访问网站的人使用的,它服务于网站管理者. 它用于网站的管理员. 3.1创建一个管理员用户 3.2进入管理站点 3.3管理站点的功 ...

  6. 2. Net、ASP.Net、C#、VisualStudio之间的关系

    .Net一般指的是.NetFramework 是一个开发和运行环境,是框架, 提供了基础的.Net类.这些类可以被任何一种.Net编程语言调用,.NetFramework还提供了CLR,JIT,GC等 ...

  7. Alpha冲刺4

    前言 队名:拖鞋旅游队 组长博客:https://www.cnblogs.com/Sulumer/p/9979357.html 作业博客:https://edu.cnblogs.com/campus/ ...

  8. JAVA学习笔记系列2-Java程序的运行机制

    计算机高级语言的类型主要有编译型和解释型两种,而java语言是两种类型的结合. java首先利用文本编辑器编写java源程序,源文件后缀名为.java,再利用编译器(javac)将源程序编译成字节码文 ...

  9. 剑指Offer 38. 二叉树的深度 (二叉树)

    题目描述 输入一棵二叉树,求该树的深度.从根结点到叶结点依次经过的结点(含根.叶结点)形成树的一条路径,最长路径的长度为树的深度. 题目地址 https://www.nowcoder.com/prac ...

  10. Windows 应用商店无法下载---启动更新

    今天想在应用商店下载东西,但是以直没成功,查看原因结果是因为我的Windows自动更新关了. 百度,如何打开自动更新,要打开本地组策略编辑器,但是我是Windows家庭版,,,没有这个东西,, 最后, ...