Menu Close

Blog

Microsoft Business Applications Blogposts, YouTube Videos and Podcasts

Helping Businesses with Technology

Microsoft Business Applications Blogposts, YouTube Videos and Podcasts

Helping Businesses with Technology

Microsoft Business Applications Blogposts, YouTube Videos and Podcasts

Helping Businesses with Technology

previous arrow
next arrow
Slider

BUSINESS ERROR AFTER SOLUTION DEPLOYED ON TO PRODUCTION MS CRM 2013

PRODUCTION ERROR IN MS CRM 2013

Hi All,

I have came across a situation where i have deployed the Managed solution on the Onpremises MS CRM 2013 Production Environment for one of my client.

It came up “Business Error” when the users trying to update the Account record.

After quick glance, i figure out the problem  is in the new solution which i have deployed, as the new solution have some entities and the production users don’t have access to them.

Go to Settings >  Administration >  Security Roles > Business Development(Security role name) >

Select the “Custom Entities”  then select the new entities and set permissions for the security role.

Hence the problem has been resolved.

I Hope This Helps

Cheers:-) 

Share this:

CRM 2011 Developer Tools target location for Visual Studio 2010 vs Visual Studio 2012

CRM 2011 Developer Tools target location for Visual Studio 2010 vs Visual Studio 2012

  

The path for the targets is different for the Developer Toolkit for Visual Studio 2010 and Visual Studio 2012. This can cause errors when loading the Visual Studio project in the form of the error

The imported project “C:Program Files (x86)MSBuildMicrosoftCRMMicrosoft.CrmDeveloperTools.CrmClient.targets” was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

or when attempting to deploy the CrmPackage project from Visual Studio 2010 as the error

Error connecting to CRM Server. [A]Microsoft.CrmDeveloperTools.CrmClient.Entities.Solution cannot be cast to [B]Microsoft.CrmDeveloperTools.CrmClient.Entities.Solution. Type A originates from ‘Microsoft.CrmDeveloperTools.CrmClient, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ in the context ‘LoadFrom’ at location ‘C:Program Files (x86)Microsoft Visual Studio 10.0Common7IDEExtensionsMicrosoftDynamics CRM 2011 Developer Tools1.0Microsoft.CrmDeveloperTools.CrmClient.dll’. Type B originates from ‘Microsoft.CrmDeveloperTools, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ in the context ‘LoadFrom’ at location ‘C:Program Files (x86)MSBuildMicrosoftCRMMicrosoft.CrmDeveloperTools.dll’.

or when attempting to deploy the CrmPackage project from Visual Studio 2012 as the error

Error connecting to CRM Server. [A]Microsoft.CrmDeveloperTools.CrmClient.Entities.Solution cannot be cast to [B]Microsoft.CrmDeveloperTools.CrmClient.Entities.Solution. Type A originates from ‘Microsoft.CrmDeveloperTools, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ in the context ‘LoadFrom’ at location ‘C:Program Files (x86)Microsoft Visual Studio 11.0Common7IDEExtensionsMicrosoftDynamics CRM 2011 Developer Tools1.0Microsoft.CrmDeveloperTools.dll’. Type B originates from ‘Microsoft.CrmDeveloperTools.CrmClient, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ in the context ‘LoadFrom’ at location ‘C:Program Files (x86)MSBuildMicrosoftCRMMicrosoft.CrmDeveloperTools.CrmClient.dll’.

depending on the combination of Visual Studio version, installed Developer Toolkit version and previously installed Developer Toolkit versions.
In order to resolve any of these, make sure that the correct targets are referenced in the CrmPackage.csproj file:

  1. In Visual Studio, right click the CrmPackage project and click Unload Project.
  2. Right click on the CrmPackage project and click edit CrmPackage.csproj.
  3. Find the line starting with “<Import Project=”$(MSBuildExtensionsPath32)MicrosoftCRM” and replace it with the correct path from the list below.
  4. Save and close the file.
  5. Right click on the CrmPackage project and click Reload Project.
Visual Studio 2010
<Import Project="$(MSBuildExtensionsPath32)MicrosoftCRMMicrosoft.CrmDeveloperTools.CrmClient.targets" />
Visual Studio 2012
<Import Project="$(MSBuildExtensionsPath32)MicrosoftCRMMicrosoft.CrmDeveloperTools.12.targets" />
Share this:

CASCADE THE TWO OPTION SET FILEDS

Hi

I came across the scenario:

There is a “Discipline” Optionset , “Specialty” Optionset  and “Sub-Specialty” Two Option Set based on the discipline selected the specialty optionset  will filter and based on the filtered options on the specialty the Sub-Specialty selection  will be filtered.

Here is the javascript code to implement the logic…

function disciplineOptionSet_OnChanged() {
    try {

        var optionsetControl = Xrm.Page.ui.controls.get(“new_speciality”);
        var options = optionsetControl.getAttribute().getOptions();
        var type = Xrm.Page.getAttribute(“new_discipline”).getValue();
        if (type == 356110000) {
            optionsetControl.clearOptions();
            for (var i = 0; i < options.length – 1; i++) {
                if (options[i].value == 356110019 || options[i].value == 356110020 || options[i].value == 356110021 || options[i].value == 356110022 || options[i].value == 356110023 || options[i].value == 356110024 || options[i].value == 356110025 || options[i].value == 356110026 || options[i].value == 356110027 || options[i].value == 356110028 || options[i].value == 356110029 || options[i].value == 356110030 || options[i].value == 356110031 || options[i].value == 356110032 || options[i].value == 356110033 || options[i].value == 356110034 || options[i].value == 356110035 || options[i].value == 356110036 || options[i].value == 356110037 || options[i].value == 356110038 || options[i].value == 356110039 || options[i].value == 356110040 || options[i].value == 356110041 || options[i].value == 356110042 || options[i].value == 356110043 || options[i].value == 356110044 || options[i].value == 356110045 || options[i].value == 356110046 || options[i].value == 356110047) {
                    optionsetControl.addOption(options[i], options[i].value);
                }
            }
            //TO DO : Disable/Enable field
        }
        else if (type == 356110001) {
            optionsetControl.clearOptions();
            for (var i = 0; i < options.length – 1; i++) {
                if (options[i].value == 356110003 || options[i].value == 356110034) {
                    optionsetControl.addOption(options[i], options[i].value);
                }

            }
            //TO DO : Disable/Enable field
        }
        else if (type == 356110002) {
            optionsetControl.clearOptions();
            for (var i = 0; i < options.length – 1; i++) {
                if (options[i].value == 356110049) {

                    optionsetControl.addOption(options[i], options[i].value);
                }

            }
        }
        else if (type == 356110003) {
            optionsetControl.clearOptions();
            for (var i = 0; i < options.length – 1; i++) {
                if (options[i].value == 356110050) {
                    optionsetControl.addOption(options[i], options[i].value);
                }

            }
            //TO DO : Disable/Enable field
        }
        else if (type == 356110004) {
            optionsetControl.clearOptions();
            for (var i = 0; i < options.length – 1; i++) {
                if (options[i].value == 356110051 || options[i].value == 356110052) {

                    optionsetControl.addOption(options[i], options[i].value);
                }

            }
            //TO DO : Disable/Enable field
        }
        else if (type == 356110005) {
            optionsetControl.clearOptions();
            for (var i = 0; i < options.length – 1; i++) {
                if (options[i].value == 356110018 || options[i].value == 356110019 || options[i].value == 356110016 || options[i].value == 356110003 || options[i].value == 356110000 || options[i].value == 356110014 || options[i].value == 356110004 || options[i].value == 356110009 || options[i].value == 356110017 || options[i].value == 356110015 || options[i].value == 356110002 || options[i].value == 356110001) {

                    optionsetControl.addOption(options[i], options[i].value);
                }

            }
            //TO DO : Disable/Enable field
        }
        else {

            optionsetControl.clearOptions();
            for (var i = 0; i < options.length – 1; i++) {

                optionsetControl.addOption(options[i]);

            }
            //TO DO : Disable/Enable field
        }
    } catch (e) {
        alert(e);
    }
}
//onLoad event
function Onload_Consultant_Schema() {
    disciplineOptionSet_OnChanged();
    enableDisablesubspecility_OnChange();
}
function onChange_speciality() {
    enableDisablesubspecility_OnChange();
}
enableDisablesubspecility_OnChange = function () {
    //TO DO : Disable all field
    Disable_all_specility_Consultant();
    var type = Xrm.Page.getAttribute(“new_speciality”).getValue();
    if (type == 356110019) {
        Xrm.Page.getControl(“new_anaesthetics”).setDisabled(false);
        Xrm.Page.getAttribute(“new_anaesthetics”).setValue(1);
    } else if (type == 356110020) {
        Xrm.Page.getControl(“new_audiologicalmedicine”).setDisabled(false);
        Xrm.Page.getAttribute(“new_audiologicalmedicine”).setValue(1);
    }
    else if (type == 356110021) {
        Xrm.Page.getControl(“new_cardiology”).setDisabled(false);
        Xrm.Page.getAttribute(“new_cardiology”).setValue(1);
    }
    else if (type == 356110022) {
        Xrm.Page.getControl(“new_clinicalgenetics”).setDisabled(false);
        Xrm.Page.getAttribute(“new_clinicalgenetics”).setValue(1);
    }
    else if (type == 356110023) {
        Xrm.Page.getControl(“new_clinicalimmunologyandallergyservice”).setDisabled(false);
        Xrm.Page.getAttribute(“new_clinicalimmunologyandallergyservice”).setValue(1);
    }
    else if (type == 356110024) {
        Xrm.Page.getControl(“new_clinicalpharmacology”).setDisabled(false);
        Xrm.Page.getAttribute(“new_clinicalpharmacology”).setValue(1);
    }
    else if (type == 356110025) {
        Xrm.Page.getControl(“new_criticalcaremedicine”).setDisabled(false);
        Xrm.Page.getAttribute(“new_criticalcaremedicine”).setValue(1);
    }
    else if (type == 356110026) {
        Xrm.Page.getControl(“new_dermatology”).setDisabled(false);
        Xrm.Page.getAttribute(“new_dermatology”).setValue(1);
    }
    else if (type == 356110027) {
        Xrm.Page.getControl(“new_endocrinology”).setDisabled(false);
        Xrm.Page.getAttribute(“new_endocrinology”).setValue(1);
    }
    else if (type == 356110028) {
        Xrm.Page.getControl(“new_gastroenterology”).setDisabled(false);
        Xrm.Page.getAttribute(“new_gastroenterology”).setValue(1);
    }
    else if (type == 356110004) {
        Xrm.Page.getControl(“new_ophthalmology”).setDisabled(false);
        Xrm.Page.getAttribute(“new_ophthalmology”).setValue(1);
    }
    else if (type == 356110009) {
        Xrm.Page.getControl(“new_maxillofacialsurgery”).setDisabled(false);
        Xrm.Page.getAttribute(“new_maxillofacialsurgery”).setValue(1);
    }
    else if (type == 356110017) {
        Xrm.Page.getControl(“new_paediatricsurgery”).setDisabled(false);
        Xrm.Page.getAttribute(“new_paediatricsurgery”).setValue(1);
    }
    else if (type == 356110015) {
        Xrm.Page.getControl(“new_plasticsurgery”).setDisabled(false);
        Xrm.Page.getAttribute(“new_plasticsurgery”).setValue(1);

    }
    else if (type == 356110002) {
        Xrm.Page.getControl(“new_traumaorthopaedics”).setDisabled(false);
        Xrm.Page.getAttribute(“new_traumaorthopaedics”).setValue(1);

    }
    else if (type == 356110001) {
        Xrm.Page.getControl(“new_urology”).setDisabled(false);
        Xrm.Page.getAttribute(“new_urology”).setValue(1);

    }
    else if (type == 356110000) {
        Xrm.Page.getControl(“new_breastsurgery”).setDisabled(false);
        Xrm.Page.getControl(“new_colorectalsurgery”).setDisabled(false);
        Xrm.Page.getControl(“new_generalsurgery”).setDisabled(false);
        Xrm.Page.getControl(“new_transplantationsurgery”).setDisabled(false);
        Xrm.Page.getControl(“new_uppergastrointestinalsurgery”).setDisabled(false);
        Xrm.Page.getControl(“new_vascularsurgery”).setDisabled(false);
        Xrm.Page.getAttribute(“new_breastsurgery”).setValue(1);
        Xrm.Page.getAttribute(“new_colorectalsurgery”).setValue(1);
        Xrm.Page.getAttribute(“new_generalsurgery”).setValue(1);
        Xrm.Page.getAttribute(“new_transplantationsurgery”).setValue(1);
        Xrm.Page.getAttribute(“new_uppergastrointestinalsurgery”).setValue(1);
        Xrm.Page.getAttribute(“new_vascularsurgery”).setValue(1);

    }
    else if (type == 356110014) {
        Xrm.Page.getControl(“new_neurosurgery”).setDisabled(false);
        Xrm.Page.getControl(“new_spinalsurgeryservice”).setDisabled(false);
        Xrm.Page.getAttribute(“new_neurosurgery”).setValue(1);
        Xrm.Page.getAttribute(“new_spinalsurgeryservice”).setValue(1);

    }
    else if (type == 356110029) {
        Xrm.Page.getControl(“new_clinicalneurophysiology”).setDisabled(false);
        Xrm.Page.getControl(“new_generalmedicine”).setDisabled(false);
        Xrm.Page.getAttribute(“new_clinicalneurophysiology”).setValue(1);
        Xrm.Page.getAttribute(“new_generalmedicine”).setValue(1);
    }
    else if (type == 356110030) {
        Xrm.Page.getControl(“new_genitourinarymedicine”).setDisabled(false);
        Xrm.Page.getAttribute(“new_genitourinarymedicine”).setValue(1);
    }
    else if (type == 356110031) {
        Xrm.Page.getControl(“new_geriatricmedicine”).setDisabled(false);
        Xrm.Page.getAttribute(“new_geriatricmedicine”).setValue(1);
    }
    else if (type == 356110032) {
        Xrm.Page.getControl(“new_clinicalhaematology”).setDisabled(false);
        Xrm.Page.getAttribute(“new_clinicalhaematology”).setValue(1);
    }
    else if (type == 356110033) {
        Xrm.Page.getControl(“new_infectiousdiseases”).setDisabled(false);
        Xrm.Page.getAttribute(“new_infectiousdiseases”).setValue(1);
    }
    else if (type == 356110034) {
        Xrm.Page.getControl(“new_medicaloncology”).setDisabled(false);
        Xrm.Page.getAttribute(“new_medicaloncology”).setValue(1);
    }
    else if (type == 356110035) {
        Xrm.Page.getControl(“new_medicalophthalmology”).setDisabled(false);
        Xrm.Page.getAttribute(“new_medicalophthalmology”).setValue(1);
    }
    else if (type == 356110036) {
        Xrm.Page.getControl(“new_nephrology”).setDisabled(false);
        Xrm.Page.getAttribute(“new_nephrology”).setValue(1);
    }
    else if (type == 356110037) {
        Xrm.Page.getControl(“new_neurology”).setDisabled(false);
        Xrm.Page.getAttribute(“new_neurology”).setValue(1);
    }
    else if (type == 356110038) {
        Xrm.Page.getControl(“new_nuclearmedicine”).setDisabled(false);
        Xrm.Page.getAttribute(“new_nuclearmedicine”).setValue(1);
    }
    else if (type == 356110040) {
        Xrm.Page.getControl(“new_paediatriccardiology”).setDisabled(false);
        Xrm.Page.getAttribute(“new_paediatriccardiology”).setValue(1);
    }
    else if (type == 356110041) {
        Xrm.Page.getControl(“new_paediatricneurology”).setDisabled(false);
        Xrm.Page.getAttribute(“new_paediatricneurology”).setValue(1);
    }
    else if (type == 356110042) {
        Xrm.Page.getControl(“new_paediatrics”).setDisabled(false);
        Xrm.Page.getAttribute(“new_paediatrics”).setValue(1);

    } else if (type == 356110043) {
        Xrm.Page.getControl(“new_palliativemedicine”).setDisabled(false);
        Xrm.Page.getAttribute(“new_palliativemedicine”).setValue(1);

    }
    else if (type == 356110044) {
        Xrm.Page.getControl(“new_rehabilitationservice”).setDisabled(false);
        Xrm.Page.getAttribute(“new_rehabilitationservice”).setValue(1);

    }
    else if (type == 356110045) {
        Xrm.Page.getControl(“new_respiratorymedicine”).setDisabled(false);
        Xrm.Page.getAttribute(“new_respiratorymedicine”).setValue(1);

    }
    else if (type == 356110046) {
        Xrm.Page.getControl(“new_rheumatology”).setDisabled(false);
        Xrm.Page.getAttribute(“new_rheumatology”).setValue(1);

    }
    else if (type == 356110047) {
        Xrm.Page.getControl(“new_sportandexercisemedicine”).setDisabled(false);
        Xrm.Page.getAttribute(“new_sportandexercisemedicine”).setValue(1);

    }
    else if (type == 356110003) {
        Xrm.Page.getControl(“new_paediatricearnoseandthroat”).setDisabled(false);
        Xrm.Page.getAttribute(“new_paediatricearnoseandthroat”).setValue(1);

    }
    else if (type == 356110034) {
        Xrm.Page.getControl(“new_medicaloncology”).setDisabled(false);
        Xrm.Page.getAttribute(“new_medicaloncology”).setValue(1);

    }
    else if (type == 356110049) {
        Xrm.Page.getControl(“new_chemicalpathology”).setDisabled(false);
        Xrm.Page.getAttribute(“new_chemicalpathology”).setValue(1);

    }
    else if (type == 356110050) {
        Xrm.Page.getControl(“new_adultmentalillness”).setDisabled(false);
        Xrm.Page.getAttribute(“new_adultmentalillness”).setValue(1);

    }
    else if (type == 356110051) {
        Xrm.Page.getControl(“new_clinicaloncology”).setDisabled(false);
        Xrm.Page.getAttribute(“new_clinicaloncology”).setValue(1);

    }//
    else if (type == 356110052) {
        Xrm.Page.getControl(“new_diagnosticimaging”).setDisabled(false);
        Xrm.Page.getControl(“new_interventionalradiology”).setDisabled(false);
        Xrm.Page.getAttribute(“new_diagnosticimaging”).setValue(1);
        Xrm.Page.getAttribute(“new_interventionalradiology”).setValue(1);

    }
    else if (type == 356110018) {
        Xrm.Page.getControl(“new_accidentemergency”).setDisabled(false);
        Xrm.Page.getAttribute(“new_accidentemergency”).setValue(1);

    }
    else if (type == 356110019) {
        Xrm.Page.getControl(“new_painmanagement”).setDisabled(false);
        Xrm.Page.getAttribute(“new_painmanagement”).setValue(1);

    }
    else if (type == 356110016) {
        Xrm.Page.getControl(“new_cardiacsurgery”).setDisabled(false);
        Xrm.Page.getControl(“new_cardiothoracicsurgery”).setDisabled(false);
        Xrm.Page.getAttribute(“new_cardiacsurgery”).setValue(1);
        Xrm.Page.getAttribute(“new_cardiothoracicsurgery”).setValue(1);
    }
    else if (type == 356110003) {
        Xrm.Page.getControl(“new_ent”).setDisabled(false);
        Xrm.Page.getAttribute(“new_ent”).setValue(1);

    }
    else if (type == 356110039) {
        Xrm.Page.getControl(“new_gynaecologicaloncology”).setDisabled(false);
        Xrm.Page.getControl(“new_gynaecology”).setDisabled(false);
        Xrm.Page.getControl(“new_obstetrics”).setDisabled(false);
        Xrm.Page.getAttribute(“new_gynaecologicaloncology”).setValue(1);
        Xrm.Page.getAttribute(“new_gynaecology”).setValue(1);
        Xrm.Page.getAttribute(“new_obstetrics”).setValue(1);
    } else {
        Enable_all_specility_Consultant();
    }

}

Disable_all_specility_Consultant = function () {

    Xrm.Page.getControl(“new_anaesthetics”).setDisabled(true);
    Xrm.Page.getControl(“new_audiologicalmedicine”).setDisabled(true);
    Xrm.Page.getControl(“new_cardiology”).setDisabled(true);
    Xrm.Page.getControl(“new_clinicalgenetics”).setDisabled(true);
    Xrm.Page.getControl(“new_clinicalimmunologyandallergyservice”).setDisabled(true);
    Xrm.Page.getControl(“new_clinicalpharmacology”).setDisabled(true);
    Xrm.Page.getControl(“new_criticalcaremedicine”).setDisabled(true);
    Xrm.Page.getControl(“new_dermatology”).setDisabled(true);
    Xrm.Page.getControl(“new_endocrinology”).setDisabled(true);
    Xrm.Page.getControl(“new_gastroenterology”).setDisabled(true);
    Xrm.Page.getControl(“new_ophthalmology”).setDisabled(true);
    Xrm.Page.getControl(“new_maxillofacialsurgery”).setDisabled(true);
    Xrm.Page.getControl(“new_paediatricsurgery”).setDisabled(true);
    Xrm.Page.getControl(“new_plasticsurgery”).setDisabled(true);
    Xrm.Page.getControl(“new_traumaorthopaedics”).setDisabled(true);
    Xrm.Page.getControl(“new_urology”).setDisabled(true);
    Xrm.Page.getControl(“new_breastsurgery”).setDisabled(true);
    Xrm.Page.getControl(“new_colorectalsurgery”).setDisabled(true);
    Xrm.Page.getControl(“new_generalsurgery”).setDisabled(true);
    Xrm.Page.getControl(“new_transplantationsurgery”).setDisabled(true);
    Xrm.Page.getControl(“new_uppergastrointestinalsurgery”).setDisabled(true);
    Xrm.Page.getControl(“new_vascularsurgery”).setDisabled(true);
    Xrm.Page.getControl(“new_neurosurgery”).setDisabled(true);
    Xrm.Page.getControl(“new_spinalsurgeryservice”).setDisabled(true);
    Xrm.Page.getControl(“new_clinicalneurophysiology”).setDisabled(true);
    Xrm.Page.getControl(“new_generalmedicine”).setDisabled(true);
    Xrm.Page.getControl(“new_genitourinarymedicine”).setDisabled(true);
    Xrm.Page.getControl(“new_geriatricmedicine”).setDisabled(true);
    Xrm.Page.getControl(“new_clinicalhaematology”).setDisabled(true);
    Xrm.Page.getControl(“new_infectiousdiseases”).setDisabled(true);
    Xrm.Page.getControl(“new_medicaloncology”).setDisabled(true);
    Xrm.Page.getControl(“new_medicalophthalmology”).setDisabled(true);
    Xrm.Page.getControl(“new_nephrology”).setDisabled(true);
    Xrm.Page.getControl(“new_neurology”).setDisabled(true);
    Xrm.Page.getControl(“new_nuclearmedicine”).setDisabled(true);
    Xrm.Page.getControl(“new_paediatriccardiology”).setDisabled(true);
    Xrm.Page.getControl(“new_paediatricneurology”).setDisabled(true);
    Xrm.Page.getControl(“new_paediatrics”).setDisabled(true);
    Xrm.Page.getControl(“new_palliativemedicine”).setDisabled(true);
    Xrm.Page.getControl(“new_rehabilitationservice”).setDisabled(true);
    Xrm.Page.getControl(“new_respiratorymedicine”).setDisabled(true);
    Xrm.Page.getControl(“new_rheumatology”).setDisabled(true);
    Xrm.Page.getControl(“new_sportandexercisemedicine”).setDisabled(true);
    Xrm.Page.getControl(“new_paediatricearnoseandthroat”).setDisabled(true);
    Xrm.Page.getControl(“new_medicaloncology”).setDisabled(true);
    Xrm.Page.getControl(“new_chemicalpathology”).setDisabled(true);
    Xrm.Page.getControl(“new_adultmentalillness”).setDisabled(true);
    Xrm.Page.getControl(“new_clinicaloncology”).setDisabled(true);
    Xrm.Page.getControl(“new_diagnosticimaging”).setDisabled(true);
    Xrm.Page.getControl(“new_interventionalradiology”).setDisabled(true);
    Xrm.Page.getControl(“new_accidentemergency”).setDisabled(true);
    Xrm.Page.getControl(“new_painmanagement”).setDisabled(true);
    Xrm.Page.getControl(“new_cardiacsurgery”).setDisabled(true);
    Xrm.Page.getControl(“new_cardiothoracicsurgery”).setDisabled(true);
    Xrm.Page.getControl(“new_ent”).setDisabled(true);
    Xrm.Page.getControl(“new_gynaecologicaloncology”).setDisabled(true);
    Xrm.Page.getControl(“new_gynaecology”).setDisabled(true);
    Xrm.Page.getControl(“new_obstetrics”).setDisabled(true);
    //Given below are the extra field
    Xrm.Page.getControl(“new_burnscare”).setDisabled(true);
    Xrm.Page.getControl(“new_cardiothoracictransplantation”).setDisabled(true);
    Xrm.Page.getControl(“new_hepatobiliarypancreaticsurgery”).setDisabled(true);
    Xrm.Page.getControl(“new_oralsurgery”).setDisabled(true);
    Xrm.Page.getControl(“new_orthodontics”).setDisabled(true);
    Xrm.Page.getControl(“new_paediatricdentistry”).setDisabled(true);
    Xrm.Page.getControl(“new_restorativedentistry”).setDisabled(true);
    Xrm.Page.getControl(“new_spinalsurgeryservice”).setDisabled(true);
    Xrm.Page.getControl(“new_thoracicsurgery”).setDisabled(true);
    Xrm.Page.getControl(“new_paediatricmedicaloncology”).setDisabled(true);
    //End extra field
    //Set all value to No
    Xrm.Page.getAttribute(“new_anaesthetics”).setValue(0);
    Xrm.Page.getAttribute(“new_audiologicalmedicine”).setValue(0);
    Xrm.Page.getAttribute(“new_cardiology”).setValue(0);
    Xrm.Page.getAttribute(“new_clinicalgenetics”).setValue(0);
    Xrm.Page.getAttribute(“new_clinicalimmunologyandallergyservice”).setValue(0);
    Xrm.Page.getAttribute(“new_clinicalpharmacology”).setValue(0);
    Xrm.Page.getAttribute(“new_criticalcaremedicine”).setValue(0);
    Xrm.Page.getAttribute(“new_dermatology”).setValue(0);
    Xrm.Page.getAttribute(“new_endocrinology”).setValue(0);
    Xrm.Page.getAttribute(“new_gastroenterology”).setValue(0);
    Xrm.Page.getAttribute(“new_ophthalmology”).setValue(0);
    Xrm.Page.getAttribute(“new_maxillofacialsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_paediatricsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_plasticsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_traumaorthopaedics”).setValue(0);
    Xrm.Page.getAttribute(“new_urology”).setValue(0);
    Xrm.Page.getAttribute(“new_breastsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_colorectalsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_generalsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_transplantationsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_uppergastrointestinalsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_vascularsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_neurosurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_spinalsurgeryservice”).setValue(0);
    Xrm.Page.getAttribute(“new_clinicalneurophysiology”).setValue(0);
    Xrm.Page.getAttribute(“new_generalmedicine”).setValue(0);
    Xrm.Page.getAttribute(“new_genitourinarymedicine”).setValue(0);
    Xrm.Page.getAttribute(“new_geriatricmedicine”).setValue(0);
    Xrm.Page.getAttribute(“new_clinicalhaematology”).setValue(0);
    Xrm.Page.getAttribute(“new_infectiousdiseases”).setValue(0);
    Xrm.Page.getAttribute(“new_medicaloncology”).setValue(0);
    Xrm.Page.getAttribute(“new_medicalophthalmology”).setValue(0);
    Xrm.Page.getAttribute(“new_nephrology”).setValue(0);
    Xrm.Page.getAttribute(“new_neurology”).setValue(0);
    Xrm.Page.getAttribute(“new_nuclearmedicine”).setValue(0);
    Xrm.Page.getAttribute(“new_paediatriccardiology”).setValue(0);
    Xrm.Page.getAttribute(“new_paediatricneurology”).setValue(0);
    Xrm.Page.getAttribute(“new_paediatrics”).setValue(0);
    Xrm.Page.getAttribute(“new_palliativemedicine”).setValue(0);
    Xrm.Page.getAttribute(“new_rehabilitationservice”).setValue(0);
    Xrm.Page.getAttribute(“new_respiratorymedicine”).setValue(0);
    Xrm.Page.getAttribute(“new_rheumatology”).setValue(0);
    Xrm.Page.getAttribute(“new_sportandexercisemedicine”).setValue(0);
    Xrm.Page.getAttribute(“new_paediatricearnoseandthroat”).setValue(0);
    Xrm.Page.getAttribute(“new_medicaloncology”).setValue(0);
    Xrm.Page.getAttribute(“new_chemicalpathology”).setValue(0);
    Xrm.Page.getAttribute(“new_adultmentalillness”).setValue(0);
    Xrm.Page.getAttribute(“new_clinicaloncology”).setValue(0);
    Xrm.Page.getAttribute(“new_diagnosticimaging”).setValue(0);
    Xrm.Page.getAttribute(“new_interventionalradiology”).setValue(0);
    Xrm.Page.getAttribute(“new_accidentemergency”).setValue(0);
    Xrm.Page.getAttribute(“new_painmanagement”).setValue(0);
    Xrm.Page.getAttribute(“new_cardiacsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_cardiothoracicsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_ent”).setValue(0);
    Xrm.Page.getAttribute(“new_gynaecologicaloncology”).setValue(0);
    Xrm.Page.getAttribute(“new_gynaecology”).setValue(0);
    Xrm.Page.getAttribute(“new_obstetrics”).setValue(0);
    //Given below are the extra field
    Xrm.Page.getAttribute(“new_burnscare”).setValue(0);
    Xrm.Page.getAttribute(“new_cardiothoracictransplantation”).setValue(0);
    Xrm.Page.getAttribute(“new_hepatobiliarypancreaticsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_oralsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_orthodontics”).setValue(0);
    Xrm.Page.getAttribute(“new_paediatricdentistry”).setValue(0);
    Xrm.Page.getAttribute(“new_restorativedentistry”).setValue(0);
    Xrm.Page.getAttribute(“new_spinalsurgeryservice”).setValue(0);
    Xrm.Page.getAttribute(“new_thoracicsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_paediatricmedicaloncology”).setValue(0);

}

Enable_all_specility_Consultant = function () {
    Xrm.Page.getControl(“new_anaesthetics”).setDisabled(false);
    Xrm.Page.getControl(“new_audiologicalmedicine”).setDisabled(false);
    Xrm.Page.getControl(“new_cardiology”).setDisabled(false);
    Xrm.Page.getControl(“new_clinicalgenetics”).setDisabled(false);
    Xrm.Page.getControl(“new_clinicalimmunologyandallergyservice”).setDisabled(false);
    Xrm.Page.getControl(“new_clinicalpharmacology”).setDisabled(false);
    Xrm.Page.getControl(“new_criticalcaremedicine”).setDisabled(false);
    Xrm.Page.getControl(“new_dermatology”).setDisabled(false);
    Xrm.Page.getControl(“new_endocrinology”).setDisabled(false);
    Xrm.Page.getControl(“new_gastroenterology”).setDisabled(false);
    Xrm.Page.getControl(“new_ophthalmology”).setDisabled(false);
    Xrm.Page.getControl(“new_maxillofacialsurgery”).setDisabled(false);
    Xrm.Page.getControl(“new_paediatricsurgery”).setDisabled(false);
    Xrm.Page.getControl(“new_plasticsurgery”).setDisabled(false);
    Xrm.Page.getControl(“new_traumaorthopaedics”).setDisabled(false);
    Xrm.Page.getControl(“new_urology”).setDisabled(false);
    Xrm.Page.getControl(“new_breastsurgery”).setDisabled(false);
    Xrm.Page.getControl(“new_colorectalsurgery”).setDisabled(false);
    Xrm.Page.getControl(“new_generalsurgery”).setDisabled(false);
    Xrm.Page.getControl(“new_transplantationsurgery”).setDisabled(false);
    Xrm.Page.getControl(“new_uppergastrointestinalsurgery”).setDisabled(false);
    Xrm.Page.getControl(“new_vascularsurgery”).setDisabled(false);
    Xrm.Page.getControl(“new_neurosurgery”).setDisabled(false);
    Xrm.Page.getControl(“new_spinalsurgeryservice”).setDisabled(false);
    Xrm.Page.getControl(“new_clinicalneurophysiology”).setDisabled(false);
    Xrm.Page.getControl(“new_generalmedicine”).setDisabled(false);
    Xrm.Page.getControl(“new_genitourinarymedicine”).setDisabled(false);
    Xrm.Page.getControl(“new_geriatricmedicine”).setDisabled(false);
    Xrm.Page.getControl(“new_clinicalhaematology”).setDisabled(false);
    Xrm.Page.getControl(“new_infectiousdiseases”).setDisabled(false);
    Xrm.Page.getControl(“new_medicaloncology”).setDisabled(false);
    Xrm.Page.getControl(“new_medicalophthalmology”).setDisabled(false);
    Xrm.Page.getControl(“new_nephrology”).setDisabled(false);
    Xrm.Page.getControl(“new_neurology”).setDisabled(false);
    Xrm.Page.getControl(“new_nuclearmedicine”).setDisabled(false);
    Xrm.Page.getControl(“new_paediatriccardiology”).setDisabled(false);
    Xrm.Page.getControl(“new_paediatricneurology”).setDisabled(false);
    Xrm.Page.getControl(“new_paediatrics”).setDisabled(false);
    Xrm.Page.getControl(“new_palliativemedicine”).setDisabled(false);
    Xrm.Page.getControl(“new_rehabilitationservice”).setDisabled(false);
    Xrm.Page.getControl(“new_respiratorymedicine”).setDisabled(false);
    Xrm.Page.getControl(“new_rheumatology”).setDisabled(false);
    Xrm.Page.getControl(“new_sportandexercisemedicine”).setDisabled(false);
    Xrm.Page.getControl(“new_paediatricearnoseandthroat”).setDisabled(false);
    Xrm.Page.getControl(“new_medicaloncology”).setDisabled(false);
    Xrm.Page.getControl(“new_chemicalpathology”).setDisabled(false);
    Xrm.Page.getControl(“new_adultmentalillness”).setDisabled(false);
    Xrm.Page.getControl(“new_clinicaloncology”).setDisabled(false);
    Xrm.Page.getControl(“new_diagnosticimaging”).setDisabled(false);
    Xrm.Page.getControl(“new_interventionalradiology”).setDisabled(false);
    Xrm.Page.getControl(“new_accidentemergency”).setDisabled(false);
    Xrm.Page.getControl(“new_painmanagement”).setDisabled(false);
    Xrm.Page.getControl(“new_cardiacsurgery”).setDisabled(false);
    Xrm.Page.getControl(“new_cardiothoracicsurgery”).setDisabled(false);
    Xrm.Page.getControl(“new_ent”).setDisabled(false);
    Xrm.Page.getControl(“new_gynaecologicaloncology”).setDisabled(false);
    Xrm.Page.getControl(“new_gynaecology”).setDisabled(false);
    Xrm.Page.getControl(“new_obstetrics”).setDisabled(false);
    //Given below are the extra field
    Xrm.Page.getControl(“new_burnscare”).setDisabled(false);
    Xrm.Page.getControl(“new_cardiothoracictransplantation”).setDisabled(false);
    Xrm.Page.getControl(“new_hepatobiliarypancreaticsurgery”).setDisabled(false);
    Xrm.Page.getControl(“new_oralsurgery”).setDisabled(false);
    Xrm.Page.getControl(“new_orthodontics”).setDisabled(false);
    Xrm.Page.getControl(“new_paediatricdentistry”).setDisabled(false);
    Xrm.Page.getControl(“new_restorativedentistry”).setDisabled(false);
    Xrm.Page.getControl(“new_spinalsurgeryservice”).setDisabled(false);
    Xrm.Page.getControl(“new_thoracicsurgery”).setDisabled(false);
    Xrm.Page.getControl(“new_paediatricmedicaloncology”).setDisabled(false);
    //Setting the value 1
    Xrm.Page.getAttribute(“new_anaesthetics”).setValue(0);
    Xrm.Page.getAttribute(“new_audiologicalmedicine”).setValue(0);
    Xrm.Page.getAttribute(“new_cardiology”).setValue(0);
    Xrm.Page.getAttribute(“new_clinicalgenetics”).setValue(0);
    Xrm.Page.getAttribute(“new_clinicalimmunologyandallergyservice”).setValue(0);
    Xrm.Page.getAttribute(“new_clinicalpharmacology”).setValue(0);
    Xrm.Page.getAttribute(“new_criticalcaremedicine”).setValue(0);
    Xrm.Page.getAttribute(“new_dermatology”).setValue(0);
    Xrm.Page.getAttribute(“new_endocrinology”).setValue(0);
    Xrm.Page.getAttribute(“new_gastroenterology”).setValue(0);
    Xrm.Page.getAttribute(“new_ophthalmology”).setValue(0);
    Xrm.Page.getAttribute(“new_maxillofacialsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_paediatricsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_plasticsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_traumaorthopaedics”).setValue(0);
    Xrm.Page.getAttribute(“new_urology”).setValue(0);
    Xrm.Page.getAttribute(“new_breastsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_colorectalsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_generalsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_transplantationsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_uppergastrointestinalsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_vascularsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_neurosurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_spinalsurgeryservice”).setValue(0);
    Xrm.Page.getAttribute(“new_clinicalneurophysiology”).setValue(0);
    Xrm.Page.getAttribute(“new_generalmedicine”).setValue(0);
    Xrm.Page.getAttribute(“new_genitourinarymedicine”).setValue(0);
    Xrm.Page.getAttribute(“new_geriatricmedicine”).setValue(0);
    Xrm.Page.getAttribute(“new_clinicalhaematology”).setValue(0);
    Xrm.Page.getAttribute(“new_infectiousdiseases”).setValue(0);
    Xrm.Page.getAttribute(“new_medicaloncology”).setValue(0);
    Xrm.Page.getAttribute(“new_medicalophthalmology”).setValue(0);
    Xrm.Page.getAttribute(“new_nephrology”).setValue(0);
    Xrm.Page.getAttribute(“new_neurology”).setValue(0);
    Xrm.Page.getAttribute(“new_nuclearmedicine”).setValue(0);
    Xrm.Page.getAttribute(“new_paediatriccardiology”).setValue(0);
    Xrm.Page.getAttribute(“new_paediatricneurology”).setValue(0);
    Xrm.Page.getAttribute(“new_paediatrics”).setValue(0);
    Xrm.Page.getAttribute(“new_palliativemedicine”).setValue(0);
    Xrm.Page.getAttribute(“new_rehabilitationservice”).setValue(0);
    Xrm.Page.getAttribute(“new_respiratorymedicine”).setValue(0);
    Xrm.Page.getAttribute(“new_rheumatology”).setValue(0);
    Xrm.Page.getAttribute(“new_sportandexercisemedicine”).setValue(0);
    Xrm.Page.getAttribute(“new_paediatricearnoseandthroat”).setValue(0);
    Xrm.Page.getAttribute(“new_medicaloncology”).setValue(0);
    Xrm.Page.getAttribute(“new_chemicalpathology”).setValue(0);
    Xrm.Page.getAttribute(“new_adultmentalillness”).setValue(0);
    Xrm.Page.getAttribute(“new_clinicaloncology”).setValue(0);
    Xrm.Page.getAttribute(“new_diagnosticimaging”).setValue(0);
    Xrm.Page.getAttribute(“new_interventionalradiology”).setValue(0);
    Xrm.Page.getAttribute(“new_accidentemergency”).setValue(0);
    Xrm.Page.getAttribute(“new_painmanagement”).setValue(0);
    Xrm.Page.getAttribute(“new_cardiacsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_cardiothoracicsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_ent”).setValue(0);
    Xrm.Page.getAttribute(“new_gynaecologicaloncology”).setValue(0);
    Xrm.Page.getAttribute(“new_gynaecology”).setValue(0);
    Xrm.Page.getAttribute(“new_obstetrics”).setValue(0);
    //Given below are the extra field
    Xrm.Page.getAttribute(“new_burnscare”).setValue(0);
    Xrm.Page.getAttribute(“new_cardiothoracictransplantation”).setValue(0);
    Xrm.Page.getAttribute(“new_hepatobiliarypancreaticsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_oralsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_orthodontics”).setValue(0);
    Xrm.Page.getAttribute(“new_paediatricdentistry”).setValue(0);
    Xrm.Page.getAttribute(“new_restorativedentistry”).setValue(0);
    Xrm.Page.getAttribute(“new_spinalsurgeryservice”).setValue(0);
    Xrm.Page.getAttribute(“new_thoracicsurgery”).setValue(0);
    Xrm.Page.getAttribute(“new_paediatricmedicaloncology”).setValue(0);
}

function OnSave_NameConcatnation() {
    var firstName = Xrm.Page.getAttribute(“new_firstname”).getValue();
    var lastName = Xrm.Page.getAttribute(“new_lastname”).getValue();
    Xrm.Page.getAttribute(“new_name”).setValue(firstName + ” ” + lastName);
}

function EmailValidation_Primaryemailaddress() {

    var primaryemailaddress = Xrm.Page.getAttribute(“new_primaryemailaddress”).getValue();
    if (primaryemailaddress != null) {
        var reg = /^w+([-+.’]w+)*@w+([-.]w+)*.w+([-.]w+)*$/
        if (!reg.test(primaryemailaddress)) {
            Xrm.Page.getControl(“new_primaryemailaddress”).setNotification(“please enter valid email address”);
            Xrm.Page.getControl(“new_primaryemailaddress”).setFocus();

        }
    } else {
        Xrm.Page.getControl(“new_primaryemailaddress”).clearNotification();

    }

}
function EmailValidation_Secondaryemailaddress() {

    var secondaryemailaddress = Xrm.Page.getAttribute(“new_secondaryemailaddress”).getValue();
    if (secondaryemailaddress != null) {
        var reg = /^w+([-+.’]w+)*@w+([-.]w+)*.w+([-.]w+)*$/
        if (!reg.test(secondaryemailaddress)) {
            Xrm.Page.getControl(“new_secondaryemailaddress”).setNotification(“please enter valid email address”);
            Xrm.Page.getControl(“new_secondaryemailaddress”).setFocus();

        }
    } else {
        Xrm.Page.getControl(“new_secondaryemailaddress”).clearNotification();
    }

}
function EmailValidation_primarymedicalsecretarypaemailaddress() {

    var primarymedicalsecretarypaemailaddress = Xrm.Page.getAttribute(“new_primarymedicalsecretarypaemailaddress”).getValue();
    if (primarymedicalsecretarypaemailaddress != null) {
        var reg = /^w+([-+.’]w+)*@w+([-.]w+)*.w+([-.]w+)*$/
        if (!reg.test(primarymedicalsecretarypaemailaddress)) {
            Xrm.Page.getControl(“new_primarymedicalsecretarypaemailaddress”).setNotification(“please enter valid email address”);
            Xrm.Page.getControl(“new_primarymedicalsecretarypaemailaddress”).setFocus();

        }
    } else {
        Xrm.Page.getControl(“new_primarymedicalsecretarypaemailaddress”).clearNotification();
    }

}

Share this:

EMAIL FIELD VALIDATION MS CRM

Hi 

I had a scenario which everyone aware of the email field validation
function EmailValidation_Primaryemailaddress() {
    var primaryemailaddress = Xrm.Page.getAttribute(“new_primaryemailaddress”).getValue();
    if (primaryemailaddress != null) {
        var reg = /^w+([-+.’]w+)*@w+([-.]w+)*.w+([-.]w+)*$/
        if (!reg.test(primaryemailaddress)) {
            Xrm.Page.getControl(“new_primaryemailaddress”).setNotification(“please enter valid email address”);
            Xrm.Page.getControl(“new_primaryemailaddress”).setFocus();
        }
    } else {
        Xrm.Page.getControl(“new_primaryemailaddress”).clearNotification();
    }
}
function EmailValidation_Secondaryemailaddress() {
    var secondaryemailaddress = Xrm.Page.getAttribute(“new_secondaryemailaddress”).getValue();
    if (secondaryemailaddress!=null) {
        var reg = /^w+([-+.’]w+)*@w+([-.]w+)*.w+([-.]w+)*$/
        if (!reg.test(secondaryemailaddress)) {
            Xrm.Page.getControl(“new_secondaryemailaddress”).setNotification(“please enter valid email address”);
            Xrm.Page.getControl(“new_secondaryemailaddress”).setFocus();
        }
    } else {
        Xrm.Page.getControl(“new_secondaryemailaddress”).clearNotification();
    }
    
}
function EmailValidation_primarymedicalsecretarypaemailaddress() {
    var primarymedicalsecretarypaemailaddress = Xrm.Page.getAttribute(“new_primarymedicalsecretarypaemailaddress”).getValue();
    if (primarymedicalsecretarypaemailaddress!=null) {
        var reg = /^w+([-+.’]w+)*@w+([-.]w+)*.w+([-.]w+)*$/
        if (!reg.test(primarymedicalsecretarypaemailaddress)) {
            Xrm.Page.getControl(“new_primarymedicalsecretarypaemailaddress”).setNotification(“please enter valid email address”);
            Xrm.Page.getControl(“new_primarymedicalsecretarypaemailaddress”).setFocus();
        }
    } else {
        Xrm.Page.getControl(“new_primarymedicalsecretarypaemailaddress”).clearNotification();
    }
   
}
I hope this helps 
Happy CRMing
Share this:

Custom Workflow Input and Output Parmeters in CRM

Custom Workflow Input and Output Parmeters in CRM

Hi,

Today I got a requirement to create a task and assign it to the Manager of the Owner on the Parent Record. We can easily get the Owner value in the system workflow but not the Manager of the owner.

For this I had to write a custom workflow which will take Owner value as an Input Parameter and returns Manager of the Owner as an Output Parameter.

Here is the way to declare Input and Output Parameter in a Custom Workflow.

/// <summary>
/// Input Argument – SystemUser
/// </summary>
[RequiredArgument]
[Input(“User”)]
[ReferenceTarget(“systemuser”)]
public InArgument<EntityReference> User { getset; }

/// <summary>
/// Output Arugument – Manager of the user.
/// </summary>
[Output(“Manager of the user”)]
[ReferenceTarget(“systemuser”)]
public OutArgument<EntityReference> Manager { getset; }

And this the below code in the Workflow Execute Method.

// Get the Manager of the user.

EntityReference erfUser = User.Get<EntityReference>(executionContext);
Entity entityUser = service.Retrieve(“systemuser”, erfUser.Id, new ColumnSet(newstring[] { “parentsystemuserid” }));
Manager.Set(executionContext, (EntityReference)entityUser.Attributes[“parentsystemuserid”]);

After this, just build your project and deploy it in CRM and use the same in the system workflow by passing the Owner value and it will give the Manager of the owner. 

In the same way, we can using CRM Custom Workflow for many business operations by using Input and Output Parameters.


I Hope this helps

Happy CRM’ing!

 
Share this: