Processes in Microsoft 365 for setting up Office apps, redeeming product keys, and activating licenses.
Hi, thank you for reaching out. My name is Deeksha and I'm a Microsoft user like yourself and I will try to help you as best as I can today.
Contract Class: [DataContractAttribute] class BConfrimContract { private TSalesOrder salesOrder;
[DataMember, SysOperationLabel(literalStr("Sales Order")), SysOperationDisplayOrder("1")] public TSalesOrder parmSalesOrder(TSalesOrder _salesOrder = salesOrder) { salesOrder = _salesOrder; return salesOrder; } }
Service class: class BconfrimService extends SysOperationServiceBase { [SysEntryPointAttribute] public void process(BConfrimContract _contract) { TSalesOrder salesOrder = _contract.parmSalesOrder();
if (salesOrder && salesOrder.TStatus == TStatus::Draft) { ttsbegin;
salesOrder.selectForUpdate(true); salesOrder.TStatus = TStatus::Confirmed; salesOrder.update();
ttscommit; } else { warning("Selected record is not in Draft status and cannot be confirmed."); } } }
Controller Class: class BConfirmController extends SysOperationServiceController { protected void new() { super(classStr(BconfrimService), methodStr(BconfrimService, process), SysOperationExecutionMode::Synchronous); }
public void init() { BConfrimContract contract = this.parmDataContract() as BConfrimContract;
// Enable the button only if the selected record is in Draft status if (contract && contract.parmSalesOrder() && contract.parmSalesOrder(). TStatus == TStatus::Draft) { super(); } else { this.enabled(false); } }
public ClassDescription defaultCaption() { return "Process Job"; }
public static BConfirmController construct(SysOperationExecutionMode _executionMode = SysOperationExecutionMode::Synchronous) { BConfirmController controller; controller = new BConfirmController(); controller.parmExecutionMode(_executionMode); return controller; }
public static void main(Args _args) { BConfirmController controller = new BConfirmController(); controller.parmArgs(_args); controller.parmShowDialog(true); controller.startOperation(); } }
Contract Class: Added parmSalesOrder method to get/set the selected TSalesOrder.
Service Class: Modified the process method to update only the selected TSalesOrder record to "Confirmed" status if its status is "Draft".
Controller Class: Added the init method to enable the button only if the selected record is in "Draft" status.
Try these steps and hopefully, it resolves your issue. In case you need further help or assistance, please let us know. You can also contact Microsoft Support if the problem persists.
Best regards Deeksha