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)
Answered

Error "Function DimensionAttributeValueSetStorage.addItemValues has been incorrectly called"

(0) ShareShare
ReportReport
Posted on by 499

I have written a code in form control modified method to update the financial dimension for worker , the issue is for most of the Worker value selected in the lookup ( A newly added control to update worker) the financial dimension is getting updated , but for few of the values selected in the lookup , the update is getting failed saying above error. 

I am using DimensionAttributeValueSetStorage.addItem() method.

I have made info of the result ..

for successful update the info value is as below

0407.1.png

for Error Transactions the Info is as below 

3122.2.png

As per my observation the fourth value is getting created as 

0,0,{00000000-0000-0000-0000-000000000000}

and this value is getting passed as 0

Please help me to track the issue. 

if i close and open the screen and Cntrl + F5 , then the previoulsy selected value which was giving the error will be resolved .

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    301,053 Super User 2025 Season 2 on at

    Hi Raghu,

    Can you share the code you created? Then we might see what would be incorrect or needs to be changed. Now, we really don't know how your coding looks like.

  • In AX2012 in the InventOnHandItemListPage I need to be able to f Profile Picture
    499 on at

    Hi Andre

    Please find the below code

    In Form "LedgerJournalTransVendInvoice"

    I have added new control and added lookup method to fill workers , and in same control i have made changes in modified method.

    public boolean modified()

    {

       boolean ret;

       str worker,voucher;

       ret = super();

      element.sfi_updateworkerdimension(this.valueStr(),ledgerjournaltrans.DefaultDimension,ledgerjournaltrans.Voucher);

      LedgerCache::clearAllScopes();

      element.task(2876);

       return ret;

    }

    and code for sfi_updateworkerdimension() method is below

    public  void sfi_updateworkerdimension(str worker,int64 defaultdimension,str voucher)

    {

       str worker2;

        DimensionAttributeValueSetStorage dimensionAttributeValueSetStorage;

        DimensionAttribute dimensionAttribute;

        Ledgerjournaltrans ledgerjournaltrans1 = Ledgerjournaltrans::findLedgerJournalId(voucher);

        DimensionValue oldDimensionValue;

        DimensionValue newDimensionValue = worker;

        DimensionDefault newDimensionDefault;

            // Get current value

        oldDimensionValue = this.sfi_getDimensonValue(ledgerjournaltrans1.DefaultDimension);

       // Build DimensionAttributeValueSetStorage

        dimensionAttributeValueSetStorage = DimensionAttributeValueSetStorage::find(ledgerjournaltrans1.DefaultDimension);

        // Remove old dimension value

        dimensionAttribute = DimensionAttribute::findByName("Worker");

        dimensionAttributeValueSetStorage.removeDimensionAttributeValue(

            DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute, oldDimensionValue).RecId);

        // Set new dimension value

        if(newDimensionValue != "")

        {

            dimensionAttribute = DimensionAttribute::findByName("Worker");

     //here i have made info inside  dimensionAttributeValueSetStorage.addItem() method      

           dimensionAttributeValueSetStorage.addItem(

            DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute, newDimensionValue));

        }

        newDimensionDefault = dimensionAttributeValueSetStorage.save();

        ttsbegin;

        ledgerjournaltrans1.selectForUpdate(true);

        ledgerjournaltrans1.DefaultDimension = newDimensionDefault;

        ledgerjournaltrans1.update();

        ttscommit;

    }

  • André Arnaud de Calavon Profile Picture
    301,053 Super User 2025 Season 2 on at

    I do miss the part where you did generate the infolog with values. Can you use the debugger to find out if a record has an empty DefaultDimension field or if the record is not found at all?

  • Verified answer
    Mariano Gracia Profile Picture
    on at

    I have recently had the same problem, it was solved changing the call in the DimensionAttributeValue::findByDimensionAttributeAndValue, use DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute, newDimensionValue, false, true));

  • In AX2012 in the InventOnHandItemListPage I need to be able to f Profile Picture
    499 on at

    Hi Andre

    I have find out some tracing like , if we update the financial dimension from standard form -"DimensionDefaultingLookup", it is creating the record in the table -"DimensionAttributeValueSetItem", but if i want to update the worker dimension from my customized control in "LedgerJournalTransVendInvoice", then , i am failing to create the record in "DimensionAttributeValueSetItem" table . i am not finding how to create the the record in "DimensionAttributeValueSetItem" table .

  • Verified answer
    In AX2012 in the InventOnHandItemListPage I need to be able to f Profile Picture
    499 on at

    Hi Mariano

    Your Suggestion Worked for me thanks a lot.....

    DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute, newDimensionValue, false, true));

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