当前位置:网站首页>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层的公共的内容,都放在共享项目中。
边栏推荐
- Superfluid_ HQ hacked analysis
- Leetcode1961. 检查字符串是否为数组前缀
- [Jiudu OJ 09] two points to find student information
- Paddle框架:PaddleNLP概述【飞桨自然语言处理开发库】
- A Cooperative Approach to Particle Swarm Optimization
- Basic operations of databases and tables ----- unique constraints
- 干货!通过软硬件协同设计加速稀疏神经网络
- Alibaba canal usage details (pit draining version)_ MySQL and ES data synchronization
- Leetcode skimming questions_ Sum of squares
- yii中console方法调用,yii console定时任务
猜你喜欢
Folio. Ink is a free, fast and easy-to-use image sharing tool

500 lines of code to understand the principle of mecached cache client driver

ORA-00030

02.Go语言开发环境配置

Basic process and testing idea of interface automation

leetcode刷题_验证回文字符串 Ⅱ

【详细】快速实现对象映射的几种方式
![[技术发展-28]:信息通信网大全、新的技术形态、信息通信行业高质量发展概览](/img/94/05b2ff62a8a11340cc94c69645db73.png)
[技术发展-28]:信息通信网大全、新的技术形态、信息通信行业高质量发展概览

How does the crystal oscillator vibrate?

晶振是如何起振的?
随机推荐
MySQL learning notes 2
ThreeDPoseTracker项目解析
【网络攻防实训习题】
安装Redis
Maya hollowed out modeling
MATLB|实时机会约束决策及其在电力系统中的应用
MUX VLAN configuration
Yii console method call, Yii console scheduled task
Redis-Key的操作
伦敦银走势中的假突破
Leetcode skimming questions_ Sum of squares
Leetcode sword finger offer 59 - ii Maximum value of queue
ORA-00030
Leetcode 208. 实现 Trie (前缀树)
国家级非遗传承人高清旺《四大美人》皮影数字藏品惊艳亮相!
File upload vulnerability test based on DVWA
Leetcode 剑指 Offer 59 - II. 队列的最大值
[detailed] several ways to quickly realize object mapping
[技术发展-28]:信息通信网大全、新的技术形态、信息通信行业高质量发展概览
Nmap: network detection tool and security / port scanner