Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Plugin class extension :does not implement interface member 'Microsoft.Xrm.Sdk.IPlugin.Execute(System.IServiceProvider)

Posted on by Microsoft Employee

Hi,

Kindly below code for auto number and it shows error on red mark text.

using System;
using System.ServiceModel;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;

namespace crmpackageplugin.accautonumber
{
public class autonumberplugin :IPlugin
{
public void execute(IServiceProvider serviceprovider)
{
IPluginExecutionContext context = (IPluginExecutionContext)serviceprovider.GetService(typeof(IPluginExecutionContext));
IOrganizationServiceFactory servicefactory = (IOrganizationServiceFactory)serviceprovider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = servicefactory.CreateOrganizationService(context.UserId);
if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
{
Entity entity = (Entity)context.InputParameters["Target"];
QueryExpression query = new QueryExpression("account");
query.ColumnSet = new ColumnSet(true);
EntityCollection result = service.RetrieveMultiple(query);
int totalrecords = result.Entities.Count;
var finalresult = totalrecords + 1;
int series = 1000;
entity.Attributes["new_autonumber"] = series + finalresult;
}
}
}
}

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Plugin class extension :does not implement interface member 'Microsoft.Xrm.Sdk.IPlugin.Execute(System.IServiceProvider)

    Thanks

  • Verified answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Plugin class extension :does not implement interface member 'Microsoft.Xrm.Sdk.IPlugin.Execute(System.IServiceProvider)

    Hello,

    Replace line

    public void execute(IServiceProvider serviceprovider)

    with line

    public void Execute(IServiceProvider serviceprovider)

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans