Hi Guys,
I am new to C# and Custom Workflow in MS CRM.
I've created one workflow to get record guid as a result, to put in the lookup field on Opportunity. when the workflow executed it raise an error like this.
Unexpected exception from plug-in (Execute): IBS.MSCRM.IBSConstruction.FetchXMLReturnConsProjectParticipant: System.IO.FileNotFoundException: Could not load file or assembly 'IBS.MSCRM.Core.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3d22e7ae6a0b3afb' or one of its dependencies. The system cannot find the file specified.
and here is the Error Detail
Plugin Trace:
[IBS.MSCRM.IBSConstruction: IBS.MSCRM.IBSConstruction.FetchXMLReturnConsProjectParticipant]
[IBS.MSCRM.IBSConstruction (1.0.0.0): IBS.MSCRM.IBSConstruction.FetchXMLReturnConsProjectParticipant]Error Message:
Unhandled Exception: Microsoft.Crm.CrmException: Unexpected exception from plug-in (Execute): IBS.MSCRM.IBSConstruction.FetchXMLReturnConsProjectParticipant: System.IO.FileNotFoundException: Could not load file or assembly 'IBS.MSCRM.Core.Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3d22e7ae6a0b3afb' or one of its dependencies. The system cannot find the file specified.
at Microsoft.Crm.Sandbox.SandboxCodeUnit.Execute(IExecutionContext context)
at Microsoft.Crm.Workflow.Services.ProxyCustomActivity.Execute(CodeActivityContext executionContext)
I don't know what's the problem. I have de-register and register the plugin, but this error still occurs.
here is my code :
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Activities; using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Workflow; using Microsoft.Xrm.Sdk.Query; using Microsoft.Crm.Sdk; using IBS.MSCRM.Core.Library; namespace IBS.MSCRM.IBSConstruction { public sealed class FetchXMLReturnConsProjectParticipant : CodeActivity { [Input("FetchXMLQuery")] public InArgument<string> fetchxmlquery { get; set; } [Input("FieldName")] public InArgument<string> fieldname { get; set; } [Output("Result")] [ReferenceTarget("ibs6052c_consprojectparticipant")] public OutArgument<EntityReference> result { get; set; } protected override void Execute(CodeActivityContext context) { Crud crm = new Crud(context); var res = crm.FetchXML(this.fetchxmlquery.Get(context)); crm.ts.Trace("Query result count: " + res.TotalRecordCount); crm.ts.Trace("Query result entity name: " + res.EntityName); if (res.Entities.Count > 0) { //Implement your function here... Guid consProjPartID = Guid.Empty; Entity consProjPart = (Entity)res.Entities.FirstOrDefault(); consProjPartID = consProjPart.Id; this.result.Set(context, consProjPartID); //Implement your function here... } else this.result.Set(context, null); } } }
can you all give me feedback and suggestion about my code?
Thanks & Regards.
Rico