web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Microsoft Workflow Plugin Not Working.

(0) ShareShare
ReportReport
Posted on by 30

https://msdn.microsoft.com/en-us/library/gg509012.aspx

I am trying to follow the workflow example

 protected override void Execute(CodeActivityContext executionContext)
        {
            IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();

            //Create an Organization Service
            IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
            IOrganizationService service = serviceFactory.CreateOrganizationService(context.InitiatingUserId);

            //Retrieve the contact id
            Guid contactId = this.Contact.Get(executionContext).Id;

What is this.Contact.Get?


When I try to write this in C#, it gives an error. "Program" does not contain a definition for Contact accepting a first argument of Type Program

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    As far as I see Contact is Input - of custom workflow activity - docs.microsoft.com/.../add-metadata-custom-workflow-activity

    It seems that you created "Console App" project. You need "Class Library" instead. Check following url - docs.microsoft.com/.../create-custom-workflow-activity

  • Suggested answer
    Nflannery Profile Picture
    360 on at

    Contact.Get is your inargument.  Have you defined it?  I assume you have.

    You do it as thus.

    [Input("Contact")]

    [Default("Contact")]

    public InArgument<EntityReference> Contact { get; set; }

    Guid primaryContactId = Contact.Get<EntityReference>(executionContext).Id ;

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Neil,

    Your code is missing ReferenceTarget. It's not possible to register it in CRM without adding that metadata. Also Default for EntityReference input should contain valid Guid.

  • Techrium Profile Picture
    30 on at

    ok thanks...I have not defined it.

  • Techrium Profile Picture
    30 on at

    Ok I don't understand how to use Inargument.

    Can I just not use it?

    I have an entity called New_Contacts and has ContactID field.

    I just want to be able to retrieve it in code...

    How do I do that?

  • Techrium Profile Picture
    30 on at

    I have an Entity in CRM Dynamics called New_Entity....Within it contains a field New_ID and New_Description

    For example:

    1   Hello

    2   WhatsUp

    121 MicrosoftCRMSucks

    How do I use code to pull it up?

    I am trying to use the tutorial: msdn.microsoft.com/.../gg509012.aspx

    But I'm getting stuck.

      protected override void Execute(CodeActivityContext executionContext)
            {
                IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
                //Create an Organization Service
                IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
                IOrganizationService service = serviceFactory.CreateOrganizationService(context.InitiatingUserId);

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Please, no duplicates. Threads are merged.

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Please post what you've done so far and why you stuck, what doesn't work etc.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans