Dynamic Crm 365 实现弹出Web资源html,实现驳回填写意见的功能
前端JS:弹出Html界面
assignCustReviewReturn: function () { var parameters = {}; parameters.roles = custReviewRibbonEvent.getRolesByAuditcate(); var pageInput = { pageType: "webresource", webresourceName: "scc_/html/custreview/operationReturn.html", data: JSON.stringify(parameters) }; var navigationOptions = { target: 2, // 2 is for opening the page as a dialog. width: 350, // default is px. can be specified in % as well. height: 260, // default is px. can be specified in % as well. position: 1 // Specify 1 to open the dialog in center; 2 to open the dialog on the side. Default is 1 (center). }; Xrm.Navigation.navigateTo(pageInput, navigationOptions).then( function success(a) { console.log('调用成功 返回值:' + a.returnValue.reason); if (a.returnValue != null) { if (!a.returnValue.reason) { alert("请输入驳回原因。"); return; } } }, function error(e) { console.log(e); // Handle errors } ); },
Html界面:
DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>驳回title>
<script src="/WebResources/ClientGlobalContext.js.aspx">script>
<link rel="stylesheet" type="text/css" href="/_common/styles/fonts.css.aspx?lcid=2052&ver=-1505408476" id="/_common/styles/fonts.css.aspx?lcid=2052&ver=-1505408476">
<link rel="stylesheet" type="text/css" href="/_common/styles/global.css.aspx?lcid=2052&ver=-1505408476" id="/_common/styles/global.css.aspx?lcid=2052&ver=-1505408476">
<link rel="stylesheet" type="text/css" href="/_common/styles/select.css.aspx?lcid=2052&ver=-1505408476" id="/_common/styles/select.css.aspx?lcid=2052&ver=-1505408476">
<link rel="stylesheet" type="text/css" href="/_common/styles/dialogs.css.aspx?lcid=2052&ver=-1505408476" id="/_common/styles/dialogs.css.aspx?lcid=2052&ver=-1505408476">
<script type="text/javascript">
var _dialogArg;
var _arList;
script>
head>
<body scroll="no" class="">
<div id="crmDialogForm">
<div tabindex="0" id="AccessibilityTitleDiv">
<div class="ms-crm-div-NotVisible">div>
div>
<div id="dialogContainer" style="height: 100%">
<div>
<div id="DlgHdBodyContainer">
<br />
<div id="tab0" isviewporttab="0" style="height:90%">
<table cellspacing="0" cellpadding="0" id="tab1">
<colgroup><col width:"90%">colgroup>
<tbody>
<tr>
<td valign="top">
<div>
<table isviewportsection="0" columns="1" style="table-layout:fixed;" height="1%" valign="top" cellspacing="0" cellpadding="3">
<tbody>
<tr>
<td style="text-align: right;">
<div style="width :80px"><label for="description_id">说明:label>div>
td>
<td>
<textarea class="ms-crm-InlineInput" id="reason" style="width: 250px; height: 80px; line-height: 18px;" aria-multiline="true" maxlength="100">textarea>
td>
tr>
tbody>
table>
div>
td>
tr>
<tr>
tr>
<tr>tr>
<tr>tr>
tbody>
table>
div>
<div id="tdDialogFooter" cellspacing="0" cellpadding="5" style="table-layout: fixed; " columns="2" class="ms-crm-RefreshDialog-Footer-MDD">
<button id="ok_id" onclick="okay()" tabindex="0" type="button" class="ms-crm-RefreshDialog-Button" style="margin-left:10px">确定button>
<button id="cancel_id" onclick="cancel()" tabindex="0" type="button" class="ms-crm-RefreshDialog-Button" style="margin-left:10px">取消button>
div>
div>
div>
div>
div>
<span id="__Page_crmEventManager">span>
<script>
var createPageManager = "crmCreate(Mscrm.PageManager, { \"id\": \"crmPageManager\", \"mode\": \"iframe\", \"executeDeferredActionsOnDemand\": false, \"deferredActionList\": [], \"deferredActionParameters\": [], \"pageOnLoadScriptList\": [], \"rootElement\": \"\" }, null, { \"eventManager\": \"__Page_crmEventManager\" }, null)";
var createEventManager = "crmCreate(Mscrm.EventManager, { \"eventSubscribers\": [], \"childEventManagerIds\": null, \"parentEventManagerId\": \"\", \"id\": \"__Page_crmEventManager\" }, null, {}, null)";
script>
<div id="vakata-contextmenu">div>
body>
html>
<script type="text/javascript">
function okay() {
var context = document.getElementById("reason").value;
if (context) {
console.log(context);
window.returnValue = { reason: context };
window.close();
} else {
alert(" 请填写驳回原因。");
}
}
function cancel() {
console.log("取消")
window.close();
}
script>