Have you confused with the scope of CRM Pre & Post Image scope. And when the each image exists & when not? You can now easily find it out in below image.
Thursday, January 19, 2012
Tuesday, January 17, 2012
Object address not found on party or party is marked as non-emailable
When you want to send an email using CRM, you may use direct method to send email or you may use SendEmailFromTemplateRequest. And sometimes you may get the error "Object address not found on party or party is marked as non-emailable". Once you debug and found the error, you will be differently know that either the email address of 'To' is blank or marked as 'No Email' or 'No Bulk Email'. But when if fields are set correctly, and if you get the same error, once shall we do?
Other than the To Address, you have to check the 'From' users email validity as well(which we usually forget to set), because if it is missing, you will get the same error 'Object address not found on party or party is marked as non-emailable'
And what will happen if the From field is blank? Then CRM conside From user as execution context user. (May be plugin executer in Plugin Context or executer in CRM Async Service for workflows or the credentials you used to communicate with CRM Service.) And if the email address of this user is missing, you will get the same error. "Object address not found on party or party is marked as non-emailable"
Other than the To Address, you have to check the 'From' users email validity as well(which we usually forget to set), because if it is missing, you will get the same error 'Object address not found on party or party is marked as non-emailable'
And what will happen if the From field is blank? Then CRM conside From user as execution context user. (May be plugin executer in Plugin Context or executer in CRM Async Service for workflows or the credentials you used to communicate with CRM Service.) And if the email address of this user is missing, you will get the same error. "Object address not found on party or party is marked as non-emailable"
Thursday, January 5, 2012
Show CRM Form based on User Role
Sometimes we have to show CRM Form by logged user role. The best way to do this is assign form to correct Security role using CRM Custermizations. But sometimes we have to show the correct Form using Javascripts. For that you can use the below code.
Copy the below function to your global/common javascript file
function LoadUserForm(formName) { var allForms = Xrm.Page.ui.formSelector.items.get(); if(allForms != null && allForms.length > 1) { for(var i = 0; i < allForms.length; i++) { var currentName = allForms[i].getLabel().toLowerCase(); if(currentName == formName) { Xrm.Page.ui.formSelector.items.get(i).navigate(); break; } } } }Then copy below function to all forms in the same entity
function window.onload() { var currentUserRole = GetCurrentUserRole(); if(currentUserRole == 'System Administrator') { LoadUserForm('SA Form') } else if(currentUserRole == 'Sales Manager') { LoadUserForm('SM Form') } else if(currentUserRole == 'System Operator') { LoadUserForm('SO Form') } }
Wednesday, November 23, 2011
Reset App Pool in Command Line
One of major issue happens when you customize CRM entities is, even you publish the solution, SOMETIMES your changes are not getting applied and hence you need to do a IIS Reset.
This is becomes an issue,
1. when the client is also accessing the system
2. QA team performing testing in the same CRM Instance
3. Your team members may be using the system or in a debugging their code.
So instead of doing a IIS Reset, you can do a Application Pool reset. But normally that need to open the Internet Information Service (IIS InetMgr.exe) and need to navigate to App pools and you have to manyually reset all the relevent application pools.
Instead of that you may create a bat file, and call once.
1. when the client is also accessing the system
2. QA team performing testing in the same CRM Instance
3. Your team members may be using the system or in a debugging their code.
So instead of doing a IIS Reset, you can do a Application Pool reset. But normally that need to open the Internet Information Service (IIS InetMgr.exe) and need to navigate to App pools and you have to manyually reset all the relevent application pools.
Instead of that you may create a bat file, and call once.
@echo off
echo.
echo recycling 'CRMAppPool' Application Pool
%windir%\System32\inetsrv\appcmd recycle apppool /apppool.name:CRMAppPool
echo.
echo.
echo recycling 'CRMAppPool' Application Pool
%windir%\System32\inetsrv\appcmd recycle apppool /apppool.name:CRMAppPool
echo.
Thursday, November 17, 2011
Hide Section in CRM 2011
Do you want to hide a section in CRM 2011?
Steps
1. Open the customization form
2. Double click the section and copy the section Label. Let's say it's name is 'General'
3. Copy the below java script function
4. Call the function in CRM Form Load event
HideSection('General');
Steps
1. Open the customization form
2. Double click the section and copy the section Label. Let's say it's name is 'General'
3. Copy the below java script function
function HideSection(sectionLabel) { try { var tabs = Xrm.Page.ui.tabs; for (var i = 0; i < tabs.getLength(); i++) { var tab = tabs.get(i); var sections = tab.sections; for (var j = 0; j < sections.getLength(); j++) { var section = sections.get(j); if (section.getLabel() == sectionLabel) { section.setVisible(false); break; } } } } catch (err) { } }
4. Call the function in CRM Form Load event
HideSection('General');
Wednesday, November 2, 2011
Cancel/Inactivate a record when it is already in the same status

You many need to cancel Order, Invoice or any other record using workflow.
Before cancelling the workflow, you must check whether the record is already in cancel status.
If the record is already in cancel status, when you are trying to cancel it again, you will experience below error.
Workflow paused due to error: Unhandled Exception:
System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: The entity cannot be closed because it is not in the correct state.Detail:
at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType) at Microsoft.Crm.Extensibility.InprocessServiceProxy.ExecuteCore(OrganizationRequest request) at Microsoft.Crm.Workflow.Services.SetStateActivityService.<>c__DisplayClass1. -2147220941 The entity cannot be closed because it is not in the correct state. 2011-11-02T06:09:20.2231504Z
-2147220941 The entity cannot be closed because it is not in the correct state. 2011-11-02T06:09:20.2231504Z b__0(IOrganizationService sdkService) at Microsoft.Crm.Workflow.Services.ActivityServiceBase.ExecuteInTransactedContext(ActivityDelegate activityDelegate) at Microsoft.Crm.Workflow.Services.SetStateActivityService.SetStateInternal(String entityName, Guid entityId, Int32 state, Int32 status) at Microsoft.Crm.Workflow.Services.SetStateActivityService.ExecuteInternal(ActivityContext executionContext, SetState setState) at Microsoft.Crm.Workflow.Services.SetStateActivityService.Execute(ActivityContext executionContext, SetState setState) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
Tuesday, November 1, 2011
Workflow Scope
One of big mistakes we do when we are implementing CRM workflows are we do not set the Workflow scope. By default CRM sets the workflow scope to User Level
So the workflow is executing only when the workflow assign user triggers the workflow. To fix the problem, you have to set the scope to 'Organization' level, so the workflow will fire when any user execute a task that triggers the workflow.
So the workflow is executing only when the workflow assign user triggers the workflow. To fix the problem, you have to set the scope to 'Organization' level, so the workflow will fire when any user execute a task that triggers the workflow.

Subscribe to:
Posts (Atom)