Exemple #1
0
        public void Execute(IServiceProvider serviceProvider)
        {
            var context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
            IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
            IOrganizationService        service        = serviceFactory.CreateOrganizationService(context.UserId);
            ITracingService             tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));


            Entity returnEntity = new Entity(context.PrimaryEntityName, context.PrimaryEntityId);

            BusinessFunctions Actions = new BusinessFunctions();
            var returnEntities        = Actions.getFriendsAndQuotes(new QueryExpression());

            returnEntity = returnEntities.Entities.Where(o => o.Id == context.PrimaryEntityId).FirstOrDefault();

            // Set output parameter
            context.OutputParameters["BusinessEntity"] = returnEntity;
        }
        public void Execute(IServiceProvider serviceProvider)
        {
            var context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
            IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
            IOrganizationService        service        = serviceFactory.CreateOrganizationService(context.UserId);
            ITracingService             tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
            QueryExpression             InputQe;

            if (context.InputParameters.Contains("Query") && context.InputParameters["Query"] is QueryExpression)
            {
                InputQe = (QueryExpression)context.InputParameters["Query"];
            }
            else
            {
                return;
            }

            BusinessFunctions Actions = new BusinessFunctions();

            context.OutputParameters["BusinessEntityCollection"] = Actions.getFriendsAndQuotes(InputQe);
        }