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 :
Microsoft Dynamics AX (Archived)

Refresh query in a SysOperation Data contract class

(0) ShareShare
ReportReport
Posted on by 570

Hello,

I changed my query but my sysoperation class see the old version

How could I refresh the packed query ? 

the CIL was succesfully generated and service registered

The data contract class has the following methods:

public Query getQuery()
{
return new Query(SysOperationHelper::base64Decode(packedQuery));
}

[DataMemberAttribute,
AifQueryTypeAttribute('_packedQuery', querystr(MyNewQuery))
]
public str parmQuery(str _packedQuery = packedQuery)
{
packedQuery = _packedQuery;
return packedQuery;
}

public void setQuery(Query _query)
{
packedQuery = SysOperationHelper::base64Encode(_query.pack());
}

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,953 Most Valuable Professional on at

    Can you please elaborate what you mean by "my sysoperation class see the old version". I can think of several different problems.

  • PIX Profile Picture
    570 on at

    I receive a run time error on a field range which is no more included in the query

    I 've also duplicated and renamed the query but debugging I got the old one

  • Martin Dráb Profile Picture
    237,953 Most Valuable Professional on at

    What are you doing with the class? Where and when do you get the error?

    Please realize that we don't know anything about your problem except what you tell us.

  • PIX Profile Picture
    570 on at

    The data contract uses that query

    Once called by menu item i receive the following error:

    DictField object not initialized.

    The datacontract contains the methods explained in my first msg

    (C)\Classes\SysQueryForm\getRangeVisible - line 35

    (C)\Classes\SysQueryForm\buildRange - line 90

    (C)\Classes\SRSReportRunBuilder\getQueryRangesAndFilters - line 9

    (C)\Classes\SRSReportRunBuilder\populateQueryGroupControl - line 3

    (C)\Classes\SRSReportRunBuilder\buildFormQueryGroup - line 26

    (C)\Classes\SysDataContractQueryUIBuilder\buildFormQueryGroup - line 8

    (C)\Classes\SysDataContractQueryUIBuilder\buildQueryControl - line 13

    (C)\Classes\SysDataContractQueryUIBuilder\postRun - line 15

    (C)\Classes\DictClass\callObject

    (C)\Classes\SysOperationController\callBuilderMethod - line 45

    (C)\Classes\SysOperationController\dialogPostRun - line 29

    (C)\Classes\SysOperationController\dialogShow - line 7

    (C)\Classes\SysOperationController\dialogRun - line 40

    (C)\Classes\SysOperationController\prompt - line 9

    (C)\Classes\SysOperationController\startOperation - line 9

    (C)\Classes\SysOperationServiceController\startOperation - line 16

    (C)\Classes\ProdReceiptServiceController\main - line 7

    which is due to a field which has been removed in the version of the query

    Before modifying the query the class worked perfectly, now seems working with the old version of the query

    The controller class has a newfromArgs() method which do the following:

    // create a new instance of the controller

    ProdReceiptServiceController= new ProdReceiptServiceController();

    ProdReceiptServiceController.initializeFromArgs(_args);

    ProdReceiptServiceController.parmExecutionMode(SysOperationExecutionMode::Synchronous);

    ProdReceiptDataContract = ProdReceiptServiceController.getDataContractObject('_ProdReceiptDataContract');

    ....

    the getDataContractObject() method returns the error mentioned above

  • PIX Profile Picture
    570 on at

    I'm sorry I got the error in the startoperation() method

  • Verified answer
    Martin Dráb Profile Picture
    237,953 Most Valuable Professional on at

    The call stack shows that the problem occur when building a dialog. Therefore the problem is caused by SysLastValue - the dialog loads values that were used in the previous run.

    If it's just an one-off problem in development, simply delete usage data related to your class.

    You could also disable saving to SysLastValue, but that's not what you usually want.

    If you want to understand how exactly it works, simply look at the code. It's all just X++ that you can access as if it was your own code.

  • PIX Profile Picture
    570 on at

    I wrote this message because already tried to clear usage data but same result....

  • Martin Dráb Profile Picture
    237,953 Most Valuable Professional on at

    Please open SysOperationController.dialogRun() and check if the wrong query occurs after the call to loadFromSysLastValue(). If it does, it means that you failed to delete the usage data.

  • NabD59 Profile Picture
    20 on at

    Hi Pix,

    I'll try to see if there's a possibility that the version of the pack/unpack is on good version try to increment the number in question.

    If no changes, you'll have to look for a CIL issues (full CIL)...

  • udaY-ch Profile Picture
    5,133 on at

    Hi,

    Is this possible to refresh the query without deleting the usage data ? By packing the new query into syslastValue ?

    Uday

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans