Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Open the Same Account Form Which is Opened For Preview

Posted on by 932

As my previous post my need was to preview the selected account information within an html page which was successfully implemented.

Thanks for help.

And now, like i have 4 different account form and the requirement is to open the same account form which is currently open for preview.

I want to open the same account form onClick on Next button.

Preview3.png

Please suggest for the same.

Code For Preview Thwe Account Information:-

<html><head><style type="text/css">
body
{
font-family: Segoe UI, Tahoma, Arial;

}
tbody
{
background-color: white;
align:"center";
}
th
{
background-color: black;
color: White;
align:"center";
}

.closebutton{
background-color: #F3EFF2;
border-style: solid;
color: #1281E3;
padding: 10px 13px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 14px;
margin: 4px 2px;
cursor: pointer;
}
.nextbutton{
background-color: #1281E3;
border-style: solid;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 14px;
margin: 4px 2px;
cursor: pointer;
}

.row
{
margin-right: 0px !important;
margin-left: 0px !important;
}

</style><link rel="stylesheet" href="maxcdn.bootstrapcdn.com/.../bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"><script src="code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script><script src="cdnjs.cloudflare.com/.../popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script><script src="maxcdn.bootstrapcdn.com/.../bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script><meta><meta><meta><meta><meta><meta><meta><meta><meta><meta><meta><meta><meta><meta><meta><meta><meta><meta><meta><meta><meta><meta></head>

<body style="overflow-wrap: break-word;">

<!-- <div style="margin-top:20px">

<h1 align="center">Account Information</h1>


</div> -->

<div style="margin-top:20px;margin-left:100px">

<h4 align="left" id="accname"> </h4>

<!-- <p id="accname"></p> -->


</div>
<div class="container row">
<div class="col">

<div class="card" style="width: 23rem;margin-left: 154px;margin-top: 50px">
<div class="card-header">
Account Details
</div>
<div class="card-body">
<p class="card-text">
<table id="showtable">

</table>
</p></div>
</div>
<div class="card" style="width: 23rem;margin-left: 154px;margin-top: 20px">
<div class="card-header">
Case HIstory
</div>
<div class="card-body">
<table id="showtable1">

</table>
</div>
</div>
</div>
<div class="col">
<div class="card" style="width: 23rem;margin-left: 00px!important;margin-top: 50px">
<div class="card-header">
Account Health
</div>
<div class="card-body">
<table id="showtable2">

</table>
</div>
</div>
<div class="card" style="width: 23rem;margin-left: 00px;margin-top: 20px">
<div class="card-header">
Account Alerts
</div>
<div class="card-body">
<table id="showtable3">

</table>
</div>
</div>
</div>
</div>

<div>
<button style="float: right;" class="nextbutton" onclick="onLoad()">Next</button>
<button style="float: right;" class="closebutton" onclick="myFunction2()">Cancel</button>

</div>

<script type="text/javascript">
document.onreadystatechange = function () {
if (document.readyState == "complete") {
getDataParam();
}
}

function getDataParam() {
//Get the any query string parameters and load them
//into the vals array

var vals = new Array();
if (location.search != "") {
vals = location.search.substr(1).split("&");
for (var i in vals) {
vals[i] = vals[i].replace(/\+/g, " ").split("=");
}
//look for the parameter named 'data'
var found = false;
for (var i in vals) {
if (vals[i][0].toLowerCase() == "data") {
parseDataValue(vals[i][1]);
found = true;
break;
}
}
if (!found)
{ noParams(); }
}
else {
noParams();
}
}

function parseDataValue(datavalue) {
if (datavalue != "") {
var vals = new Array();

var message = document.createElement("p");
// setText(message, "These are the data parameters values that were passed to this page:");
// document.body.appendChild(message);

vals = decodeURIComponent(datavalue).split("&");
for (var i in vals) {
vals[i] = vals[i].replace(/\+/g, " ").split("=");
}

document.getElementById("accname").innerHTML ="Preview: " + vals[0][1];
console.log(vals);
console.log(vals[1][1]);
console.log(vals[1][0]);
//Create a table and header using the DOM
var oTable = document.getElementById("showtable");
var oTable2 = document.getElementById("showtable1");
var oTable1 = document.getElementById("showtable2");
var oTable3 = document.getElementById("showtable3");

var oTBody = document.createElement("tbody");
//Loop through vals and create rows for the table

if(vals[1][1]==" Site")
{

for (var i=1;i<5;i++) {
var oTRow = document.createElement("tr");
var oTRowTD1 = document.createElement("td");
setText(oTRowTD1, vals[i][0]);
var oTRowTD2 = document.createElement("td");
setText(oTRowTD2,":- "+ vals[i][1]);

oTRow.appendChild(oTRowTD1);
oTRow.appendChild(oTRowTD2);
oTBody.appendChild(oTRow);
}
var oTBody1 = document.createElement("tbody");
//Loop through vals and create rows for the table
for (var i=5;i<7;i++) {
var oTRow1 = document.createElement("tr");
var oTRowTD11 = document.createElement("td");
setText(oTRowTD11,vals[i][0]);
var oTRowTD21 = document.createElement("td");
setText(oTRowTD21,":- "+ vals[i][1]);

oTRow1.appendChild(oTRowTD11);
oTRow1.appendChild(oTRowTD21);
oTBody1.appendChild(oTRow1);
}
var oTBody2 = document.createElement("tbody");
//Loop through vals and create rows for the table
for (var i=7;i<10;i++) {
var oTRow2 = document.createElement("tr");
var oTRowTD12 = document.createElement("td");
setText(oTRowTD12, vals[i][0]);
var oTRowTD22 = document.createElement("td");
setText(oTRowTD22,":- "+ vals[i][1]);

oTRow2.appendChild(oTRowTD12);
oTRow2.appendChild(oTRowTD22);
oTBody2.appendChild(oTRow2);
}
var oTBody3 = document.createElement("tbody");
//Loop through vals and create rows for the table
for (var i=10;i<11;i++) {
var oTRow3 = document.createElement("tr");
var oTRowTD13 = document.createElement("td");
setText(oTRowTD13, vals[i][0]);
var oTRowTD23 = document.createElement("td");
setText(oTRowTD23,":- "+ vals[i][1]);

oTRow3.appendChild(oTRowTD13);
oTRow3.appendChild(oTRowTD23);
oTBody3.appendChild(oTRow3);
}

oTable.appendChild(oTBody);
//document.body.appendChild(oTable);
oTable1.appendChild(oTBody1);
//document.body.appendChild(oTable);
oTable2.appendChild(oTBody2);
//document.body.appendChild(oTable);
oTable3.appendChild(oTBody3);
//document.body.appendChild(oTable);

}

else if(vals[1][1]==" Organization")
{

for (var i=1;i<4;i++) {
var oTRow = document.createElement("tr");
var oTRowTD1 = document.createElement("td");
setText(oTRowTD1, vals[i][0]);
var oTRowTD2 = document.createElement("td");
setText(oTRowTD2,":- "+ vals[i][1]);

oTRow.appendChild(oTRowTD1);
oTRow.appendChild(oTRowTD2);
oTBody.appendChild(oTRow);
}
var oTBody1 = document.createElement("tbody");
//Loop through vals and create rows for the table
for (var i=4;i<5;i++) {
var oTRow1 = document.createElement("tr");
var oTRowTD11 = document.createElement("td");
setText(oTRowTD11, vals[i][0]);
var oTRowTD21 = document.createElement("td");
setText(oTRowTD21,":- "+ vals[i][1]);

oTRow1.appendChild(oTRowTD11);
oTRow1.appendChild(oTRowTD21);
oTBody1.appendChild(oTRow1);
}
var oTBody2 = document.createElement("tbody");
//Loop through vals and create rows for the table
for (var i=5;i<9;i++) {
var oTRow2 = document.createElement("tr");
var oTRowTD12 = document.createElement("td");
setText(oTRowTD12, vals[i][0]);
var oTRowTD22 = document.createElement("td");
setText(oTRowTD22,":- "+ vals[i][1]);

oTRow2.appendChild(oTRowTD12);
oTRow2.appendChild(oTRowTD22);
oTBody2.appendChild(oTRow2);
}
var oTBody3 = document.createElement("tbody");
//Loop through vals and create rows for the table
for (var i=9;i<10;i++) {
var oTRow3 = document.createElement("tr");
var oTRowTD13 = document.createElement("td");
setText(oTRowTD13, vals[i][0]);
var oTRowTD23 = document.createElement("td");
setText(oTRowTD23, ":- "+vals[i][1]);

oTRow3.appendChild(oTRowTD13);
oTRow3.appendChild(oTRowTD23);
oTBody3.appendChild(oTRow3);
}

oTable.appendChild(oTBody);
//document.body.appendChild(oTable);
oTable1.appendChild(oTBody1);
//document.body.appendChild(oTable);
oTable2.appendChild(oTBody2);
//document.body.appendChild(oTable);
oTable3.appendChild(oTBody3);
//document.body.appendChild(oTable);

}

else if(vals[1][1]==" Account - Franchise")
{

for (var i=1;i<5;i++) {
var oTRow = document.createElement("tr");
var oTRowTD1 = document.createElement("td");
setText(oTRowTD1, vals[i][0]);
var oTRowTD2 = document.createElement("td");
setText(oTRowTD2, ":- "+vals[i][1]);

oTRow.appendChild(oTRowTD1);
oTRow.appendChild(oTRowTD2);
oTBody.appendChild(oTRow);
}
var oTBody1 = document.createElement("tbody");
//Loop through vals and create rows for the table
for (var i=5;i<7;i++) {
var oTRow1 = document.createElement("tr");
var oTRowTD11 = document.createElement("td");
setText(oTRowTD11, vals[i][0]);
var oTRowTD21 = document.createElement("td");
setText(oTRowTD21, ":- "+vals[i][1]);

oTRow1.appendChild(oTRowTD11);
oTRow1.appendChild(oTRowTD21);
oTBody1.appendChild(oTRow1);
}
var oTBody2 = document.createElement("tbody");
//Loop through vals and create rows for the table
for (var i=7;i<10;i++) {
var oTRow2 = document.createElement("tr");
var oTRowTD12 = document.createElement("td");
setText(oTRowTD12, vals[i][0]);
var oTRowTD22 = document.createElement("td");
setText(oTRowTD22,":- "+ vals[i][1]);

oTRow2.appendChild(oTRowTD12);
oTRow2.appendChild(oTRowTD22);
oTBody2.appendChild(oTRow2);
}
var oTBody3 = document.createElement("tbody");
//Loop through vals and create rows for the table
for (var i=9;i<9;i++) {
var oTRow3 = document.createElement("tr");
var oTRowTD13 = document.createElement("td");
setText(oTRowTD13, vals[i][0]);
var oTRowTD23 = document.createElement("td");
setText(oTRowTD23,":- "+ vals[i][1]);

oTRow3.appendChild(oTRowTD13);
oTRow3.appendChild(oTRowTD23);
oTBody3.appendChild(oTRow3);
}

oTable.appendChild(oTBody);
//document.body.appendChild(oTable);
oTable1.appendChild(oTBody1);
//document.body.appendChild(oTable);
oTable2.appendChild(oTBody2);
//document.body.appendChild(oTable);
oTable3.appendChild(oTBody3);
//document.body.appendChild(oTable);

}

else
{

for (var i=1;i<2;i++) {
var oTRow = document.createElement("tr");
var oTRowTD1 = document.createElement("td");
setText(oTRowTD1, vals[i][0]);
var oTRowTD2 = document.createElement("td");
setText(oTRowTD2, ":- "+vals[i][1]);

oTRow.appendChild(oTRowTD1);
oTRow.appendChild(oTRowTD2);
oTBody.appendChild(oTRow);
}
var oTBody1 = document.createElement("tbody");
//Loop through vals and create rows for the table
for (var i=2;i<3;i++) {
var oTRow1 = document.createElement("tr");
var oTRowTD11 = document.createElement("td");
setText(oTRowTD11, vals[i][0]);
var oTRowTD21 = document.createElement("td");
setText(oTRowTD21,":- "+ vals[i][1]);

oTRow1.appendChild(oTRowTD11);
oTRow1.appendChild(oTRowTD21);
oTBody1.appendChild(oTRow1);
}
var oTBody2 = document.createElement("tbody");
//Loop through vals and create rows for the table
for (var i=3;i<5;i++) {
var oTRow2 = document.createElement("tr");
var oTRowTD12 = document.createElement("td");
setText(oTRowTD12, vals[i][0]);
var oTRowTD22 = document.createElement("td");
setText(oTRowTD22,":- "+ vals[i][1]);

oTRow2.appendChild(oTRowTD12);
oTRow2.appendChild(oTRowTD22);
oTBody2.appendChild(oTRow2);
}
var oTBody3 = document.createElement("tbody");
//Loop through vals and create rows for the table
for (var i=5;i<6;i++) {
var oTRow3 = document.createElement("tr");
var oTRowTD13 = document.createElement("td");
setText(oTRowTD13, vals[i][0]);
var oTRowTD23 = document.createElement("td");
setText(oTRowTD23,":- "+ vals[i][1]);

oTRow3.appendChild(oTRowTD13);
oTRow3.appendChild(oTRowTD23);
oTBody3.appendChild(oTRow3);
}

oTable.appendChild(oTBody);
//document.body.appendChild(oTable);
oTable1.appendChild(oTBody1);
//document.body.appendChild(oTable);
oTable2.appendChild(oTBody2);
//document.body.appendChild(oTable);
oTable3.appendChild(oTBody3);
//document.body.appendChild(oTable);

}



}
else {
noParams();
}
}

function noParams() {
var message = document.createElement("p");
setText(message, "No data parameter was passed to this page");


document.body.appendChild(message);
}
//Added for cross browser support.
function setText(element, text) {
if (typeof element.innerText != "undefined") {
element.innerText = text;
}
else {
element.textContent = text;
}

}

function myFunction2(){
window.close();

}

</script>

</body></html>

*This post is locked for comments

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans