Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

The custom script is not allowed to access the XYZ table

(1) ShareShare
ReportReport
Posted on by 572
Hi Experts,
 
I am getting below error while trying to run a custom script. can anyone help me to solve it please.
 
 
I am trying to update the BankTransAmountCur value for a record in the table bankAccountTrans using below class
 
class UAPBankTransUpdate
{
  
    public static void main(Args _args)
    {
        BankAccountTrans    bankAccountTrans;
        if(curExt() != 'UAP')
        {
            throw error("This script must run in UAP entity");
        }
        select forupdate bankAccountTrans
            where bankAccountTrans.RecId == 5637187458;
        if(bankAccountTrans)
        {
            ttsbegin;
            bankAccountTrans.BankTransAmountCur = 258000.33654;
            bankAccountTrans.doUpdate();
            Info("Record updated");
            ttscommit;
        }

    }
}
 
 
 
  • Suggested answer
    Lauras U Profile Picture
    Lauras U 955 on at
    The custom script is not allowed to access the XYZ table
    I had similar issue with updating NumberSequenceTable. Turns out that for some tables (tablegroup=Framework OR SystemTable=Yes) it needs special flighting enabled.
     
    Special flighting: AppConsistencyCustomScriptAllow%YOUR_TABLE_NAME%
     
  • Anton Venter Profile Picture
    Anton Venter 18,788 Super User 2024 Season 2 on at
    The custom script is not allowed to access the XYZ table
    Hello,
     
    You should be able to update the transaction(s) without any issues using the SysClassRunner class instead of the custom script method. But that will require your class to be deployed to production environment though and that means down time of the production environment.
  • D365  beginner Profile Picture
    D365 beginner 572 on at
    The custom script is not allowed to access the XYZ table
    Thank you all for the response.
     
    I am having system administrator role. What happened is we had made a changes in the decimal places for some quantity related extended datatype which resulted some vendor payments and related subledger transactions are not matching with some minor difference like 0.20, 0.30 etc. we have identified those transactions and we need to do this action to match them. We have successfully done the same in UAT environment using the JIT SQL access  and now we need to do the same in live environment to match or correct the transactions. For sure I cannot edit the value in bank account transaction table ? then is there any other way than reversing those transactions and redoing it again ?. Thanks. 
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,359 Super User 2024 Season 2 on at
    The custom script is not allowed to access the XYZ table
    Hi,
     
    Several transaction tables are restricted to be used to make changes via custom scripts. The method name raising the error already indicates this. It is checking for supported tables. So, you can't use this table in a custom script. 

    As asked by others, what is the business reason for updating an amount directly in a posted transaction?
  • Anton Venter Profile Picture
    Anton Venter 18,788 Super User 2024 Season 2 on at
    The custom script is not allowed to access the XYZ table
    Hello,
     
    Please explayin why are you updating this bank transaction? If you update the amount of this transaction, you will create a difference that cannot be accounted for.
  • Waed Ayyad Profile Picture
    Waed Ayyad 6,360 Super User 2024 Season 2 on at
    The custom script is not allowed to access the XYZ table
    Hi,
     
    What are the roles that are assigned to the user who was running the script? Is it admin?
     
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     

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

News and Announcements

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,359 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans