https://calebmsdax.wordpress.com/2013/02/22/passing-parameters-between-forms-in-ax/
Friday, 30 September 2016
Tuesday, 27 September 2016
Copy user groups from one user to another X++ in ax
//Copy user groups from one user to another X++
static void KR_AXEcopyUserGroup(Args _args)
{
usergrouplist usergrouplist,ins;
userid src,dest;
dialogfield srcdf,destdf;
dialog dialog;
;
dialog = new dialog("copying user's user groups");
srcdf = dialog.addField(typeid(userid),"Source");
destdf = dialog.addField(typeid(userid),"Destination");
if(dialog.run())
{
src = srcdf.value();
dest = destdf.value();
if(src!="" && dest !="")
{
ttsbegin;
while select * from usergrouplist
where usergrouplist.userId == dest
{
info(strfmt("Before update: '%1'-'%2'",usergrouplist.userid,usergrouplist.groupId));
}
info("Deleting user groups from destination user");
delete_from usergrouplist
where usergrouplist.userId == dest;
info("Copying user groups to destination user");
while select * from usergrouplist
where usergrouplist.userId == src
{
info(strfmt("source user: '%1'-'%2'",usergrouplist.userid,usergrouplist.groupId));
ins.clear();
ins.data(usergrouplist);
ins.UserId = dest;
ins.insert();
}
ttscommit;
info("User groups has been copied!");
}
}
else
{
info("Canceled by user");
}
}
Sunday, 11 September 2016
Subscribe to:
Posts (Atom)