当前位置:网站首页>Dynamics 365 开发协作最佳实践思考
Dynamics 365 开发协作最佳实践思考
2022-07-06 01:35:00 【zcy_wxy】
一、前台开发
1、首先要考虑把常用代码独立成一个公共js,然后在需要用到的时候引入。这样会更便于维护。
2、做请求聚合。如果一个页面中发请求次数太多,且不为异步,就会导致前台卡顿明显。所以为了减少请求次数,做请求聚合,把几次请求整合成一次请求,获取页面需要的数据。
常用的比如说:
锁定和释放窗体属性
/**
* 锁定或解锁属性
* @param {any} attributeName
*/
lockOrUnlockControlByAttributeName: function (attributeName,lock) {
let controls = Xrm.Page.getAttribute(attributeName).controls.getAll();
if (controls) {
for (con of controls) {
con.setDisabled(lock);
}
}
}获取选项集字段名称
/*
* summary:前端获取选项集字段的名称
* author:
* createTime:
*/
getOptionName:function (context, attributeName, value) {
let val = value;
if (val == null || val == undefined) {
val = context.getAttribute(attributeName).getValue();
}
let attrArray = context.getControl(attributeName).getOptions().filter(t => t.value == val);
if (attrArray.length > 0) {
return attrArray[0].text;
}
return "";
}判断用户是否为负责人
/*
* summary:判断用户是否为负责人
* author:
* createTime:
* returns:
*/
function currentUserIsOwner() {
let owner = Xrm.Page.getAttribute("ownerid");
if (owner) {
let ownerid = owner.getValue()[0].id;
return Xrm.Page.context.getUserId() == ownerid;
}
return false;
}
判断用户是否包含指定角色
/*
* summary:判断用户是否拥有某些角色
* author:
* createTime:
* returns:
*/
function currentUserContainRoles(roleNames) {
var roleNameArray = roleNames.split(',');
let userRoles = Xrm.Utility.getGlobalContext().userSettings.roles.getAll();
if (roleNameArray.length > 1) {
let nameSet = new Set();
for (let role of userRoles) {
nameSet.add(role.name);
}
for (let roleName of roleNameArray) {
if (nameSet.has(roleName)) {
return true;
}
}
return false;
}
for (var role of userRoles) {
if (role.name == roleNameArray[0]) {
return true;
}
}
return false;
}等等。
二、插件开发
1、最好是一个实体建一个插件项目,这样既可以避免多人开发时的冲突,也能在解决方案发布时避免多发或者漏发内容。或者根据模块划分插件项目,一个插件项目中只包含单个模块所需的实体。
2、公共模块也最好提取出来,放在共享项目中。按dao、service、controller的分层概念来说,dao层和service层的公共的内容,都放在共享项目中。
边栏推荐
- Crawler request module
- 3D视觉——4.手势识别(Gesture Recognition)入门——使用MediaPipe含单帧(Singel Frame)和实时视频(Real-Time Video)
- Condition and AQS principle
- Folio. Ink is a free, fast and easy-to-use image sharing tool
- Leetcode 208. 实现 Trie (前缀树)
- 晶振是如何起振的?
- ORA-00030
- Loop structure of program (for loop)
- Accelerating spark data access with alluxio in kubernetes
- [Jiudu OJ 09] two points to find student information
猜你喜欢

Basic operations of database and table ----- set the fields of the table to be automatically added

Initialize MySQL database when docker container starts

3D视觉——4.手势识别(Gesture Recognition)入门——使用MediaPipe含单帧(Singel Frame)和实时视频(Real-Time Video)

Docker compose配置MySQL并实现远程连接

Opinions on softmax function

Basic operations of databases and tables ----- default constraints

Kotlin basics 1

General operation method of spot Silver
Folio.ink 免费、快速、易用的图片分享工具

Who knows how to modify the data type accuracy of the columns in the database table of Damon
随机推荐
什么是弱引用?es6中有哪些弱引用数据类型?js中的弱引用是什么?
ctf. Show PHP feature (89~110)
Force buckle 1020 Number of enclaves
037 PHP login, registration, message, personal Center Design
[flask] official tutorial -part1: project layout, application settings, definition and database access
Redis守护进程无法停止解决方案
【Flask】响应、session与Message Flashing
LeetCode 322. Change exchange (dynamic planning)
SPIR-V初窥
Leetcode 剑指 Offer 59 - II. 队列的最大值
How to see the K-line chart of gold price trend?
Accelerating spark data access with alluxio in kubernetes
剑指 Offer 12. 矩阵中的路径
【详细】快速实现对象映射的几种方式
【Flask】官方教程(Tutorial)-part1:项目布局、应用程序设置、定义和访问数据库
[Jiudu OJ 09] two points to find student information
[technology development -28]: overview of information and communication network, new technology forms, high-quality development of information and communication industry
【SSRF-01】服务器端请求伪造漏洞原理及利用实例
Paddle框架:PaddleNLP概述【飛槳自然語言處理開發庫】
Format code_ What does formatting code mean