الثلاثاء، 22 ديسمبر 2015

Google Chrome browser error:xmlhttprequest cannot load is not allowed by access-control-allow-origin

In that case you can change the security policy in your Google Chrome browser to allow Access-Control-Allow-Origin. This is very simple:
  1. Create a Chrome browser shortcut
  2. Right click short cut icon -> Properties -> Shortcut -> Target
Simple paste in "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --allow-file-access-from-files --disable-web-security.


الأربعاء، 21 أكتوبر 2015

How To Get Base Currency in CRM 2011,2013,2015

QueryExpression query1 = new QueryExpression("transactioncurrency");
        query1.ColumnSet = new ColumnSet(new string[1] { "isocurrencycode" });
        QueryExpression query2 = query1;
        query2.AddLink("organization", "transactioncurrencyid", "basecurrencyid", JoinOperator.Inner);
        Entity entity = CrmServiceHelper.Service.RetrieveMultiple(query2).Entities[0];
        if (entity == null)
            return;
        string BaseCurrency = entity["isocurrencycode"].ToString().ToUpper();

الخميس، 20 أغسطس 2015

CRM Update Rollup 16:Action Microsoft.Crm.Setup.Common.Update.DBRemoveAction failed

When i try to uninstall the update rollup 16 i get the following error:

Action Microsoft.Crm.Setup.Common.Update.DBRemoveAction failed.

Exception has been thrown by the target of an invocation.

organization With Id = xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx Does Not Exist

Solution:
write the following query in SQL server for MSCRM_Config database:

Select FreindlyName from Organization
where Id='xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx'

then from the deployment manager disable and delete this organization.

الأحد، 26 يوليو 2015

Dynamics CRM 2013 :Read Sub-Grid Cell value

Here is sample code to get sub grid cell value in MS CRM 2013.

function GetSubGridCellValues() {
    if (document.getElementById("SubGridName")) {
        var grid = document.getElementById("SubGridName").control;
        var ids = gridControl.get_allRecordIds();
        for (i = 0; i < ids.length; i++) {
            alert(gridControl.getCellValue('fieldName', ids[i]));
        }
    }
    else {
        setTimeout("GetSubGridCellValues();", 1000);
    }
}

الخميس، 23 يوليو 2015

Disable Subgrid Control in CRM 2013

function DisableSubgrid(SubgridName) {
    var grid = document.getElementById(SubgridName);
    if (!grid) {
        setTimeout("DisableSubgrid('" + SubgridName + "');", 1000);
        return;
    }
    else {
        grid.control.add_onRefresh(function () {
            var gridCtrl = document.getElementById(SubgridName);
            document.getElementById('titleContainer_' + SubgridName).style.display = 'none';
            var nodes = gridCtrl.getElementsByTagName("tr");
            for (var i = 0; i < nodes.length; i++) {
                if (nodes[i].className == "ms-crm-List-Row-Lite") {
                    nodes[i].className = "";
                    nodes[i].removeAttribute("onmouseover");
                    nodes[i].removeAttribute("onclick");
                    nodes[i].removeAttribute("onmouseout");
                    nodes[i].onclick = function (evt) {
                        evt.stopPropagation();
                        evt.preventDefault();
                    }
                    nodes[i].ondblclick = function (evt) {
                        evt.stopPropagation();
                        evt.preventDefault();
                    }
                }
            }
        });

        document.getElementById('titleContainer_' + SubgridName).style.display = 'none';
        var nodes = grid.getElementsByTagName("tr");
        for (var i = 0; i < nodes.length; i++) {
            if (nodes[i].className == "ms-crm-List-Row-Lite") {
                nodes[i].className = "";
                nodes[i].removeAttribute("onmouseover");
                nodes[i].removeAttribute("onclick");
                nodes[i].removeAttribute("onmouseout");
                nodes[i].onclick = function (evt) {
                    evt.stopPropagation();
                    evt.preventDefault();
                }
                nodes[i].ondblclick = function (evt) {
                    evt.stopPropagation();
                    evt.preventDefault();
                }
            }
        }
    }
}

الخميس، 25 يونيو 2015

CRM 2013 Error:Unable to Change Domain Logon Name

When I am trying to add the new user on CRM 2013, i am getting the following error:
"Unable to Change Domain Logon Name"

To solve this issue do the following: 
1- In your CRM server, go to services.msc and check if the "Workstation" service is set to automatic and started 
2- Make sure you have the "AutoGroupManagement" value set to 1 (false) in your registry (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM)

الخميس، 21 مايو 2015

Changing a Websites Name in IIS 7

Run the windows command prompt but ensure you “Run as Administrator” and use the following commands:

cd C:\Windows\SysWOW64\inetsrv

appcmd set site "Old Sit Name" -name:"New Site Name"

الجمعة، 1 مايو 2015

Open Entity Form (New/existing) using JavaScript

//Open a new contact record
Xrm.Utility.openEntityForm("contact");
//Open an existing contact record
Xrm.Utility.openEntityForm("contact","A85C0252-DF8B-E111-997C-00155D8A8410");
//Open a new contact record with a specific form and setting default values
var parameters = {};
parameters["formid"] = "b053a39a-041a-4356-acef-ddf00182762b";
parameters["name"] = "New Contact";
parameters["emailaddress"] = "email@example.com";
//For lookup
parameters["customerid"] = "257b689C8B47-8B9D-E111-883B-1CC1DEEA2718";
parameters["customeridname"] = "Test Cust";

Xrm.Utility.openEntityForm("contact", null, parameters);
//Open a new contact record, move it to the top left corner of the screen, and set the size of the window
var newWindow = Xrm.Utility.openEntityForm("contact");
newWindow.moveTo(0,0);
newWindow.resizeTo(800,600);

///*******************************************************
Opens an HTML web resource:

//**Open an HTML web resource named "new_webResource.htm":
Xrm.Utility.openWebResource("new_webResource.htm");



//**Open an HTML web resource including a single item of data for the data parameter
Xrm.Utility.openWebResource("new_webResource.htm","dataItemValue");



//**Open an HTML web resource passing multiple values through the data parameter
var customParameters = encodeURIComponent("first=First Value&second=Second Value&third=Third Value");
Xrm.Utility.openWebResource("new_webResource.htm",customParameters);

الأحد، 26 أبريل 2015

Open CRM Lookup window in a custom page

function OpenLookup() {
    var serverURL = "http://Server:5555/OrganizationName/_controls/lookup/lookupinfo.aspx?AllowFilterOff=1&DefaultType=2&DefaultViewId=%7b00000000-0000-0000-00AA-000010001004%7d&DisableQuickFind=0&DisableViewPicker=0&LookupStyle=single&ShowNewButton=1&ShowPropButton=1&browse=0&objecttypes=123";


    var lookUp = window.showModalDialog(serverURL, 'entity', "dialogwidth: 750px; dialogheight: 600px; resizable: yes");

    ///For get return values

    //var name = lookUp.items[0].name; var id = lookUp.items[0].id;
    if (lookUp != null) {
        var data = eval('(' + lookUp + ')');
        alert(data.items[0].name + ":" + data.items[0].id);
    }
}

الاثنين، 20 أبريل 2015

Dynamics CRM 2013:Get/Set Business Process stage field value.

Xrm.Page.getControl("header_process_fieldname").getAttribute().setValue(value);  //Set Value

Xrm.Page.getControl("header_process_fieldname").getAttribute().getValue();  //Get Value

 //****** get the Id of business process Satge*******************************
    var StageId = Xrm.Page.getAttribute("stageid").getValue();
    
    if (StageId == "7f5247fe-cfc3-42bc-aa77-b1d836d9b7c0") {
        var Control = Xrm.Page.getControl("header_process_fieldname").getAttribute();
//fire onChange event.
        Control.addOnChange(FunctionName);
    }

الخميس، 16 أبريل 2015

How to assign Equipment/Facility to existed resource group.


//********* Create New Equipment/Facility *******************************
        Entity Equipment = new Entity("equipment");
        Equipment["name"]="Test Equipment 1";
        Equipment["timezonecode"]=1;
        Equipment["businessunitid"] = new EntityReference("businessunit", new Guid("BusinessUnitId"));

        Guid EquipmentId = _Service.Create(Equipment);
        //************************** Retrieve the Resource group***************
        Entity ResourceGroup = _Service.Retrieve("constraintbasedgroup", new Guid("ResourceGroupId"), new ColumnSet(true));
        //********************* Get the constrains of Resource group***************
        System.Text.StringBuilder builder = new System.Text.StringBuilder(ResourceGroup["constraints"].ToString());
        //******* Assing the equipment to resouce group ***************
        builder.Replace("</Body>", " || resource[\"Id\"] ==" + EquipmentId.ToString("B") + " </Body>");

        ResourceGroup["constraints"] = builder.ToString();
        //**************************** Update Resource Group***************
        _Service.Update(ResourceGroup);

الأربعاء، 25 فبراير 2015

الأربعاء، 14 يناير 2015

CRM 2013: Data Encryption error

Microsoft Dynamics CRM 2013 uses standard SQL Server cell level encryption for a set of default entity attributes that contain sensitive information, such as user names and email passwords.
when you try to update user email in user entity you will get the following error:

when you open log file you see the error details "Cannot open Sql Encryption Symmetric Key because Symmetric Key password does not exist in Config DB."
To solve this problem (CRM on premises) :
1- Open SQL server management tool and form CRM database select new query the write the following script:
SELECT [ColumnName],[BitColumn]
FROM [MSCRM_CONFIG].[dbo].[DeploymentProperties]
WHERE ColumnName='DisableSSLCheckForEncryption'

UPDATE [MSCRM_CONFIG].[dbo].[DeploymentProperties]
SET [BitColumn]=1
WHERE ColumnName='DisableSSLCheckForEncryption'


After performing an IISReset on the CRM Server, you’ll be able to see the encryption screen.  Paste the encryption key in to a "CRM > Settings > Data Management > Data Encryption" screen, such as Notepad then click change. As a best practice, save the text file that contains the encryption key on a computer in a secure location on an encrypted hard drive
(if data Encryption status is inactive and current encryption key is null you can use guideGen.exe to generate key then past the the encryption key into "CRM > Settings > Data Management > Data Encryption" screen then click Activate)

الاثنين، 5 يناير 2015

AX2012:Assembly xxxxx containing type is not referenced

assembly works in job but not with the sysoperationFW.
Solution: 
 - Copy ddl to the "Program Files\Microsoft Dynamics AX\60\Sever\[Your AOS Name]\bin\VSassemblies" folder
 - Added the AOS account to the dll file.
- Restarted AOS.