The plug-in execution failed because no Sandbox Hosts are currently available. Please check that you have a Sandbox server configured and that it is running.

Hi,

We had our plugins registered in Sandbox mode (for development we were using on premise and were deploying it on online environment) and the Microsoft Dynamics CRM Sandbox Processing Service was not running.

Starting the service resolved the issue.

Hope it helps.

“System.ArgumentException: The specified string is not in the form required for a subject” error while sending mail through plugin in CRM 2011.

Hi,

We were getting the above error in one of our plugin which was using SendEmailRequest to send mail.

As it turned out it was because of the subject not being in proper format in the template

 

 

Hope it helps.

Unhandled Exception: System.ServiceModel.Security.SecurityNegotiationException: SOAP security negotiation with ‘http://../XRMServices/2011/Organization.svc’ for target ‘http://.. /XRMServices/2011/Organization.svc’ failed while using Plugin Registration Tool.

Hi,

Today I was getting the above error while trying to update one of my plugin assemblies. The password of the admin account had recently changed. So I had to Remove the existing connection and create a new one to get things working.

Bye.

SecurityException: Request for the permission of type “System.Security.Permissions.EnvironmentPermission” failed in CRM 2011 plugin.

We will get this error while using Environment.MachineName
in our plugin code to get the Server Name in case of Sandbox.

Bye.

Security Exception: That assembly does not allow partially trusted callers in CRM 2011 plugin.

Hi,

We were getting the below error in one of our plugins. The reason was because we were making use of HttpContext class of System.Web assembly.

For our on-premise deployment it was working fine, we were getting this issue only on registering plugin on Sandbox mode.

We can find the explanation here

http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/302377cf-97bd-4fe9-b7d0-fa7f08152927/

Bye.

Writing a Plugin on “Distribute Campaign Activity” message in CRM.

Hi,

We recently had a requirement to execute a plugin  when a CampaignActivity is distributed using “Distribute Campaign Activity” button.

As it turned out, this message was not available.

As it was on premise, we enabled it in an unsupported manner i.e. by updating the sdkmessagefilterbase table in orgname_mscrm database.

SQL Query Used :-

update sdkmessagefilterbase

set isCustomProcessingStepAllowed=1

where

sdkmessageid=(select sdkmessageid from sdkmessagebase where name=‘DistributeCampaignActivity’)

and

primaryObjectTypecode=‘4402’


Hope this helps.

Getting the IncidentId on resolving a Case in post Close plugin.

Hi,

To get the id of the case record which is getting resolved in the plugin, we need to make use of IncidentResolution inputparameters of the context.


Entity incRes = this.Context.InputParameters["IncidentResolution"] as Entity;
 Guid caseId = ((EntityReference)incRes.Attributes["incidentid"]).Id;

Bye.

Use “Close” message when we “Resolve” an Incident (Case) in CRM.

We had one plugin which was registered against “SetState” and “SetStateDynamic” message. It used to run when we were doing “Cancel Case” from the ribbon.

We thought the same message will work in case of “Resolve Case“.

However in case of Resolve Case, we need to use or register our plugin against the “Close” message.

InputParametersà

Hope it helps.

System.NullReferenceException: Microsoft Dynamics CRM has experienced an error. -2147220970

Hi,

At times we have got this error while saving our record in CRM. It can occur if we have mistakenly registered steps of one of our plugins to some other plugins. Please check in plugin registration tool and delete those steps.

Hope it helps.

Plugin to check the InputParameters value of the Context in CRM 2011.

Hi,

Wrote a simple plugin to check the value of InputParameters being passed on update of lead record.

  public void Execute(IServiceProvider serviceProvider)
        {
            IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
            Entity myEntity = (Entity)context.InputParameters["Target"];
            // Get the attribute collection
            AttributeCollection myAttColl = myEntity.Attributes;
            // Write in a log file
            TextWriter log = TextWriter.Synchronized(File.AppendText(@"C:\InputParameterLog.txt"));

            log.WriteLine("Log generated at  " + DateTime.Now);
            log.WriteLine();

            foreach (KeyValuePair<string, object> myKV in myAttColl)
            {
                log.WriteLine("Key - " + myKV.Key);

                if (myKV.Value == null)
                {
                    log.WriteLine("Value - null");
                }
                else if (myKV.Value.GetType()== typeof(EntityReference))
                {
                    EntityReference eRef = myKV.Value as EntityReference;
                    log.WriteLine("Id - " + eRef.Id.ToString());
                    log.WriteLine("Logical Name - " + eRef.LogicalName);
                    log.WriteLine("Name - " + eRef.Name);
                }

                else if (myKV.Value.GetType() == typeof(OptionSetValue))
                {
                    OptionSetValue oSetValue = myKV.Value as OptionSetValue;
                    log.WriteLine("OptionSetValue - " + oSetValue.Value);
                }

                else
                {
                    log.WriteLine("Value - " + myKV.Value.ToString());
                }

                log.WriteLine();
            }
            log.WriteLine();
            log.Close();

        }

Haven’t tested it though, might be useful while debugging.

Bye.