Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

No plugins have been selected from the list. Please select at least one and try again." while publishing the Custom Workflow Activity with Plugin Registration Tool

(0) ShareShare
ReportReport
Posted on by 1,434

namespace Workflow
{

using Microsoft.Crm.Sdk.Messages;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using Microsoft.Xrm.Sdk.Workflow;

using System;
using System.Activities;

public partial class CustomWorkflow: CodeActivity
{
/// <summary>
/// Define property for DayofWeeks
/// </summary>
[Output("DayofWeek")]
public OutArgument<String> DayofWeek { get; set; }

/// <summary>
/// Define override method for custom workflow Execute
/// </summary>
/// <param name="Execution"></param>
protected override void Execute(CodeActivityContext Execution)
{

string Day = string.Empty;
DateTime _Date = DateTime.MinValue;

//Get context
IWorkflowContext context = Execution.GetExtension<IWorkflowContext>();

//Create iorganization service object
IOrganizationServiceFactory serviceFactory = Execution.GetExtension<IOrganizationServiceFactory>();
IOrganizationService service = serviceFactory.CreateOrganizationService(context.InitiatingUserId);

//Get created date of the lead
Entity _lead = (Entity)service.Retrieve("lead", context.PrimaryEntityId, new ColumnSet(new string[] { "createdon" }));
if (_lead.Contains("createdon"))
{
//get day of the week based on created on date
Day = ((DateTime)_lead.Attributes["createdon"]).DayOfWeek.ToString();
}

//Set value to output variable
DayofWeek.Set(Execution, Day);

if (Day == "Sunday")
{
Guid _UserID = GetUserID(service);
AssignLead(service, context.PrimaryEntityId, _UserID);
}
}

/// <summary>
/// To get Userid
/// </summary>
/// <param name="service"></param>
/// <returns></returns>
private Guid GetUserID(IOrganizationService service)
{
Guid _UserID = Guid.Empty;

ConditionExpression condition1 = new ConditionExpression();
condition1.AttributeName = "firstname";
condition1.Operator = ConditionOperator.Equal;
condition1.Values.Add("Vishanshu");

ConditionExpression condition2 = new ConditionExpression();
condition2.AttributeName = "lastname";
condition2.Operator = ConditionOperator.Equal;
condition2.Values.Add("Jain");

FilterExpression filter1 = new FilterExpression();
filter1.Conditions.AddRange(condition1, condition2);
QueryExpression query = new QueryExpression("systemuser");
query.Criteria.AddFilter(filter1);

EntityCollection EntityCol = service.RetrieveMultiple(query);
if (EntityCol.Entities.Count > 0)
{
Entity _User = (Entity)EntityCol.Entities[0];
_UserID = _User.Id;
}
return _UserID;
}

/// <summary>
/// AssignLead to user
/// </summary>
/// <param name="service"></param>
/// <param name="LeadID"></param>
/// <param name="UserID"></param>
private void AssignLead(IOrganizationService service, Guid LeadID, Guid UserID)
{
AssignRequest _Assign = new AssignRequest()
{
Assignee = new EntityReference("systemuser", UserID),
Target = new EntityReference("lead", LeadID)
};
service.Execute(_Assign);
}
}
}

*This post is locked for comments

  • Suggested answer
    Bipin D365 Profile Picture
    28,981 Moderator on at
    RE: No plugins have been selected from the list. Please select at least one and try again." while publishing the Custom Workflow Activity with Plugin Registration Tool

    Hi,

    Make sure you have the latest version of plugin registration tool.

    And do follow below article to create your first plugin and compare with your class.

    docs.microsoft.com/.../tutorial-write-plug-in

  • skrn872@gmail.com Profile Picture
    on at
    RE: No plugins have been selected from the list. Please select at least one and try again." while publishing the Custom Workflow Activity with Plugin Registration Tool

    please let me know what should we do.. getting the same problem...pls reply

  • Community Member Profile Picture
    on at
    RE: No plugins have been selected from the list. Please select at least one and try again." while publishing the Custom Workflow Activity with Plugin Registration Tool

    @

    Guido Preite,

    As you have mention that the CRM SDK 2015 resolve the issue but I'm not able to resolve .

    I'm getting the same error.

  • Community Member Profile Picture
    on at
    RE: No plugins have been selected from the list. Please select at least one and try again." while publishing the Custom Workflow Activity with Plugin Registration Tool

    Registering using the 2015 SDK worked for me.  I was having the same problem trying to register with the 2013 version.

  • Community Member Profile Picture
    on at
    RE: No plugins have been selected from the list. Please select at least one and try again." while publishing the Custom Workflow Activity with Plugin Registration Tool

    Guido, you saved the day already twice for me, but I don't understand why I always have this problem. If I download the latest SDK nothing works. Then after some research I end up here and I download the 6.1v2 version from the folder you provide and - magic!

    This has been going on for a while, so I am wondering: do you have anyu idea/suggestion re what is it that makes the default PluginRegistration go awry for me (and apparently for some other people)? It would be good to know, because frankly I don't know how long this shortcut is going to work. At some point the 6.1 version is going to be not supported.

    Anyway, thank you for your help!

  • Suggested answer
    Harrison Shen Profile Picture
    15 on at
    RE: No plugins have been selected from the list. Please select at least one and try again." while publishing the Custom Workflow Activity with Plugin Registration Tool

    Thanks Guido, that works for me as well!

  • Community Member Profile Picture
    on at
    RE: No plugins have been selected from the list. Please select at least one and try again." while publishing the Custom Workflow Activity with Plugin Registration Tool

    Thank you Guido! This version works for me too!

  • Suggested answer
    mehul512 Profile Picture
    25 on at
    RE: No plugins have been selected from the list. Please select at least one and try again." while publishing the Custom Workflow Activity with Plugin Registration Tool

    Thanks Guido. It works for me :)

  • Abhishek.Srivastava Profile Picture
    1,434 on at
    RE: No plugins have been selected from the list. Please select at least one and try again." while publishing the Custom Workflow Activity with Plugin Registration Tool

    Thank you very much Guido. It work now ..!!!

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 54

#3
dkrishna Profile Picture

dkrishna 6

Featured topics

Product updates

Dynamics 365 release plans