locked
Error registering workflow assembly in CRM 4.0 RRS feed

  • Question

  • I'm creating a workflow assembly for CRM 4.0
    I am however unable to register it. I am curious to know if the code I have written is correct.

    I have an entity "new_candidate". the ID of that entity is "new_candidateid"

    I get this error message:


      <description>The type Lookup of the property CandidateID is not supported. </description>
     

    but from reading the docs, I need to provide an input property to perform some work on that input property correct?

    But what can be causing this?



    [CrmWorkflowActivity("Test Workflow", "Test Workflow")]
        public class Class1 : Activity
        {
            public Class1()
            {
            }

            public static DependencyProperty m_candidateID = DependencyProperty.Register("CandidateID", typeof(Lookup), typeof(Class1));

            [CrmReferenceTarget("new_candidate")]
            [CrmInput("new_candidateid")]
            public Lookup CandidateID
            {
                get
                {
                    return (Lookup)base.GetValue(m_candidateID);
                }
                set
                {
                    base.SetValue(m_candidateID, value);
                }
            }


    // have overriden the Execute method! nothing is happening there, just pretty much empty.



    ive also replaced lookup to uniqueidentifier and uniqueidentifierproperty but still no go. same error message

    Need 2 be back @ MS - MS All the way! Follower since 1995 MS Super Evangelist| MSDN Forums Moderator
    Tuesday, February 17, 2009 6:28 PM

Answers

  • Believe me I have tried this, also used the Key and KeyProperty but no avail. Eventually I realised, I do not need an input at all, and can continue developing as the entity to be worked on is passed to the workflow assembly on the Execute method which is given from the base class (Activity)

    Still interesting why it wouldn't work though, should I require an input
    Need 2 be back @ MS - MS All the way! Follower since 1995 MS Super Evangelist| MSDN Forums Moderator
    Wednesday, February 18, 2009 7:48 PM

All replies

  • Hello,

    Would you be able to post you're entire code?  Thanks!
    Danny Varghese - Crowe Horwath LLP - http://www.crowehorwath.com/cs/blogs/crm
    Tuesday, February 17, 2009 7:34 PM
  • One thought - is the Lookup class you're using defined in the Microsoft.Crm.Sdk namespace, or are you using web references ? You need to use the Microsoft.Crm.Sdk assembly
    Microsoft CRM MVP - http://mscrmuk.blogspot.com/
    Tuesday, February 17, 2009 8:40 PM
    Moderator
  • Thanks David

    still the same, I explicitly put in the namespace path to the UniqueIdentifier (and also Lookup) but still no go. The code I posted is really the full code but here you go:

    using System;

    using System.Collections.Generic;

    using System.Text;

    using System.Web;

    using System.Net;

    using Microsoft.Crm;

    using Microsoft.Crm.SdkTypeProxy;

    using Microsoft.Crm.Sdk;

    using Microsoft.Crm.Workflow;

    using System.Workflow.ComponentModel.Compiler;

    using System.Workflow.ComponentModel.Serialization;

    using System.Workflow.ComponentModel;

    using System.Workflow.ComponentModel.Design;

    using System.Workflow.Runtime;

    using System.Workflow.Activities;

    using System.Workflow.Activities.Rules;

    using System.Reflection;

    namespace TestPluginWorkflow

    {

    using CrmDiscoveryService;

    using CrmSdk;

    using MetadataService;

    [CrmWorkflowActivity("Test Workflow", "Test Workflow")]

    public class Class1 : Activity

    {

    public Class1()

    {

    string test = String.Empty;

    }

    public static DependencyProperty m_candidateID = DependencyProperty.Register("CandidateID", typeof(Microsoft.Crm.Sdk.UniqueIdentifier), typeof(Class1));

    [CrmReferenceTarget("new_candidate")]

    [CrmInput("new_candidateid")]

    public Microsoft.Crm.Sdk.UniqueIdentifier CandidateID

    {

    get

    {

    return (Microsoft.Crm.Sdk.UniqueIdentifier)base.GetValue(m_candidateID);

    }

    set

    {

    base.SetValue(m_candidateID, value);

    }

    }

    protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)

    {

    IContextService contextService = (IContextService)executionContext.GetService(typeof(IContextService));

    IWorkflowContext context = contextService.Context;

    CrmService service = (CrmService)context.CreateCrmService(true);

    return base.Execute(executionContext);

    }

    }

    }


    Need 2 be back @ MS - MS All the way! Follower since 1995 MS Super Evangelist| MSDN Forums Moderator
    Tuesday, February 17, 2009 11:21 PM
  • Hi ahmedilyas,
    I can not tell what is wrong from your code, but I do notice there might be one thing missing in your code.  There is no [CrmOutput]
    Don't know if this will be any help to you.

    public static DependencyProperty m_candidateID = DependencyProperty.Register("CandidateID", typeof(Microsoft.Crm.Sdk.UniqueIdentifier), typeof(Class1));

    [CrmReferenceTarget("new_candidate")]

    [CrmInput("new_candidateid")]

    [CrmOutput("my lookup output"0]

    public
    Microsoft.Crm.Sdk.UniqueIdentifier CandidateID

    {
    get
    {

    Wednesday, February 18, 2009 1:18 AM
  • Thanks but i dont think that is the problem as:

    1) the example code in the SDK doesnt require one/or is shown without one
    2) I dont need an output
    3) the error message is not pointing to this at all


    good point though!
    Need 2 be back @ MS - MS All the way! Follower since 1995 MS Super Evangelist| MSDN Forums Moderator
    Wednesday, February 18, 2009 1:24 AM
  • Hello!

    Not sure if what I'm about to write makes sense, but I read it somewhere and made it my own policy when developing Custom Workflows.
    I have two ideas for you:

    1st

    The SDK states that there are only a few types allowed as Inputs. You can read it in the page below of the CHM file of SDK.
    crmsdk4.chm::/htm/v4d0_sp4438r_samplecustomworkflowactivityuseofcrmtypes.htm

    2nd

    When you declare a DependencyProperty you should declare it the following way:


    public static DependencyProperty variableProperty = DependencyProperty.Register("variable", typeof(Microsoft.Crm.Sdk.UniqueIdentifier), typeof(Class1));

    [CrmInput("The Variable")]

    public string variable

    {

    get { return (string)base.SetValue(variableProperty); }

    set { base.SetValue(variableProperty, value); }

    }

    So the main difference is that the Property word is added to your variable name.
    Still, don't know if this 2nd one is valid or not...

    Best luck,






    Francisco Ceia
    Wednesday, February 18, 2009 6:51 PM
  • You should not use UniqueIdentifier. It is not a supported Workflow Activity attribute. Use Lookup instead. And Francisco is correct on the naming convention.
    Ronald
    Wednesday, February 18, 2009 7:12 PM
  • Believe me I have tried this, also used the Key and KeyProperty but no avail. Eventually I realised, I do not need an input at all, and can continue developing as the entity to be worked on is passed to the workflow assembly on the Execute method which is given from the base class (Activity)

    Still interesting why it wouldn't work though, should I require an input
    Need 2 be back @ MS - MS All the way! Follower since 1995 MS Super Evangelist| MSDN Forums Moderator
    Wednesday, February 18, 2009 7:48 PM