Unable to register the Custom workflow using plugin Registration tool, it's saying doesn't support int32 type

0

I have created a model property in my custom workflow code, generated assembly of the code. I have then tired registering of the assembly file using plug-in registration tool but at the end of completion getting an error message like below- The type Int32 of the property model is not supported. (Is plug-in registration tool supports 64-bit int type, if then how to change the int32 to int64 from the code I have pasted in bottom)

Unhandled Exception: System.Web.Services.Protocols.SoapException: Server was unable to process request. Detail: 0x8004501d The type Int32 of the property model is not supported. Platform at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at PluginRegistrationTool.CrmSdk.CrmService.Create(BusinessEntity entity) at PluginRegistrationTool.RegistrationHelper.RegisterPluginType(CrmOrganization org, CrmPlugin plugin) at PluginRegistrationTool.PluginRegistrationForm.btnRegister_Click(Object sender, EventArgs e)

Please refer my code below and correct me if I did something wrong.

[CrmWorkflowActivity("Create Cardetails Record", "Utilities")]
public partial class CreateCardetails : SequenceActivity
{
    public static DependencyProperty modelProperty = DependencyProperty.Register("model", typeof(int), typeof(CreateCardetails));

    [CrmInput("Model")]
    public int model
    {
        get
        {
            return (int)base.GetValue(modelProperty);
        }
        set
        {
            base.SetValue(modelProperty, value);
        }
    }

    public CreateCardetails()
    {
        InitializeComponent();
    }

    protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
    {
        // Get the context service.
        IContextService contextService = (IContextService)executionContext.GetService(typeof(IContextService));
        IWorkflowContext context = contextService.Context;

        // Use the context service to create an instance of CrmService.
        ICrmService crmService = context.CreateCrmService(true);

        DynamicEntity entity = null;
        Guid contactId;

        if (context.InputParameters.Properties.Contains("Target") && context.InputParameters.Properties["Target"] is DynamicEntity)
        {
            // Obtain the target business entity from the input parmameters.
            entity = (DynamicEntity)context.InputParameters.Properties["Target"];
            contactId = ((Key)entity.Properties["contactid"]).Value;

            Lookup lookup = new Lookup();
            lookup.Value = contactId;
            lookup.type = "contact";

            //Create an account which is linked to the contact record
            DynamicEntity cardetails = new DynamicEntity("cir_cardetails");

            cardetails["cir_carsdetailsid"] = lookup;

            //Setting the picklist value of Model
            Picklist modelPickList = new Picklist();
            modelPickList.Value = (int)model;
            cardetails.Properties.Add(new PicklistProperty("cir_model", modelPickList));
            Guid carkey = crmService.Create(cardetails);
        }
        return ActivityExecutionStatus.Closed;
    }
}

Kindly help, my all lucks are now gone. I have no idea how to fix it and even not sure about the issue.

plugins
workflow
dynamics-crm
dynamics-crm-4
asked on Stack Overflow Apr 3, 2013 by Indranil Sarkar • edited Apr 3, 2013 by Guido Preite

1 Answer

0

CRM 4 doesn't support int as an input property for a custom workflow activity (CRM 2011 does)

So instead of...

[CrmInput("Model")]
public int model

Try...

[CrmInput("Model")]
public CrmNumber model

Custom Workflow Activity: Use of CRM Types

answered on Stack Overflow Apr 3, 2013 by James Wood

User contributions licensed under CC BY-SA 3.0