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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

not able to get the values from financial dimension

(0) ShareShare
ReportReport
Posted on by 1,836
hi ,
everyone ,
i have created a lookup on finnancial dimension /buisness Unit /   , i am getting values for region ,city and location but this lookup is empty , can anyone help me on this , below is my code 
 
 
thanks,
Regards,
Dinesh
  • Dineshkarlekar Profile Picture
    1,836 on at
      /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        [FormControlEventHandler(formControlStr(DTWorkerDimensionForm, DTWorkerDimTbl_DTBuisnessUnit), FormControlEventType::Lookup)]
        public static void DTWorkerDimTbl_DTBuisnessUnit_OnLookup(FormControl sender, FormControlEventArgs e)
        {
            SysTableLookup sysTableLookup;
            Query query;
            QueryBuildDataSource qbdsDimensionFinancialTag;
            QueryBuildRange qbrFinancialTagCategory;
            String20 LC;
            RecId _recid;
            DimensionAttribute _attribute;
            Name _name= "BusinessUnit";
    
            query = new Query();
            qbdsDimensionFinancialTag = query.addDataSource(tableNum(DimensionFinancialTag));
            qbrFinancialTagCategory = qbdsDimensionFinancialTag.addRange(fieldNum(DimensionFinancialTag, FinancialTagCategory));
            qbrFinancialTagCategory.value(strFmt("%1", DimensionAttribute::findByName(_name, false).financialTagCategory()));
    
            sysTableLookup = sysTableLookup::newParameters(tableNum(DimensionFinancialTag), sender,true);
            sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Value), true);
            sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Description));
            sysTableLookup.addSelectionField(fieldNum(DimensionFinancialTag, FinancialTagCategory));
            sysTableLookup.parmQuery(query);
    
            sysTableLookup.performFormLookup();
    
            FormControlCancelableSuperEventArgs ce = e as FormControlCancelableSuperEventArgs;
            //cancel super() to prevent error.
            ce.CancelSuperCall();
        }
     
  • Verified answer
    Martin Dráb Profile Picture
    240,744 Most Valuable Professional on at
    First of all, let me simplify your code (e.g. throw away unused variables), so it's easier to read:
    [FormControlEventHandler(formControlStr(DTWorkerDimensionForm, DTWorkerDimTbl_DTBuisnessUnit), FormControlEventType::Lookup)]
    public static void DTWorkerDimTbl_DTBuisnessUnit_OnLookup(FormControl sender, FormControlEventArgs e)
    {
        Name name = "BusinessUnit";
    
        Query query = new Query();
        QueryBuildDataSource qbdsDimensionFinancialTag = query.addDataSource(tableNum(DimensionFinancialTag));
        QueryBuildRange qbrFinancialTagCategory = qbdsDimensionFinancialTag.addRange(fieldNum(DimensionFinancialTag, FinancialTagCategory));
        qbrFinancialTagCategory.value(queryValue(DimensionAttribute::findByName(name).financialTagCategory()));
    
        SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(DimensionFinancialTag), sender);
        sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Value), true);
        sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Description));
        sysTableLookup.addSelectionField(fieldNum(DimensionFinancialTag, FinancialTagCategory));
        sysTableLookup.parmQuery(query);
    
        sysTableLookup.performFormLookup();
    
        FormControlCancelableSuperEventArgs ce = e as FormControlCancelableSuperEventArgs;
        ce.cancelSuperCall();
    }
    
    Normally, business units are taken from OMOperatingUnit table; they aren't defined manually DimensionFinancialTag table. Isn't this the key problem?
    I wonder why you need to write the lookup on your own instead of using standard logic for dimensions, but you surely can do it. Utilizing DimAttributeOMBusinessUnit view may be the best approach.
  • Dineshkarlekar Profile Picture
    1,836 on at
    hi,
    Martin ,
    Thanks for Reply,
    i got desired out put , can you tell me how can i get the same for "worker" and "Department" , is there any entity for this .
     /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        [FormControlEventHandler(formControlStr(DTWorkerDimensionForm, DTWorkerDimTbl_DTBuisnessUnit), FormControlEventType::Lookup)]
        public static void DTWorkerDimTbl_DTBuisnessUnit_OnLookup(FormControl sender, FormControlEventArgs e)
        {
            Query query = new Query();
            QueryBuildDataSource queryBuildDataSource;
            QueryBuildRange queryBuildRange;
     
            SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(DimAttributeOMBusinessUnit),sender,true);
    
            sysTableLookup.addLookupField(fieldNum(DimAttributeOMBusinessUnit,Value));
            sysTableLookup.addLookupField(fieldNum(DimAttributeOMBusinessUnit,Name));
     
            queryBuildDataSource = query.addDataSource(tableNum(DimAttributeOMBusinessUnit));
     
            //queryBuildRange = queryBuildDataSource.addRange(fieldNum(DefaultDimensionView,Name));
            //queryBuildRange.value('BusinessUnit');
     
            sysTableLookup.parmQuery(query);
            sysTableLookup.performFormLookup();
    
            FormControlCancelableSuperEventArgs ce = e as FormControlCancelableSuperEventArgs;
            //cancel super() to prevent error.
            ce.CancelSuperCall();
        }
    thanks ,
    Regards ,
    Dinesh
  • Verified answer
    Martin Dráb Profile Picture
    240,744 Most Valuable Professional on at
    It's great that your problem is resolved. Please don't forget to verify the answer.
     
    You can use the same approach for the other dimensions as well. You can utilize filters in Application Explorer to find what you need. For example, this gives all views prefixed with DimAttribute: type:view ^DimAttribute. And this gives you only the two you asked about: type:view ^DimAttribute.*(Department|Worker).

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
Martin Dráb Profile Picture

Martin Dráb 426 Most Valuable Professional

#2
CU10121822-0 Profile Picture

CU10121822-0 358

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 353 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans