Hello all,
In my customized transaction form, I want to disable delete button in the attachment(Document Handling) based on enum status in the transaction header of the form. How to achieve this?
*This post is locked for comments
Hi,
please have a look inside DocuView form, doReSearch method, around line number 160 and below. Hopefully you will see that there is already some code there that sets variable called 'allowEditBasedOnActualForm'.
In my installation there is even some code for Norway, which checks the calling table and sets the variable based on some fields - looks like exactly what you need ?
if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoNO]) &&
(testCursor.TableId == tablenum(CustInvoiceJour) || testCursor.TableId == tablenum(ProjInvoiceJour)))
{
switch (testCursor.TableId)
{
case tablenum(CustInvoiceJour):
custTable = CustTable::find(CustInvoiceJour::findRecId(testCursor.RecId).InvoiceAccount, false);
break;
case tablenum(ProjInvoiceJour):
custTable = CustTable::find(ProjInvoiceJour::findRecId(testCursor.RecId).InvoiceAccount, false);
break;
}
if (custTable.EInvoice)
{
allowEditBasedOnActualForm = true;
}
}
Thanks,
Maciej
Hi Anand,
In the document handling form set the Delete button Auto Declaration property to Yes and through code access the button Enabled property.
for accessing Enum values you have to declare a variable for the enum first, after in if condition you can check.
Regards,
John
Hello John,
I cant get you ..! Can you please explain it in brief? I want to disable delete button in the attachment based on the status field.
Hi Anand,
If your form template is None, then why cant you try the autodeclaration property Yes and access the button Enabled property.
Regards,
Johnkrish
André Arnaud de Cal...
292,074
Super User 2025 Season 1
Martin Dráb
230,900
Most Valuable Professional
nmaenpaa
101,156