Hi all
I've tried to change a Dialog Workflow with a plugin to a entity that on save runs the plugin to do the same thing. Problem is it produces the following error
Unexpected exception from plug-in (Constructor): Stan.ManholePrice: System.MissingMethodException: Constructor on type 'Stan.ManholePrice' not found.
I'm not sure if the plugin should now be a Iplugin insted of a codeactivity or am i just missing something in the code to enable it to run from an entity. Here is the start of the code and where i think the issue is. I have tried following some guides but they all seem to be based round the fact the plugin is an Iplugin
public class ManholePrice : CodeActivity
{
#region Secure/Unsecure Configuration Setup
private string _secureConfig = null;
private string _unsecureConfig = null;
public ManholePrice(string unsecureConfig, string secureConfig)
{
_secureConfig = secureConfig;
_unsecureConfig = unsecureConfig;
}
#endregion
protected override void Execute(CodeActivityContext executionContext)
{
//Create the tracing service
ITracingService tracingService = executionContext.GetExtension<ITracingService>();
//Create the context
IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
// Create a column set to define which attributes should be retrieved.
ColumnSet attributes = new ColumnSet(true);
Entity currentPriceLevelEntity = new Entity("pricelevel");
currentPriceLevelEntity = service.Retrieve("pricelevel", CurrentPriceList.Get<EntityReference>(executionContext).Id, attributes);
// Create New Price List
Entity newPriceLevel = new Entity("pricelevel");
newPriceLevel["name"] = NewPriceListName.Get<string>(executionContext);
newPriceLevel["transactioncurrencyid"] = currentPriceLevelEntity["transactioncurrencyid"];
Guid newPriceLevelId = service.Create(newPriceLevel);
newPriceLevel["Price900"] = ManholePrice900.Get<string>(executionContext);
newPriceLevel["Price1050"] = ManholePrice1050.Get<string>(executionContext);
newPriceLevel["Price1200"] = ManholePrice1200.Get<string>(executionContext);
Any advice would be greatly appreciated
Regards
Dan