当前位置:网站首页>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层的公共的内容,都放在共享项目中。
边栏推荐
- CocoaPods could not find compatible versions for pod 'Firebase/CoreOnly'
- 01.Go语言介绍
- How does the crystal oscillator vibrate?
- Loop structure of program (for loop)
- Nmap: network detection tool and security / port scanner
- Recommended areas - ways to explore users' future interests
- Threedposetracker project resolution
- Leetcode 剑指 Offer 59 - II. 队列的最大值
- Paddle框架:PaddleNLP概述【飛槳自然語言處理開發庫】
- Maya hollowed out modeling
猜你喜欢

leetcode刷题_反转字符串中的元音字母
Folio.ink 免费、快速、易用的图片分享工具

MATLB|实时机会约束决策及其在电力系统中的应用

国家级非遗传承人高清旺《四大美人》皮影数字藏品惊艳亮相!

【SSRF-01】服务器端请求伪造漏洞原理及利用实例

Leetcode skimming questions_ Sum of squares

Ordinary people end up in Global trade, and a new round of structural opportunities emerge

You are using pip version 21.1.1; however, version 22.0.3 is available. You should consider upgradin

Leetcode skimming questions_ Invert vowels in a string

Force buckle 9 palindromes
随机推荐
Huawei Hrbrid interface and VLAN division based on IP
ORA-00030
Basic operations of database and table ----- delete data table
PHP error what is an error?
3D vision - 4 Getting started with gesture recognition - using mediapipe includes single frame and real time video
Crawler request module
Alibaba-Canal使用详解(排坑版)_MySQL与ES数据同步
How to see the K-line chart of gold price trend?
【全網最全】 |MySQL EXPLAIN 完全解讀
A picture to understand! Why did the school teach you coding but still not
Test de vulnérabilité de téléchargement de fichiers basé sur dvwa
Force buckle 1020 Number of enclaves
Recommended areas - ways to explore users' future interests
General operation method of spot Silver
【全网最全】 |MySQL EXPLAIN 完全解读
剑指 Offer 12. 矩阵中的路径
Docker compose配置MySQL并实现远程连接
[network attack and defense training exercises]
[机缘参悟-39]:鬼谷子-第五飞箝篇 - 警示之二:赞美的六种类型,谨防享受赞美快感如同鱼儿享受诱饵。
Folio. Ink is a free, fast and easy-to-use image sharing tool