Usage of args object in forms in Dynamics 365 for Finance and Operations


internal final class POLUpdateAsDelivered
{
    public static void main(Args _args)
    {
        if (_args.record() && _args.record().TableId == tableNum(POLMobileServiceTable))
        {
            POLMobileServiceTable polServiceTable       = _args.record(); //Current selected record from the grid.
            POLMobileServiceTable polServiceTableUpd    = POLMobileServiceTable::find(polServiceTable.ServiceID, true);

            //assign the values to buffer for updation
            //update the record
            ttsbegin;
            polServiceTableUpd.ServiceStatus = POLServiceStatus::Delivered;
            polServiceTableUpd.update();
            ttscommit;
        
            FormDataSource fds = _args.record().dataSource();

            fds.research(true);

            info ("Record updated.");
        }


    }

}