Welcome to the second part of this series. In this blog will see how we can perform the auto click after auto populating values.
This is required because in standard logic system is working like on first click it will fetch item id , then on second click user will enter the quantity and so on. So if we are auto populating all the values in first click then we need to skip other clicks and process for the next form directly. Refer the issue on this link.
As we have learn in the first blog, you need to identify the child class according to your requirement and execution mode define in your menu item setup.
Below class is the extension of WHSWorkExecuteDisplayPOReceiving and created COC for displayForm() method.
Inside displayForm() method we need to identify the logic to trigger the auto button click.
In below case I have written a logic like once all the values are not equals to blank then perform auto click and for safer side to avoid recursion I have added one flag in pass object.
[ExtensionOf(classStr(WHSWorkExecuteDisplayPOReceiving))]
final class WHSWorkExecuteDisplayPOReceiving_ModelTest_Extension
{
// COC of display form method in extension class.
public container displayForm(container _con, str _buttonClicked)
{
Container returnedCon;
#WHSWorkExecuteControlElements
#WHSRF
//Next statement
returnedCon = next displayForm(_con, _buttonClicked);
//Logic to skip the extra clicks goes here.
if(step == 1 && !pass.exists("AutoClickOk")&&
mode == WHSWorkExecuteMode::PurchaseOrderItemReceivingAndLocate)
{
pass.insert("AutoClickOk",'1');
// this line will perform auto click
returnedCon = this.displayForm(returnedCon, #RFOk);
}
return returnedCon;
}
}
}
}
That's It. Lets enjoy the success of auto click and stay tuned for the next blog.
No comments:
Post a Comment