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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Run custom X++ scripts with zero downtime problems

(0) ShareShare
ReportReport
Posted on by 21
Hi,
 
I made a script that I successfully upload. After running test, the script runs, but I get an error that is independent of the run.
Has anyone encountered this error before? Unfortunately, the result of the testing run is unsuccessful.
So I can't move on to the next step.
 
Log:
[2024.03.25 07:51:37] Test run started
[2024.03.25 07:52:00] Specified argument was out of the range of valid values.
Parameter name: scopeId
[2024.03.25 07:52:00]    at Microsoft.Dynamics365.ApplicationTracker.Xpp.XppDataTracker.FindScope(Guid scopeId) in D://dbs//sh//l23t//1023_210540_0//cmd//16//Source//Kernel//Frameworks//ApplicationTracker//ApplicationTracker.Xpp//XppDataTracker.cs:line 139
   at Microsoft.Dynamics365.ApplicationTracker.Xpp.XppDataTracker.GetAllTrackerKeysByScopeId(Guid scopeId) in D://dbs//sh//l23t//1023_210540_0//cmd//16//Source//Kernel//Frameworks//ApplicationTracker//ApplicationTracker.Xpp//XppDataTracker.cs:line 81
   at Dynamics.AX.Application.AppTrackerSQLContext.tablesAccessedInScope()
   at Dynamics.AX.Application.AppTrackerSQLContext.tablesAccessed()
   at Dynamics.AX.Application.AppConsistencyCustomScriptStateChange.process(Boolean _isTestRun)
[2024.03.25 07:52:06] SQL statement: UPDATE APPCONSISTENCYCUSTOMSCRIPT SET LOG='',RECVERSION=917760894,MODIFIEDDATETIME='2024-3-25',MODIFIEDBY='user' WHERE ((RECID=5637146076) AND (RECVERSION=1308586891))
[2024.03.25 07:52:06] SQL statement: UPDATE APPCONSISTENCYCUSTOMSCRIPT SET LOG='',RECVERSION=211062717,MODIFIEDDATETIME='2024-3-25',MODIFIEDBY='user' WHERE ((RECID=5637146076) AND (RECVERSION=917760894))
[2024.03.25 07:52:06] Infolog: 
Ismeretlen bizonylat (NY030263) vagy lottózói esemény (23526)!
Ismeretlen bizonylat (NY030262) vagy lottózói esemény (23364)!
Kész! Olvasott: 2, Módosított: 0
[2024.03.25 07:52:06] Completed
 
 
 
Thanks,
 
Regard,
László
I have the same question (0)
  • Mohamed Amine Mahmoudi Profile Picture
    26,390 Super User 2025 Season 2 on at
    Hi @László,
     
    Can you please share with us the code x++ ?
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • André Arnaud de Calavon Profile Picture
    301,035 Super User 2025 Season 2 on at
    Hi László,
     
    Not everything is possible using the Custom scripts. Please share the code, so we can check and possibly guide you. Did the class run on a development environment without issues?
  • Horvath Laszlo DAX Profile Picture
    21 on at
    Hi,
     
    The error occurs in UAT, PROD, ONEBOX development environment. All environments are on-premise.
    I have attached the source of the job.
     
    class DXX_PrizeNotClaimedGame_BUG2788_Job
    {
        public static void main(Args _args)
        {
            CommaTextStreamIo       commaTextIo;
            container               c;
            Voucher                 voucher;
            DimensionValue          dimLotteryEventValue;
            VendTrans               vendTrans;
            int                     cnt, modCnt;
            #File
            FileUploadTemporaryStorageResult fileUploadResult = File::GetFileFromUser() as FileUploadTemporaryStorageResult;
            if (!fileUploadResult)
            {
                return;
            }
            commaTextIo = CommaTextStreamIo::constructForRead(fileUploadResult.openResult());
            if (!commaTextIo || commaTextIo.status())
            {
                error("@SYS52680");
                return;
            }
            commaTextIo.inFieldDelimiter(';');
            commaTextIo.inRecordDelimiter(#delimiterCRLF);
            c = commaTextIo.read(); //head
           
            while (commaTextIo.status() == IO_Status::Ok)
            {
                c = commaTextIo.read();
                if (commaTextIo.status() != IO_Status::Ok)
                {
                    break;
                }
                [voucher, dimLotteryEventValue] = c;
                if (voucher && dimLotteryEventValue)
                {
                    cnt++;
                    select firstonly forupdate vendTrans
                        where vendTrans.Voucher == voucher;
                    if (vendTrans)
                    {
                        try
                        {
                            ttsbegin;
                            if (DimensionAttributeValue::find(DAX_DimensionHelper::getDefaultDimensionValue(vendTrans.DefaultDimension, DAX_DimensionLotteryEventRecId())).DisplayValue != dimLotteryEventValue)
                            {
                                vendTrans.DefaultDimension = DAX_DimensionHelper::setDefaultDimensionValue(vendTrans.DefaultDimension, DAX_DimensionLotteryEventRecId(), dimLotteryEventValue);
                                vendTrans.doUpdate();
                                modCnt++;
                            }
                            ttscommit;
                        }
                        catch
                        {
                            error("There is an error!");
                        }
                    }
                    else
                    {
                        warning(strFmt("Unknown voucher (%1) or event (%2)!", voucher, dimLotteryEventValue));
                    }
                }
            }
            Info(strFmt("Ready! Read by %1, Modified by %2", cnt, modCnt));
        }
    }
     
    Regards,
    László
     
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,390 Super User 2025 Season 2 on at
    Hi @Laszlo,
     
    I think your using this code to import an Excel file. I don't think it's the right solution because this fonctionnality is intended for correction of minior data and not to import files and then treat them.
     
     
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • André Arnaud de Calavon Profile Picture
    301,035 Super User 2025 Season 2 on at
    Hi László,
     
    Can you tell us if the file upload is working as part of the custom X++ scripts? Or is this already failing?
     
    Anyway, you seem to need to update the dimensions on vendor transactions which might have a related accounting entry in the application. This can cause future issues with vendor transaction settlements as additional voucher transactions can be created in case the invoice and payment transaction have different dimensions.
  • Horvath Laszlo DAX Profile Picture
    21 on at
    Hi,
     
    Unfortunately, the data had to be corrected due to an incorrect posting. The file is csv and not excel.
    By the way, the script also ran on the PROD system if I skipped the test step and changed the status of the custom script.

    But I can't do anything with this error:
    [2024.03.25 07:52:00] Specified argument was out of the range of valid values.
    Parameter name: scopeId
    [2024.03.25 07:52:00] at Microsoft.Dynamics365.ApplicationTracker.Xpp.XppDataTracker.FindScope(Guid scopeId) in D://dbs//sh//l23t//1023_210540_0//cmd//16//Source //Kernel//Frameworks//ApplicationTracker//ApplicationTracker.Xpp//XppDataTracker.cs:line 139
        at Microsoft.Dynamics365.ApplicationTracker.Xpp.XppDataTracker.GetAllTrackerKeysByScopeId(Guid scopeId) in D://dbs//sh//l23t//1023_210540_0//cmd//16//Source//Kernel//Frameworks//ApplicationTracker/ /ApplicationTracker.Xpp//XppDataTracker.cs:line 81
        at Dynamics.AX.Application.AppTrackerSQLContext.tablesAccessedInScope()
        at Dynamics.AX.Application.AppTrackerSQLContext.tablesAccessed()
        at Dynamics.AX.Application.AppConsistencyCustomScriptStateChange.process(Boolean _isTestRun)
     
    Regards:
    László

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 565 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans