crm中打开自定义页面

  var ClientUrl = Xrm.Page.context.getClientUrl();
    var id = Xrm.Page.data.entity.getId().replace("{", "").replace("}", "");
    var openhtlm = ClientUrl + "/WebResources/new_qccSearch?id=" + id;
    var iWidth = window.screen.availWidth * 0.84;
    var iHeight = window.screen.availHeight * 0.74;
    var iTop = (window.screen.height - 30 - iHeight) / 2;       //获得窗口的垂直位置;
    var iLeft = (window.screen.width - 10 - iWidth) / 2;        //获得窗口的水平位置;
    window.open(openhtlm, null, 'height=' + iHeight + ',innerHeight=' + iHeight + ',width=' + iWidth + ',innerWidth=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');


//自定义页面获取值
var id = getQueryVariable("id");
///
//获取url上的传参
//variable=参数名
//
function getQueryVariable(variable) {
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        if (pair[0] == variable) {
            return pair[1];
        }
    }
    return (false);
}
var parameters = {};
                parameters.entityid = Xrm.Page.data.entity.getId();
                parameters.entityname = Xrm.Page.data.entity.getEntityName();
                parameters.entityurl = "";//url
                var pageInputs = {
                    pageType: "webresource",
                    webresourceName: "xxx.html",
                    data: JSON.stringify(parameters)
                };
                var navigationOptions = {
                    target: 2,
                    width: Xrm.Page.context.client.getClient() === "Mobile" ? 200 : 500, // value specified in pixel
                    height: 200, // value specified in pixel
                    position: 1
                };
                Xrm.Navigation.navigateTo(pageInputs, navigationOptions).then(
                    function success() {
                        // Run code on success
                    },
                    function error() {
                        // Handle errors
                    }
                )
//自定义页面接收值
<script>
 var _this = this;
    var Wourl = decodeURIComponent(location.search);
    if (Wourl.indexOf("?") != -1) {
        var str = Wourl.substr(1)
        strs = str.split("&");
        var key = new Array(strs.length);
        var value = new Array(strs.length);
        for (i = 0; i < strs.length; i++) {
            key[i] = strs[i].split("=")[0]
            value[i] = unescape(strs[i].split("=")[1]);
        }
    }
    var data = JSON.parse(value);
    let entityid = data.entityid
    let entityname = data.entityname
    let entityurl = data.entityurl
</script>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值