Hello All,
we have requirement where we want to create new user(systemuser) over there on create(plugin) of it we set it's personal settings
using plugin.
is there any reference then please share.
Thanks & regards,
yash
Hello,
Did you do it sync or async? Try to use async.
Hy Andrew,
i have tried the same i have applied the code in my plugin on Create message(Post-Operation) of systemuser entity but iam getting error when creating user...
Exception Message: usersettings With Id = c8afd388-e471-eb11-a812-000d3a151567 Does Not Exist
ErrorCode: -2147220891
HexErrorCode: 0x80040265
ErrorDetails:
ApiExceptionSourceKey: Plugin/SetUserPersonalSettings.SetUserPersonalSettings, SetUserPersonalSettings, Version=1.0.0.0, Culture=neutral, PublicKeyToken=fa59fef0d5af8bba
ApiStepKey: 0e33c685-dd70-eb11-a812-000d3a151567
ApiDepthKey: 1
ApiActivityIdKey: c27ac0bc-12ef-4b4e-9658-78cc26cec13a
ApiPluginSolutionNameKey: Active
ApiStepSolutionNameKey: Active
ApiExceptionCategory: ClientError
ApiExceptionMesageName: IsvAborted
ApiExceptionHttpStatusCode: 400
HelpLink: go.microsoft.com/.../
TraceText:
[SetUserPersonalSettings: SetUserPersonalSettings.SetUserPersonalSettings]
[0e33c685-dd70-eb11-a812-000d3a151567: SetUserPersonalSettings.SetUserPersonalSettings: Create of systemuser]
flag 1Settings Updated on Create message c8afd388-e471-eb11-a812-000d3a151567
and here is my code::::
if (contextPlugin.MessageName == "Create")
{
Entity systemUser = (Entity)contextPlugin.InputParameters["Target"];
if (systemUser.Attributes.Contains("systemuserid"))
{
tracingService.Trace("flag 1Settings Updated on Create message " + systemUser.Id);
Entity updateUserSettings = service.Retrieve("usersettings", systemUser.Id, new ColumnSet(true));
// Entity updateUserSettings = new Entity("usersettings", systemUser.Id);
updateUserSettings["issendasallowed"] = false;
updateUserSettings["autocreatecontactonpromote"] = 0;
updateUserSettings["incomingemailfilteringmethod"] = new OptionSetValue(1);
service.Update(updateUserSettings);
tracingService.Trace("Settings Updated on Create message "+ systemUser.Id);
}
}
Hello Yash,
There are a few references available:
community.dynamics.com/.../setting-default-personal-settings
translate.google.com/translate
But general direction:
1. Create the plugin that handles "Create" message of "systemuser" entity.
2. Update "usersettings" entity with values you want to be set "by default".
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