web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Am I able to update table BANKCHEQUETABLE using a custom script?

(0) ShareShare
ReportReport
Posted on by 626

I am attempting to update a check status to "Void" in the table BANKCHEQUETABLE using a custom script class job.  When I execute it in Sandbox, I receive the message, "The custom script is not allowed to access the BankChequeTable table."  Does anyone know if this table is accessible to update via a custom script? 

I have the same question (0)
  • SARFARAZ AHMED MUFTI Profile Picture
    32 on at

    Hi,

    Can you please share the code where you can update the table?

  • Oceanfish26 Profile Picture
    626 on at

    internal final class CheckStatusToVoidTest1
    {
        public static void main(args _args)

        {
            BankChequeTable BankChequeTable;
            int successCounter = 0;
            int failCounter = 0;

            ttsBegin;

            while select forupdate BankChequeTable
                where
                   (BankChequeTable.RecID == 5637144598)

            {
                if (BankChequeTable.validateWrite())
                {
                    BankChequeTable.ChequeStatus = 3;
                    BankChequeTable.update();
                    successCounter++;
                }
                else
                {
                    failCounter++;
                }
            }

            ttsCommit;

            info(strFmt("%1 records updated successfully.", successCounter));
            info(strFmt("%1 records failed to update.", failCounter));
        }

    }

  • SARFARAZ AHMED MUFTI Profile Picture
    32 on at

    Below is the standard code you need to try :

    if (_chequeStatus == ChequeStatus::Cancelled

               || _chequeStatus == ChequeStatus::Rejected

               || _chequeStatus == ChequeStatus::Void)

           {

               bankChequeTable.voidPositivePay();

           }

    The standard method in the table BankChequeTable:

    public static void setChequeStatus(

           CompanyBankAccountId        _accountID,

           BankChequeNum               _chequeNum,

           ChequeStatus                _chequeStatus,

           TransDate                   _transDate,

           Voucher                     _voucher,

           BankChequeRecipientType     _recipientType,

           CompanyId                   _recipientCompany,

           CustVendAC                  _recipientAccountNum,

           CurrencyCode                _currencyCode,

           AmountCur                   _amountCur,

           BankNegInstRecipientName    _recipientName,

           RemittanceAddress           _remittanceAddress = 0,

           RefTableId                  _sourceTableId = 0,

           RefRecId                    _sourceRecId = 0)

       {

           BankChequeTable  bankChequeTable;

           select firstonly forupdate bankChequeTable

               where bankChequeTable.AccountID == _accountID

                   && bankChequeTable.ChequeNum == _chequeNum;

           if (!bankChequeTable)

           {

               throw error(strfmt("@SYS76941", _accountID, _chequeNum));

           }

           bankChequeTable.ChequeStatus                = _chequeStatus;

           bankChequeTable.TransDate                   = _transDate;

           bankChequeTable.Voucher                     = _voucher;

           bankChequeTable.RecipientType               = _recipientType;

           bankChequeTable.RecipientCompany            = _recipientCompany;

           bankChequeTable.RecipientAccountNum         = _recipientAccountNum;

           bankChequeTable.RecipientTransVoucher       = _voucher;

           bankChequeTable.CurrencyCode                = _currencyCode;

           bankChequeTable.AmountCur                   = _amountCur;

           if (_recipientName)

           {

               bankChequeTable.BankNegInstRecipientName = _recipientName;

           }

           if (_remittanceAddress)

           {

               bankChequeTable.RemittanceAddress = _remittanceAddress;

           }

           if (_sourceTableId

               && _sourceRecId)

           {

               bankChequeTable.SourceTableId           = _sourceTableId;

               bankChequeTable.SourceRecId             = _sourceRecId;

           }

           bankChequeTable.BankCurrency = BankAccountTable::find(_accountID).CurrencyCode;

           if (_currencyCode == bankChequeTable.BankCurrency)

           {

               bankChequeTable.BankCurrencyAmount = _amountCur;

           }

           else

           {

               bankChequeTable.BankCurrencyAmount = CurrencyExchangeHelper::curAmount2CurAmount(_amountCur, _currencyCode, bankChequeTable.BankCurrency, bankChequeTable.TransDate);

           }

           if (_chequeStatus == ChequeStatus::Cancelled

               || _chequeStatus == ChequeStatus::Rejected

               || _chequeStatus == ChequeStatus::Void)

           {

               bankChequeTable.voidPositivePay();

           }

           bankChequeTable.update();

       }

  • Oceanfish26 Profile Picture
    626 on at

    Thanks for your assistance.

    I don't think this will work in a single-class custom script, though.  Am I wrong?  Can you demonstrate how this will fit into the custom script I provided earlier?

  • Suggested answer
    SARFARAZ AHMED MUFTI Profile Picture
    32 on at

    public static void main(args _args)

       {

           BankChequeTable BankChequeTable;

           int successCounter = 0;

           int failCounter = 0;

           ttsBegin;

           while select forupdate BankChequeTable

               where

                  (BankChequeTable.RecID == 5637144598)

           {

                   BankChequeTable.ChequeStatus = ChequeStatus::Void;

              if (BankChequeTable.ChequeStatus == ChequeStatus::Cancelled

              || BankChequeTable.ChequeStatus == ChequeStatus::Rejected

              || BankChequeTable.ChequeStatus == ChequeStatus::Void)

             {

              bankChequeTable.voidPositivePay();

             }

                   BankChequeTable.update();

                   successCounter++;

               }

           }

           ttsCommit;

           info(strFmt("%1 records updated successfully.", successCounter));

           info(strFmt("%1 records failed to update.", failCounter));

       }

  • Oceanfish26 Profile Picture
    626 on at

    Thanks again, I'll give it a try now.

  • Oceanfish26 Profile Picture
    626 on at

    Response from Microsoft, "Finance team confirmed that bankchequetable cannot be used with X++ custom scripts as there are some tables that naturally prevent execution."

    Looks like it just cannot be done.

    Thank you, for your time and help.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 470

#3
Adis Profile Picture

Adis 270 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans