Answered by:
plugin development

Question
-
Hi,
Using the plugin development link
http://msdn.microsoft.com/en-us/library/dd393295.aspx
I have added the plugin registration tool in visual studio
Then i created a plugin using the following link
http://msdn.microsoft.com/en-us/library/bb955365.aspx
When i am testing the plug-in it live it gives me the following error
GUID should contain 32 digits with 4 dashes (XXXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)
Please help me for the same.......
Saturday, May 15, 2010 11:16 AM
Answers
-
Hi,
Are u sure, you register the message againt "Create" event and not "Update", because in Update event the Id willn't be there in the Output parameters, it is there only in the "Create" event (POST)
Muhammad Ali Khan
http://malikhan.wordpress.com- Marked as answer by Jim Glass Jr Monday, May 24, 2010 3:21 PM
Monday, May 24, 2010 10:39 AM -
Hi,
Kiran your code looks correct, I think there is some mistake in registration process only, so I will suggest you to reconsider all the steps as described in http://msdn.microsoft.com/en-us/library/bb955365.aspx and if you still get this error try to debug your plugin
http://msdn.microsoft.com/en-us/library/cc151088.aspx (remember to follow all steps)
Mahain- Marked as answer by Jim Glass Jr Monday, May 24, 2010 3:21 PM
Monday, May 24, 2010 10:44 AMModerator
All replies
-
Hi,
I think the error is coming on this line.
lookup.Value = new Guid(context.OutputParameters.Properties["id"].ToString());
The reason for this is, you registere teh plugin on Pre-Create in plugin registration tool, You have to register the plugin on Post-Create. In Pre-Create, the property id doesn't exits and it is there only after creation of account entity in Post-Create event.
Muhammad Ali Khan
http://malikhan.wordpress.com- Proposed as answer by Muhammad Ali Khan Saturday, May 15, 2010 11:29 AM
Saturday, May 15, 2010 11:26 AM -
Hi,
I have registered the plugin on post create and not on precreate still i am getting the same error
GUID should contain 32 digits with 4 dashes (XXXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)
Please help ??
Monday, May 24, 2010 10:13 AM -
Did u register it on parent pipeline?
Can u debug your workflow, see here for debugging.
http://msdn.microsoft.com/en-us/library/cc151088.aspx
Muhammad Ali Khan
http://malikhan.wordpress.comMonday, May 24, 2010 10:25 AM -
Hi,
I will suggest your paste you code here, that will help to find real culprit.
MahainMonday, May 24, 2010 10:27 AMModerator -
Hi,
This is my code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Crm.SdkTypeProxy;
using Microsoft.Crm.Sdk;namespace Microsoft.Crm.Sdk.Walkthrough
//AccountCreatePlugin
{
//Plugin
public class AccountCreateHandler :IPlugin
{
public void Execute(IPluginExecutionContext context)
{
DynamicEntity entity = null;if (context.InputParameters.Properties.Contains("Target") && context.InputParameters.Properties["Target"] is DynamicEntity)
{
entity = (DynamicEntity)context.InputParameters.Properties["Target"];if (entity.Name != EntityName.account.ToString())
{
return;
}}
else
{
return;
}try
{
DynamicEntity followup = new DynamicEntity();
followup.Name = EntityName.task.ToString();
followup.Properties = new PropertyCollection();
followup.Properties.Add(new StringProperty("subject", "Send E-mail to new customer"));
followup.Properties.Add(new StringProperty("description", "Follow up the customer. Check if there are any new issues that need resolution."));
followup.Properties.Add(new CrmDateTimeProperty("scheduledstart", CrmTypes.CreateCrmDateTimeFromUniversal(DateTime.Now.AddDays(7))));
followup.Properties.Add(new CrmDateTimeProperty("scheduledend", CrmTypes.CreateCrmDateTimeFromUniversal(DateTime.Now.AddDays(7))));
followup.Properties.Add(new StringProperty("category", context.PrimaryEntityName));
if(context.OutputParameters.Properties.Contains("id"))
{
Lookup lookup = new Lookup();
lookup.Value=new Guid(context.OutputParameters.Properties.Contains("id").ToString());
lookup.type=EntityName.account.ToString();
followup.Properties.Add(new LookupProperty("regardingobjectid", lookup));
}
TargetCreateDynamic targetCreate = new TargetCreateDynamic();
targetCreate.Entity = followup;CreateRequest create = new CreateRequest();
create.Target = targetCreate;ICrmService service = context.CreateCrmService(true);
CreateResponse created = (CreateResponse)service.Execute(service);
}
catch (System.Web.Services.Protocols.SoapException ex)
{
throw new InvalidPluginExecutionException("An error occured in the AccountCreaterHandler plug-in.", ex);
}
}
}
}Monday, May 24, 2010 10:32 AM -
Yes i registered it in parent pipeline
I am a starter with crm development
I started with registration a plugin registration tool using this link
http://msdn.microsoft.com/en-us/library/bb955363(v=MSDN.10).aspx
Then i created a simple plugin using this link
http://msdn.microsoft.com/en-us/library/bb955365(v=MSDN.10).aspx
but when i test plugin use online and when i save the record of account
it gives the error GUID should contain 32 digits with 4 dashes (XXXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)
and new email is also not created in activity.
- Edited by Kiran N Monday, May 24, 2010 10:39 AM
Monday, May 24, 2010 10:36 AM -
Hi,
Are u sure, you register the message againt "Create" event and not "Update", because in Update event the Id willn't be there in the Output parameters, it is there only in the "Create" event (POST)
Muhammad Ali Khan
http://malikhan.wordpress.com- Marked as answer by Jim Glass Jr Monday, May 24, 2010 3:21 PM
Monday, May 24, 2010 10:39 AM -
Hi,
Kiran your code looks correct, I think there is some mistake in registration process only, so I will suggest you to reconsider all the steps as described in http://msdn.microsoft.com/en-us/library/bb955365.aspx and if you still get this error try to debug your plugin
http://msdn.microsoft.com/en-us/library/cc151088.aspx (remember to follow all steps)
Mahain- Marked as answer by Jim Glass Jr Monday, May 24, 2010 3:21 PM
Monday, May 24, 2010 10:44 AMModerator -
Hi,
I am getting the same error of GUID should contain 32 digits with 4 dashes (XXXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX) how to resolve this error plz help.
Now i want to remove this account plugin which i have added how to go about it??
I had removed the dll from C:\Program Files\Microsoft Dynamics CRM\Server\bin\assembly\AccountCreatePlugin.dll
still its giving me the same error.
How to unregister a plugin??
This account plugin code i had written referencing the sdk.
Saturday, June 12, 2010 8:23 AM -
Hi,
To remove the plugin, open the plugin registration tool, select the plugin assembly and click un-register button from the top bar.
Regarding the Guid error, As i said above, you have to register the plugin on POST-CREATE, and Not Post Update. You can do this in following way, Select the Step against which you have register the plugin (in plugin registration tool), click update, in the "Step Registration" window, make sure the "Event is Create" and you have selected "Post".
Muhammad Ali Khan
http://malikhan.wordpress.comSaturday, June 12, 2010 8:39 AM -
Hi,
Thanks sir i have successfully unregistered the assembly....
But registring assembly is givng me the same problem
message is create
event pipleline state of execution is Post Stage
execution mode is synchronous
step deployment is server
trigerring pipeline is parent pipeline
Saturday, June 12, 2010 10:25 AM -
Hi,
can u debug the plugins, this may lead to the exact line of error.
http://msdn.microsoft.com/en-us/library/cc151088.aspx
Muhammad Ali Khan
http://malikhan.wordpress.comSaturday, June 12, 2010 10:57 AM