MS CRM Dynamics : Label in the form

OOB there is no way to create a Label on the form without value. Then I was wondering if it was possible with another Way. The answer is Yes !!! We will do it with Webresource. And we will give as parameter, the label we want. Then first I Googled how to pass a parameter to a webresource. I found this : http://dynamicscrmcoe.com/passing-custom-parameters-web-resources/ In this blog they give multiple parameter but, we can work with only one
 <html>
 <Head>
 <style>
 
 * {
                 margin: 0;
                 padding: 0;
             }
  label {
     color: #0080ff;
     font-size: 25px;
     text-align: left;
      font-family: Segoe UI, Tahoma, Arial;
      text-decoration: underline;
      font-weight: bold;
 
}
 </style>
 <script type="text/javascript" src="../../ClientGlobalContext.js.aspx"></script>
 
<script type="text/javascript">
 
debugger;
 var CRMCustomParameters = [];
 var GetParameters = function () {
 try{
 
var Parameters = GetGlobalContext().getQueryStringParameters();
 if (typeof Parameters !== "undefined") {
                 CRMCustomParameters = ParseParameters(Parameters.data);
 debugger;
 
                document.getElementById('label').innerHTML =CRMCustomParameters.Label;
 var label = document.createElement("la");
                 label.innerHTML = CRMCustomParameters.Label;
             }
         }
 catch (error) {
             errorHandler(error)
         }
     }
 var ParseParameters = function (Query) {
 try {
 
var ResultParameters = {};
 
//NULL CHECK
 if (Query != undefined && Query != null) {
 
//SPLIR PARAMETERS
 var QuerySplit = Query.split("&");
 
//PARSE PARAMETERS TO ARRAY
 for (var i = 0; i < QuerySplit.length; i++) {
 var ParameterPair = QuerySplit[i].split("=");
                     ResultParameters[ParameterPair[0]] = ParameterPair.length > 1 ? ParameterPair[1] : null; 
                }
             }
 return ResultParameters; 
        }
 catch (error) {
             errorHandler(error);
         }
 }
 </script>
 </head> 
<body onload="GetParameters()"> 
<label id="label"> </label> 
</body> 
</html> 

Commentaires

Posts les plus consultés de ce blog

CRM dynamics V9 wait Async web API to contiue code

Decode/render HTML from a field in crm dynamics