Check if storage dimension is active for an item

D365 Tech Support Forums Finance and Operations X++ Development Check if storage dimension is active for an item

Tagged: ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #973
    FitVibes24
    Participant

      How can I check if a storage dimension is active for an item in X++? I want to run some conditional logic against this data and need to make sure my items have specific storage dim flags enabled.

      #1023
      BuddyImLost
      Participant

        Try something like this

        1. static void validateTracDim_SMC(Args _args)
        2. {
        3. ItemId varItemId = ‘TestItemNameBySohaib’;
        4. FieldId observedDimension = fieldNum(InventDim, InventBatchId);
        5. str label = fieldPName(InventDim, InventBatchId);
        6. NoYes isActive;
        7.
        8. ;
        9. isActive = ecoResTrackingDimensionGroupFldSetup::findByDimensionGroupFieldId(InventTable::find(varItemId).trackingDimensionGroup(), observedDimension).IsActive;
        10. if(isActive)
        11. info(strFmt(‘%1 is active for %2’,label,varItemId));
        12. else
        13. info(strFmt(‘%1 is not active for %2’,label,varItemId));
        14. }

        Solved: How to Validate active tracking dimension for item by X++ code (dynamics.com)

      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.
      D365 Tech Support