serving the solutions day and night

Pages

Showing posts with label dynamics crm 2015. Show all posts
Showing posts with label dynamics crm 2015. Show all posts

Thursday, November 2, 2017

MSCRMMonitoringTest Logging 'Monitoring test failed: Test Title: Help Content Server Tests.: Machine: DNSSES1234: ServerRole: HelpServer'

MSCRMMonitoringTest Logging 'Monitoring test failed: Test Title: Help Content Server Tests.: Machine: DNSSES1234: ServerRole: HelpServer'

Every 15 minutes, CRM Logging the below error

Event 18732, MSCRMMonitoringTest

Monitoring test failed: Test Title: Help Content Server Tests.: Machine: <Server_Name>: ServerRole: HelpServer
Test Log:
The remote server returned an error: (404) Not Found.
   at System.Net.HttpWebRequest.GetResponse()
   at Microsoft.Crm.Monitoring.WebHelpers.GetWebResponse(String webpage, Boolean setCrmAuth, Boolean useProxy, Byte[] postData, Boolean setUserAgent, Int64 dmzPort)
   at Microsoft.Crm.Monitoring.Tests.HelpContent.VerifyHelpContent.TestDefaultHelp(TestResult result)
   at Microsoft.Crm.Monitoring.Tests.HelpContent.VerifyHelpContent.Execute()
   at Microsoft.Crm.Monitoring.Engine.MonitoringRuntime.ExecuteMonitoringTest(MonitoringTestBase test, Int32 attempts)

InnerException Type:System.Net.WebException
.

Workaround solution to fix the above logging error

1. Create TestsToExclude.xml file,
<MonitoringTestsToExclude>
    <Test isDisabled="true">VerifyHelpContent</Test>
</MonitoringTestsToExclude>
2. Place it on %ProgramFiles%\Microsoft Dynamics CRM\Monitoring folder (all Servers).

3. After 15 minutes, you see the log with succeded message

All monitoring tests succeeded: Machine: APWMAD0A2398: ServerRole: HelpServer.

MSCRMMonitoringTest Logging 'A certificate registered for use by Microsoft Dynamics CRM has expired'

Every 15 minutes, CRM Logging the below errors

Event 25089, MSCRMMonitoringTest
A certificate registered for use by Microsoft Dynamics CRM has expired.  Certificate type: TrustedIssuer Certificate Name: http://<URL>/adfs/services/trust Expiration Date: 1/11/2016 6:00:00 AM Store Location:  Store Name:

Event 18797, MSCRMMonitoringTest
Monitoring test failed: Test Title: Trusted Issuer Certificate test: Machine: <MACHINE_NAME>: ServerRole: DiscoveryService, Portal, ApiServer
Test Log:
Retrieving certificate data from config DBVerifying TrustedIssuer certificate.  Name=http://<URL>/adfs/services/trustTrustedIssuer certificate is not stored in local store:  It is contained in the config DB.  Name=http://<URL>/adfs/services/trustCertificate Lifespan:  Valid from 09/14/2014 19:00:00 to 01/11/2016 06:00:00Failure: Certificate has expiredVerifying TrustedIssuer certificate.  Name=http://<URL>/adfs/services/trustTrustedIssuer certificate is not stored in local store:  It is contained in the config DB.  Name=http://<URL>/adfs/services/trustCertificate Lifespan:  Valid from 10/12/2015 19:00:00 to 02/15/2017 06:00:00Remaining certificate lifespan 21.7 % is greater than the configured threshold of 10.0 %Certificate is not nearing expiration.

I found 2 expired (invalid) certificates on the servers (Deployment & all UI Servers).

Workaround solution to fix the above logging error

1. Delete older one (yellow color tag) certificate from all servers
A) Run cmd -> type mmc -> Console Root window -> File menu -> select Add/Remove Snap-ins -> Add Cerificate -> Select(Computer account) -> Finish -> OK.

B) Console Root -> Certificates (Local Computer) -> Personal -> Certificates
   -> Select old cerificate (date ended with '02/15/2017' ) -> Delete.

2. Re run ‘Configure Claims-Based Authentication’ tool from CRM Deployment Manager.

3. After 15 minutes, you see the log with succeded message
Monitoring test succeeded: Test Title: Trusted Issuer Certificate test: Machine: <MACHINE_NAME>: ServerRole: DiscoveryService, Portal, ApiServer
Test Log:
Retrieving certificate data from config DBVerifying TrustedIssuer certificate.  Name=http://<URL>/adfs/services/trustTrustedIssuer certificate is not stored in local store:  It is contained in the config DB.  Name=http://<URL>/adfs/services/trustCertificate Lifespan:  Valid from 10/12/2015 19:00:00 to 02/15/2017 06:00:00Remaining certificate lifespan 21.3 % is greater than the configured threshold of 10.0 %Certificate is not nearing expiration.

Wednesday, March 30, 2016

MS Dynamics CRM - Display Unique/Auto Number on the form before save.

My client requirement is display the unique reg number for new contact before the save record.
My Previous blog <a href="http://makdns.blogspot.com/2016/03/ms-dynamics-crm-generate-uniqueauto.html">MS Dynamics CRM - Generate Unique/Auto Number</a> will show the reg number on form after save the new contact. if the user clicks save and close, they can't see the number.

So i come up with the web service concept to generate unique number for new contact and display on the contact screen.
Also i am using SQL Server sys.sequences for generating new number.

Web Service Code

MS Dynamics CRM - Generate Unique/Auto Number

MS Dynamics CRM doesn't contain auto increment number attribute. My client was assigned each unique registration number for contact entity.
There is lot options available in the market, but i used very easy code to achieve this task. I used pre create plugin operation to create new registration unique/auto number. Number will be create on while saving the record.

i created one custom entity (dns_global), it will keep last reg number.

Dynamics CRM - Update Contact Fullname

My client want the fullname with the suffix and custom order like LastName, FirstName Middle Name Suffix. Dynamics CRM System Settings doesn't have the option to set the custom order fullname. Contact entity fullname is readonly attribute, it won't allow to update the fullname directly.

You can update through only pre create or update operation plugin.

Tuesday, March 29, 2016

MS Dynamics CRM - Login user's security role using javascript

I have one situation, login user has multiple security roles, if the login user has permission for particular role, show some buttons/fields otherwise the hide buttons/fields.

It is not stright forward to find out the security role, So i wrote one javascript to find out the security role.

Here i am checking the user has "Content Manager" security role or not.

var CMRole = CheckUserRole("Content Manager");
if (CMRole) {
    //true to show buttons
} else {
    //false to hide buttons
}


This function will get all the user's security role Id, passing security role id to get the security role name. If it match, it is true otherwise false.
function CheckUserRole(roleName) {
    var currentUserRoles = Xrm.Page.context.getUserRoles();
    for (var i = 0; i < currentUserRoles.length; i++) {
        var userRoleId = currentUserRoles[i];
         var userRoleName = GetRoleName(userRoleId);
         if (userRoleName == roleName) {
            return true;
         }
    }
    return false;
}


This function calling odata web service and get the each security role name.
 function GetRoleName(userRoleId) {
     var selectQuery = "RoleSet?$top=1&$filter=RoleId eq guid'" + userRoleId + "'&$select=Name";
     var odataSelect = GetServerUrl() + selectQuery;
     //alert(odataSelect);
     var roleName = null;
     $.ajax({
         type: "GET",
         async: false,
         contentType: "application/json; charset=utf-8",
         datatype: "json",
         url: odataSelect,
         beforeSend: function (XMLHttpRequest) { XMLHttpRequest.setRequestHeader("Accept", "application/json"); },
         success: function (data, textStatus, XmlHttpRequest) {
             var result = data.d;
             if (!!result) {
                 roleName = result.results[0].Name;
             }
         },
         error: function (XmlHttpRequest, textStatus, errorThrown) {
             //alert('OData Select Failed: ' + odataSelect);
         }
     });
     return roleName;
 }

Dynamics CRM - Get selected id from the grid and refresh.

1)Creates a custom button, contains one command (dns.dns_copies.Command.UnCopy)
2)command calling UnCopy javascript (library->$webresource:dns_js/Contact.js) function.
3)command contains 3 parameters
    i)[Crm Parameter]=SelectedControl   (grid name)
   ii)[Crm Parameter]=SelectedControlSelectedItemCount  (number of selected rows)
  iii)[Crm Parameter]=SelectedControlSelectedItemIds (selected entity ids)

Tuesday, March 1, 2016

Dynamics CRM Action

CRM Action is a process that allows a user to create it and add custom Workflow, but Action is only be able to be called or triggered by client (Javascript) or server code (C#).

Actions can be defined for an entity or none (Global entity).

Custom Action can be used as Custom Message or Event Handle and can be registered by using Plugin Registration Tool.

Example, storing config parameters (like server url), custom error message, used for complex business code, single point of integration for third party systems.

Create an Action without no steps, message name is edm_TestActionName, entity is none, passing one input ContactID (reference) & one output ValidContact (boolean) parameters. Activate it

Generate an Early Bound Class to get your action in your class library, refer this blog http://makdns.blogspot.com/2012/11/crmsvcutilexe-crm-dynamics-2011-code.html (parameter /generateActions)

Create a Plugin Class, compile & deploy

Thursday, June 4, 2015

Unable to get property 'ClientVariables' of undefined or null reference - MS Dynamics CRM

CRM contact form loaded completely empty without error message, CRM UI server Event viewer is not giving any error. I checked FF & Chrome nothing produce any error details. Then i tried IE, IE throws 'Unable to get property 'ClientVariables' of undefined or null reference'

Finally i figure it our, If the CRM Role doesn't have read rights on the campaign entity, you will get this error. campaign empty is connected with contact entity. I never used campaign entity in my projects, CRM is internally tied with campaign entity.

Thursday, May 21, 2015

Dynamic CRM Hide/Show ribbon button by OnChange lookup field

1)create a javascript (HideShow.js), 2 functions

var HideShowButton = {
//refresh the ribbon when lookup field on change.
OnChangeLookup: function () {
        Xrm.Page.ui.refreshRibbon();
  },

//Show and Hide when form load
EnableCustomRule: function () {
if (Xrm.Page.data.entity.attributes.get("contactid") != null) {
   var contactId = Xrm.Page.data.entity.attributes.get("contactid").getValue()[0].id;
   var req = new XMLHttpRequest();
   var url = Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/ContactSet(guid'" + contactId + "')?$select=photoonfile";
   req.open("GET", encodeURI(url), false);
   req.setRequestHeader("Accept", "application/json");
   req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
   req.send();
   var data = JSON.parse(req.responseText).d;
   if (data.photoonfile == null || data.photoonfile == false) {
return true;
   }
   return false;
}
},
};

Friday, November 23, 2012

CrmSvcUtil.exe - CRM Dynamics 2011/2013/2015 Code Generation Tool - Early Bound

CrmSvcUtil.exe command-line tool, called the Microsoft.Xrm.Client.CodeGeneration extension, which you can use to generate the data context and data transfer object classes for your Microsoft Dynamics CRM organization.

CrmSvcUtil.exe /codeCustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization,Microsoft.Xrm.Client.CodeGeneration" /url:http://<Server_Name>/<Organization_Name>/XRMServices/2011/Organization.svc /username:uid /password:pwd /out:"CRMEntities.cs" /namespace:CRM.Entities /serviceContextName:CrmServiceContext

Generate Custom Action as Early Bound (parameter /generateActions)
CrmSvcUtil.exe /url:http://<Server_Name>/<Organization_Name>/XRMServices/2011/Organization.svc /username:uid /password:pwd /out:"c:\crmprojects\CRMEntities.cs" /namespace:DNS.CRM.Entities /serviceContextName:CrmServiceContext /generateActions

Reference - http://msdn.microsoft.com/en-us/library/ff681563.aspx