static void AXReplaceAssignedworkflowuser(Args _args)
{
userid src,dest;
dialogfield srcdf,destdf;
dialog dialog;
WorkflowStepTable WorkflowStepTable;
container con;
;
dialog = new dialog("Replace workflow assigned Approval user");
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 forupdate WorkflowStepTable
{
con = WorkflowStepTable.AssignTo;
if(conpeek(con,4) == src)
{
info(strfmt("Before update userid %1 ",conpeek(con,4)));
con = conpoke(con,4,dest);
WorkflowStepTable.AssignTo = con;
WorkflowStepTable.doUpdate();
info(strfmt("after update userid %1 ",conpeek(con,4)));
}
}
info("Workflow approval user has been replaced !.");
ttscommit;
}
}
else
{
info("Canceled by user");
}
}
{
userid src,dest;
dialogfield srcdf,destdf;
dialog dialog;
WorkflowStepTable WorkflowStepTable;
container con;
;
dialog = new dialog("Replace workflow assigned Approval user");
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 forupdate WorkflowStepTable
{
con = WorkflowStepTable.AssignTo;
if(conpeek(con,4) == src)
{
info(strfmt("Before update userid %1 ",conpeek(con,4)));
con = conpoke(con,4,dest);
WorkflowStepTable.AssignTo = con;
WorkflowStepTable.doUpdate();
info(strfmt("after update userid %1 ",conpeek(con,4)));
}
}
info("Workflow approval user has been replaced !.");
ttscommit;
}
}
else
{
info("Canceled by user");
}
}
No comments:
Post a Comment