Button Enable/Disable in D365
There are 4 button added in sales table form
This will enable / disable according status.
Solution : sales table form-> event-> initialized (post event)->copy event handler
Create class
class Aks_ManuItemHide
{
// button
enable and disable in sales table form
///
<summary>
///
///
</summary>
/// <param
name="sender"></param>
/// <param
name="e"></param>
[FormEventHandler(formStr(SalesTable), FormEventType::Initialized)]
public static void SalesTable_OnInitialized(xFormRun sender, FormEventArgs e)
{
Common common1 = sender.args().record();
SalesTable SalesTable;
CustConfirmJour CustConfirmJour;
WMSPickingRoute WMSPickingRoute;
CustPackingSlipJour CustPackingSlipJour;
CustInvoiceJour CustInvoiceJour;
SalesTable = common1;
FormControl
God_buttonJournalConfirmation
= sender.design(0).controlName("God_buttonJournalConfirmation");
FormControl
God_buttonJournalPickingList
= sender.design(0).controlName("God_buttonJournalPickingList");
FormControl
God_buttonJournalPackingSlip
= sender.design(0).controlName("God_buttonJournalPackingSlip");
FormControl God_buttonJournalInvoice = sender.design(0).controlName("God_buttonJournalInvoice");
select CustConfirmJour
where CustConfirmJour.SalesId == SalesTable.SalesId;
if(CustConfirmJour)
{
God_buttonJournalConfirmation.enabled(true);
}
else
{
God_buttonJournalConfirmation.enabled(false);
}
select WMSPickingRoute
where WMSPickingRoute.transRefId == SalesTable.SalesId;
if(WMSPickingRoute)
{
God_buttonJournalPickingList.enabled(true);
}
else
{
God_buttonJournalPickingList.enabled(false);
}
select CustPackingSlipJour
where CustPackingSlipJour.SalesId
== SalesTable.SalesId;
if(CustPackingSlipJour)
{
God_buttonJournalPackingSlip.enabled(true);
}
else
{
God_buttonJournalPackingSlip.enabled(false);
}
select CustInvoiceJour
where CustInvoiceJour.SalesId == SalesTable.SalesId;
if(CustInvoiceJour)
{
God_buttonJournalInvoice.enabled(true);
}
else
{
God_buttonJournalInvoice.enabled(false);
}
}
}
Thanks
Akshay
No comments:
Post a Comment