I needed to disabled one of the plugin steps (PreValidateProjectTeamMemberCreate )
So was looking for the code to know what really does, so I could build my own excluding the part I don't need, but I couldn't find it in GitHub, so I guess the answer is that is not open source code.
But just looking for your confirmation, thanks.
Jorge I strongly advise against disabling any OOTB plug-ins. Nevertheless, here's the decompiled code.
// Decompiled with JetBrains decompiler // Type: Microsoft.Dynamics.ProjectService.Plugins.PreValidateProjectTeamMemberCreate // Assembly: Microsoft.Dynamics.ProjectService.Plugins, Version=3.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 using crm; using Microsoft.Dynamics.ProjectService.Common; using Microsoft.Dynamics.ProjectService.Common.Exceptions; using Microsoft.Dynamics.ProjectService.Common.Repository; using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Query; using System; namespace Microsoft.Dynamics.ProjectService.Plugins { public class PreValidateProjectTeamMemberCreate : PluginBase { public PreValidateProjectTeamMemberCreate(string unsecure, string secure) : base(typeof (PreValidateProjectTeamMemberCreate)) { } protected override void ExecuteCrmPlugin(LocalPluginContext localContext) { ProjectTeamMember projectTeamMember = localContext != null ? localContext.GetTargetEntityFromInputParameters() : throw ExceptionFactory.CreateArgumentNullExceptionWithParameterName(nameof (localContext)); projectTeamMember.msdyn_bookableresourceid = projectTeamMember.msdyn_bookableresourceid != null ? projectTeamMember.msdyn_bookableresourceid : new EntityReference("bookableresource", BookableResourceRepository.GetGenericResourceId(localContext.OrganizationService)); Guid id = projectTeamMember.msdyn_bookableresourceid.Id; if (projectTeamMember.msdyn_project == null) throw ExceptionFactory.CreateInvalidPluginExecutionException("MissingProjectReference", ExceptionCategory.Unexpected); if (projectTeamMember.IsGenericResource(localContext.OrganizationService)) return; Project project = RepositoryFactory.GetRepository(localContext.OrganizationService).Retrieve(projectTeamMember.msdyn_project.Id, new ColumnSet(new string[1] { "msdyn_istemplate" })); bool? msdynIstemplate = project.msdyn_istemplate; if (msdynIstemplate.HasValue) { msdynIstemplate = project.msdyn_istemplate; if (msdynIstemplate.Value) throw ExceptionFactory.CreateInvalidPluginExecutionException("InvalidProjectAsItIsTemplate"); } if (localContext.HasBeenInvokedFromMessage("msdyn_BookingResource")) return; TeamManager teamManager = new TeamManager(); if (teamManager.TeamContainsTeamMember(teamManager.RetrieveExistingTeamMembersOnProject(localContext.OrganizationService, projectTeamMember.msdyn_project.Id), id) != Guid.Empty) throw ExceptionFactory.CreateInvalidPluginExecutionException("DuplicateResourcesErrorMessage"); if (localContext.HasBeenInvokedFromMessage("msdyn_CopyProject")) return; BookableResourceState? stateCode = RepositoryFactory.GetRepository().Retrieve(id, new ColumnSet(new string[1] { "statecode" })).StateCode; BookableResourceState bookableResourceState = BookableResourceState.Inactive; if (stateCode.GetValueOrDefault() == bookableResourceState & stateCode.HasValue) throw ExceptionFactory.CreateInvalidPluginExecutionException("InactiveBookableResourceErrorOnProjectTeam"); } } }
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156