Answered by:
Very Urgent:MS CRM 2011 - Workflow activity not getting Succeeded. Error : Expected non-empty Guid.

Question
-
Hi,
I am creating a custom workflow acitvity by which I am checking whether the sender is of Contact/Account/User type then create a case based on the Email.But when I execute the workflow everything works but workflow getting failed and not going ahead in any other steps.
Please note that I am using Output parameter to check sender for contact/account/user.So this Output parameter may be not working. I googled for sollution and found that CRM has no setting for such kind of nullable condition.
Can any one please suggest me the sollution for the same.
Error:
<ErrorCode>-2147220989</ErrorCode>
<Message>Expected non-empty Guid.</Message>Code:
[Output("Contact")]
[ReferenceTarget("contact")]
public OutArgument<EntityReference> myContact { get; set; }if (((EntityReference)party["partyid"]).Id != null)
this.myContact.Set(executionContext, new EntityReference("contact", gpartyId));
else
this.myContact.Set(executionContext, Guid.NewGuid());Thanks,
Archana Parmar
Archana Mayur Parmar
Tuesday, October 2, 2012 1:01 PM
Answers
-
Hello,
If I understand your question correctly. You are creating a workflow on the Email entity. You want to check the entity type for the 'From' field in the Email entity. Correct?
Assuming this is what you want, you should be able to determine the entity type of any of the members in the 'From' field by checking its 'LogicalName' property. Something like..
foreach (var er in email.From) { switch (er.LogicalName) { case Contact.EntityLogicalName: //contact break; case Account.EntityLogicalName: //account break; case SystemUser.EntityLogicalName: //systemuser break; } }
Now you have the entity type. From there, I am not sure I understand why you want to set up the Output Parameter. Instead of passing anything back to CRM, I would just create the Case record right in the workflow.
Does this help? If so, kindly mark it as answer.
Thanks,
Oliver
oliver barrera
- Proposed as answer by oliver barrera Tuesday, October 2, 2012 3:00 PM
- Marked as answer by Archana Parmar Wednesday, October 3, 2012 5:17 AM
Tuesday, October 2, 2012 2:59 PM -
Hi Oliver,
Thanks for your reply.
The reason I took the output parameter was to set it to the related respective entity - Contact/Account/User.
I want to create a new case when any support email comes to CRM.i.e. any customer who sends any mail to support team than a case should be created automatically from CRM system.
So if I set the respective contact/Account/User from custom workflow activity than after checking the condition like if it founds sender as recognised contact than it will set the related field which I took as output parameter.For you reference I am mentioning the URL which I followed to achieve this task.Just the difference is it is in 4.0 and I want the same code and task in CRM 2011.
Can you please also suggest me what do I set to automatic track Mails in Outlook to CRM.The System settings only track outgoing mails but not incoming Mails.I have to explicitly click on "Track to CRM" from Outlook to get the mails in CRM.
Awaiting for your reply.
Thanks,
Archana
Archana Mayur Parmar
- Marked as answer by Archana Parmar Wednesday, October 3, 2012 5:17 AM
Wednesday, October 3, 2012 5:17 AM
All replies
-
Hello,
If I understand your question correctly. You are creating a workflow on the Email entity. You want to check the entity type for the 'From' field in the Email entity. Correct?
Assuming this is what you want, you should be able to determine the entity type of any of the members in the 'From' field by checking its 'LogicalName' property. Something like..
foreach (var er in email.From) { switch (er.LogicalName) { case Contact.EntityLogicalName: //contact break; case Account.EntityLogicalName: //account break; case SystemUser.EntityLogicalName: //systemuser break; } }
Now you have the entity type. From there, I am not sure I understand why you want to set up the Output Parameter. Instead of passing anything back to CRM, I would just create the Case record right in the workflow.
Does this help? If so, kindly mark it as answer.
Thanks,
Oliver
oliver barrera
- Proposed as answer by oliver barrera Tuesday, October 2, 2012 3:00 PM
- Marked as answer by Archana Parmar Wednesday, October 3, 2012 5:17 AM
Tuesday, October 2, 2012 2:59 PM -
Hi Oliver,
Thanks for your reply.
The reason I took the output parameter was to set it to the related respective entity - Contact/Account/User.
I want to create a new case when any support email comes to CRM.i.e. any customer who sends any mail to support team than a case should be created automatically from CRM system.
So if I set the respective contact/Account/User from custom workflow activity than after checking the condition like if it founds sender as recognised contact than it will set the related field which I took as output parameter.For you reference I am mentioning the URL which I followed to achieve this task.Just the difference is it is in 4.0 and I want the same code and task in CRM 2011.
Can you please also suggest me what do I set to automatic track Mails in Outlook to CRM.The System settings only track outgoing mails but not incoming Mails.I have to explicitly click on "Track to CRM" from Outlook to get the mails in CRM.
Awaiting for your reply.
Thanks,
Archana
Archana Mayur Parmar
- Marked as answer by Archana Parmar Wednesday, October 3, 2012 5:17 AM
Wednesday, October 3, 2012 5:17 AM -
Sorry to give you referenced URL in above Post.Please not the URL as below:
Archana Mayur Parmar
Wednesday, October 3, 2012 6:03 AM -
Hello Archana,
I think I know what your issue is. Assuming your Output Parameter is set correctly, I think that your case is created but not associated to the account/contact/user, correct? If this is the case, remember that in CRM the fact that you have a sequence of steps in a workflow does not necessarily mean that each one waits for the previous one to complete. That is, they are running asynchronously. That could cause for your case to be created before the custom activity you created has finished executing.
I would recommend that you add a Wait operation right after the activity is called. You will have the workflow wait until your output parameter has a value. That would guarantee that the workflow is forced to pause until the custom activity has completed.
As for your last question, are you trying to track it under the record who sent the email? If this is the case, just set the RegardingObjectId property (for the Case entity) to the Entity which sent the email.
HTH,
Oliver
oliver barrera
- Edited by oliver barrera Wednesday, October 3, 2012 12:02 PM
Wednesday, October 3, 2012 12:01 PM