Sunday, November 27, 2011
Sunday, November 20, 2011
Microsoft Dynamics CRM 2011 crmForm workaround
There is a problem when checking attributes value, after the user clicks on ribbon button without losing focus of the attribute.
Description:
1) I've register the ribbon button event to something like:
if(Xrm.Page.getAttribute("new_test").getValue() != null)
{
alert("aaaaa");
}
}
2) User clicks the ribbon button when the attribute is empty
3) Get's alert
4) User insert text to the attribute and clicks again
5) Get's alert
After changing the code to the old (CRM 4) javascript syntact:
if(crmForm.all.new_test.DataValue != null)
{
alert("AAAA");
}
Everything worked great! Even when the focus still on the textbox.
This is a workaround.
This is a workaround.
Tuesday, November 15, 2011
MSCRM 2011 Set Guid (Any Entity Id) Plugin
MSCRM 2011 Set Guid (Any Entity Id) Plugin
http://dynamicslollipops.blogspot.com/2011/10/mscrm-2011-workflow-assembly-get.html
Because it's impossiable to use workflow assembly in Microsoft Dynamics CRM 2011,
This is the piece of code needed for creating plugin that's sets any entity GUID into any test field you choose.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xrm.Sdk;
namespace MSCRM2011SetGuidPlugin
{
public class MSCRM2011SetGuidPlugin : IPlugin
{
public readonly string rAttributeSchemaName = "new_guid";
public string m_SecureConfig { get; set; }
public string m_Config { get; set; }
public MSCRM2011SetGuidPlugin(string i_Config, string i_SecureConfig)
{
m_Config = i_Config;
m_SecureConfig = i_SecureConfig;
}
/// <summary>
/// A plugin that creates a follow-up task activity when a new account is created.
/// </summary>
/// <remarks>Register this plug-in on the Create message, account entity,
/// and asynchronous mode.
/// </remarks>
public void Execute(IServiceProvider serviceProvider)
{
//Extract the tracing service for use in debugging sandboxed plug-ins.
ITracingService tracingService =
(ITracingService)serviceProvider.GetService(typeof(ITracingService));
// Obtain the execution context from the service provider.
IPluginExecutionContext context = (IPluginExecutionContext)
serviceProvider.GetService(typeof(IPluginExecutionContext));
IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
tracingService.Trace("Config: " + m_Config);
string attr = rAttributeSchemaName;
if (!String.IsNullOrEmpty(m_Config))
{
attr = m_Config;
}
tracingService.Trace("attr: " + attr);
tracingService.Trace("id: " + context.PrimaryEntityId);
Guid id = context.PrimaryEntityId;
Entity entity = new Entity(context.PrimaryEntityName);
entity.Id = id;
entity.Attributes.Add(attr, id.ToString());
service.Update(entity);
}
}
}
http://dynamicslollipops.blogspot.com/2011/10/mscrm-2011-workflow-assembly-get.html
Because it's impossiable to use workflow assembly in Microsoft Dynamics CRM 2011,
This is the piece of code needed for creating plugin that's sets any entity GUID into any test field you choose.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xrm.Sdk;
namespace MSCRM2011SetGuidPlugin
{
public class MSCRM2011SetGuidPlugin : IPlugin
{
public readonly string rAttributeSchemaName = "new_guid";
public string m_SecureConfig { get; set; }
public string m_Config { get; set; }
public MSCRM2011SetGuidPlugin(string i_Config, string i_SecureConfig)
{
m_Config = i_Config;
m_SecureConfig = i_SecureConfig;
}
/// <summary>
/// A plugin that creates a follow-up task activity when a new account is created.
/// </summary>
/// <remarks>Register this plug-in on the Create message, account entity,
/// and asynchronous mode.
/// </remarks>
public void Execute(IServiceProvider serviceProvider)
{
//Extract the tracing service for use in debugging sandboxed plug-ins.
ITracingService tracingService =
(ITracingService)serviceProvider.GetService(typeof(ITracingService));
// Obtain the execution context from the service provider.
IPluginExecutionContext context = (IPluginExecutionContext)
serviceProvider.GetService(typeof(IPluginExecutionContext));
IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
tracingService.Trace("Config: " + m_Config);
string attr = rAttributeSchemaName;
if (!String.IsNullOrEmpty(m_Config))
{
attr = m_Config;
}
tracingService.Trace("attr: " + attr);
tracingService.Trace("id: " + context.PrimaryEntityId);
Guid id = context.PrimaryEntityId;
Entity entity = new Entity(context.PrimaryEntityName);
entity.Id = id;
entity.Attributes.Add(attr, id.ToString());
service.Update(entity);
}
}
}
If no attribute is in the configuration, then it tries to place the GUID into new_guid.
The complate code project and dll
are in https://docs.google.com/open?id=0B8k6R6QcCN7IYjNlMWI3MzEtNjVmNi00NmQ1LTg2M2QtMDc2YTQ0NzJlMGMy
Friday, November 4, 2011
MSCRM 2011 Debug plugin
I've just read it and wanted to share it.
http://msdn.microsoft.com/en-us/library/hh372952.aspx
It helps debuging plugins even when the Dynamics CRM is ONLINE.
It is great for unit testing.
It is what i was looking for.
http://msdn.microsoft.com/en-us/library/hh372952.aspx
It helps debuging plugins even when the Dynamics CRM is ONLINE.
It is great for unit testing.
It is what i was looking for.
Thursday, November 3, 2011
Dynamics CRM 2011 record hyperlink
Dynamics CRM 2011 record hyperlink.
Finally
Microsoft added Insert Hyperlink to send email / email templates in MSCRM 2011 Rollup 5.
The workarounds are finally uneeded anymore.
Walkthrough:
1) Go to send email in workflow
2) Insert text for display
3) insert the Record URLto the url field.
4) Click on OK.
Finally
Microsoft added Insert Hyperlink to send email / email templates in MSCRM 2011 Rollup 5.
The workarounds are finally uneeded anymore.
Walkthrough:
1) Go to send email in workflow
2) Insert text for display
3) insert the Record URLto the url field.
4) Click on OK.
Subscribe to:
Comments (Atom)