Add clickable button in the form
I do it via webressource
<html><head>
<style>
* {
margin: 0;
padding: 0;
}
.button{
background-color: #00B3D9;
color: #FFFFFF;
font-family: Segoe UI, Tahoma, Arial;
font-size: 14px;
padding: 5px 10px 5px 10px;
margin: 0px 4px 3px 1px;
width: 100px;
text-overflow: ellipsis;
display: inline-block;
text-align: center;
overflow: hidden;
white-space: nowrap;
border-radius: 16px;
border :none;
float : left;
border-bottom : none;
}
</style>
<meta><meta><meta></head>
<body onload="LoadFormTabs()" onfocusout="parent.setEmailRange();" style="word-wrap: break-word;">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
function LoadFormTabs()
{
var intraneturl = window.parent.Xrm.Page.getAttribute("fieldname").getValue();
var cardCenter = window.parent.Xrm.Page.getAttribute("fieldname1").getValue();
var btn = document.createElement("BUTTON"); // Create a <button> element
btn.className = "button";
btn.innerHTML = "C&A";
btn.addEventListener('click', openurl.bind(btn, intraneturl))
document.body.appendChild(btn);
var btn2 = document.createElement("BUTTON"); // Create a <button> element
btn2.className = "button";
btn2.innerHTML = "Cards";
btn2.addEventListener('click', openurl.bind(btn2, cardCenter))
document.body.appendChild(btn2);
}
function openurl(intraneturl)
{
window.open(intraneturl);
}
</script>
</body></html>
Commentaires
Enregistrer un commentaire