Microsoft Dynamics CRM 2011

Microsoft Dynamics CRM 2011

Friday, August 14, 2015

How to Check Error Codes in Dynamics CRM API Web Service

In this article we see Step by step How to Check Error Codes in Dynamics CRM API Web Service  .
We'll review here in only 5 minutes how to search for the DYNAMICS CRM API web service error codes , such as "0x80041a06" , for example :


How to Check Error Codes in Dynamics CRM API Web Service


How to Check Error Codes in Dynamics CRM API Web Service


The steps are as following:
1) open the error file and find the corresponding XML element for the Entity
2) get the hexadecimal error code for the Entity and get rid of the hexadecimal prefix "0x"
3) search the web for the error without the "0x" prefix


1) Step #1: open the error file and find the XML element for the Entity :

Check Error Codes in Dynamics CRM API Web Service



2) Step #2: get the hexadecimal Error Code without its "0x" prefix :


Error Codes in Dynamics CRM API Web Service




3) Step #3: search the Web for the Error code without the prefix "0X":

How to Check Error Codes




That's all.

Happy programming.....

      by Carmel Schvartzman


כתב: כרמל שוורצמן


Sunday, July 5, 2015

How to Add a custom Button to a CRM 2013 Web Form

In this article we see Step by step How to Add a custom Button to a CRM 2013 Web Form .
We'll review here in only 5 minutes how to create an HTML5 Button at the client side Front End , using only javascript, HTML and CSS3:




The steps are as following:
1) create a CRM field to be the container of the button(set its text as ".")
2) create a web resource containing the following javascript
3) call the web resource from your CRM form, sending as argument the name of your container field.


1) Step #1: create a CRM field to be the container of the button:


The button will be located at the CRM field (called "sFieldName" in the following code).
Try to create a new CRM field to parent the button, and set "." as its text. This way the button will fill the field, and you can locate it wherever you want inside the CRM form.

2) Step #2: create a web resource containing the following javascript:

This is the code that creates the Button:
It just retrieves the HTML5 element wrapping the CRM field where you want the button appended to, and creates an element with a custom button:





Create a Web Resource with the following javascript code (note: this code does not depend on jQuery or any other framework: you can copy-paste it as it is):

function fnXRMClientButton(sFieldName)
{   // sFieldName : "new_somefield"
    
    if (document.getElementById(sFieldName) != null) {
         sFieldName = "field" + sFieldName;
         if (document.getElementById(sFieldName) == null)
         {
            var oParentElement = document.getElementById(sFieldName + "_d");
            oContainerElement = document.createElement("oContainerElement");
            oParentElement.appendChild(oContainerElement, oParentElement);
            
            var btn = document.createElement("button");
            var txt = document.createElement("span");
            txt.innerText = "BUTTON TEXT";            
            btn.id = "btnCallAction";
            btn.appendChild(txt);
            btn.style.margin = "10px";
            btn.style.padding = "5px";
            btn.style.width = "300px";
            btn.style.height = "50px";
            btn.style.textAlign = "center";
            btn.style.borderRadius = "5px";
            btn.style.textShadow = "1px 1px 2px #FFF";
            btn.style.color = "#000";
            btn.style.boxShadow = "#a8a3a3 5px 5px 1px";           
            btn.style.border = "1px double #dcdcdc";           
            btn.style.background = "#f5f5f5";
            btn.style.font = "600 14px Tahoma";
            oContainerElement.appendChild(btn);


            document.getElementById(sFieldName).style.width = "0%";
            btn.onclick = function () {
                OnClickActionFunction(oContainerElement);

            };

        }
    }
}


3) Step #3: call the web resource from your CRM form, sending as argument the name of your container field:


fnXRMClientButton("new_somefield")


That's all.  

Happy programming.....

      by Carmel Schvartzman


כתב: כרמל שוורצמן