Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / The custom script is n...
Finance forum
Suggested answer

The custom script is not allowed to access the XYZ table

Posted on by 547
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,547 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 547 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... 290,558 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,547 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 5,503 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

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,558 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,645 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans