To set the password when you start your AX.


The very first class called when you log in to the AX is Application(Class) and method startuppost().

Thus you can write the code here in startuppost method.


void startupPost()
{
dialog d;
dialogfield df, df1, df2;
userinfo user;
boolean ret;
;
d = new dialog(“Password”);
df = d.addField(typeid(userid),”UserName”);
df1 = d.addField(typeid(userid),”UserName”);
df2 = d.addField(typeid(string30),”Password”);
df.value(curuserid());
select user
where user.id == curuserid();
if(user)
{
df1.value(user.name);
}
df1.allowEdit(false);
df1.displayLength(25);
while(d.run())
{
if(!(df2.value() || df2.value() == ‘SetYourPasswordHere’)) // line 23
{
infolog.shutDown(true);
throw error(“wrong password”);
df2.doNull();
continue;
}
else
{
ret = true;
break;
}
}
if(ret == false)
{
infolog.shutDown(true);
}
}

In the above code df2 dialog is for password which you can set it at the line num 23 i.e, hardcode your password (or) you can customize the password field in sysuserform and assign to all user. and then you can validate the password whether the entered password and password which is set for the corresponding user in your customized sysuser form is same.

No comments

Powered by Blogger.