using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
namespace sample.sampl1
{
public class test : IPlugin
{
public object Service;
public Guid userId { get; private set; }
public void Execute(IServiceProvider serviceProvider)
{
IPluginExecutionContext context = (IPluginExecutionContext)
serviceProvider.GetService(typeof(IPluginExecutionContext));
Entity entity = (Entity)context.InputParameters["Target"];
//Entity Name
Entity userSetting = new Entity("usersettings");
//Guid Of the user record
userSetting.Id = userId;
//Attribute to set value of “Allow other Microsoft Dynamics 365 user to send email on your behalf”
userSetting["issendasallowed"] = true;
//Update the Record
Service.Update(userSetting);
}
}
}
getting error in this code
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,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156