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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

how validate default dimension value using x++

(0) ShareShare
ReportReport
Posted on by 2
supoose i have a defualt dimension=/SectionD/ and its display value is /Outdoor/ , how to validate is this value exists in system for section d or not ?
I have the same question (0)
  • Martin Dráb Profile Picture
    238,593 Most Valuable Professional on at
    What do you mean by whether the value exists?
     
    Whether it exists in the backing table, i.e. it can potentially be used as a dimension value? Or whether it exists in DimensionAttributeValue table, i.e. it is or it was used as a dimension value? Or something else?
  • Sachin Mittal Profile Picture
    2 on at
    yes first i have to validate if its display values exists in the system or not , and if its value is usable or not ,
  • Martin Dráb Profile Picture
    238,593 Most Valuable Professional on at
    You just the same thing, i.e. that the value should exist, but you didn't explain what you mean by that. Please answer the question in my previous reply.

    And how do you define "usable"?
  • Sachin Mittal Profile Picture
    2 on at
    ok i mean, suppose Department
     public boolean validateFinDim(str _String)
        {
            DimensionAttributeValue             dimensionAttributeValue;
            DimensionAttribute                  dimensionAttribute;
            boolean                             ret = true;
            container                           dimCon = str2con('102-345', "-");
    
            // Departments
            if(conPeek(dimCon, 1) != "")
            {
                dimensionAttribute      = DimensionAttribute::findByName('Department');
                dimensionAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValueNoError(dimensionAttribute, conPeek(dimCon, 1), false, true);
     
                if (!dimensionAttributeValue.RecId)
                {
                   ret =  checkFailed("Financial dimension Department value is not correct.");
                }
    return ret;
            }
    }
    have these display values in system 1,2,3,4,5 , if someone use other than these system should throw error , i have created this method , is this approach fine ?
  • Sachin Mittal Profile Picture
    2 on at
    if i pass values apart from these values for department , it should throw error , department values dont exists 
     
  • Martin Dráb Profile Picture
    238,593 Most Valuable Professional on at
    All right, so you mean "yes" to the question in the very first reply where I asked whether you mean "whether it exists in the backing table, i.e. it can potentially be used as a dimension value". But... what if the department exists but the value is suspended or not valid in for the given date and company? It's not clear whether you didn't mention these things because you're aren't interested in them or because you failed to specify your actual requirements.

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…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 679 Super User 2026 Season 1

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 332 Super User 2026 Season 1

#3
Martin Dráb Profile Picture

Martin Dráb 238 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans