0

I have a requirement to change the default value of a checkbox in SysUserSetup form to true. The data source of this field is SysUserInfo > EventWorkflowTasksInEmail. I have tried to do this by writing the following code in post event handler of initValue method of the table:

[PostHandlerFor(tableStr(SysUserInfo), tableMethodStr(SysUserInfo, initValue))]
public static void SysUserInfo_Post_initValue(XppPrePostArgs args)
{
SysUserInfo sysUserInfo = args.getThis() as SysUserInfo;
sysUserInfo.EventWorkflowTasksInEmail = NoYes::Yes;
}

But the value of checkbox is still false. Can anyone suggest if I am missing something ?

Edit : I debugged my code and found that the customization is not being executed , any reason why ?

The method gets executed when I import users from AAD and the change is working fine but it does not work when I create a new user from D365 itself , is there a way to achieve the latter ?

Amit
  • 1
  • 1
  • 1
    Did you debug if your customization is executed? Please [edit] your question and add the answer there instead of answering with a comment. This will increase your chance of receiving an answer. – FH-Inway May 27 '21 at 14:30
  • Is this "not working" for existing users or new users you import into the system? The `initValue` may only be called upon the initial record creation. So if you have an existing user, the `SysUserInfo` record already exists, so that method would not get called. I would imagine when you import a new user, it might get called. The addition/removal of users is a bit of a unique process though, so init's may not get called. – Alex Kwitny May 27 '21 at 18:17
  • Its not working for new users I create from d365 as well , is there a way I can set the default to yes for when I create a new user from d365 ? – Amit May 28 '21 at 15:13

0 Answers0