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, ...
Suggested Answer

How to show the cost center id and name in ssrs report

(1) ShareShare
ReportReport
Posted on by 406
Hello,
 
i want to get the cost center id and name on my ssrs report ( purchase requisition)
anyone can provide with the code to make this happen?
thanks
  • Suggested answer
    Martin Dráb Profile Picture
    241,635 Most Valuable Professional on at
    You can utilize DefaultDimensionView (DefaultDimension will match PurchReqLine.DefaultDimension and you also need to filter by DimensionAttributeId).
  • D365FO DEV Profile Picture
    406 on at
    hi @martin drab.
     
    can you provide me the code?
  • Martin Dráb Profile Picture
    241,635 Most Valuable Professional on at
    Let me repeat my answer to the identical question in your other thread:
     
    I can't, because what code you should write (if any at at all) depends on how you've implemented (or are going to implement) your report or how it's implemented the report you're extending. You may be modifying an AOT query, use the query framework, write a select statement in X++, use electronic report and so on. There is no universal code.
     
    If you have no idea how to design the code, you'll need to tell us more about your report.
  • D365FO DEV Profile Picture
    406 on at
    hi martin,
     
    i still didnt write the code for this one as im facing challenges, so can you provide code that gets me cost center value and name?
    im using an extension on standard dp class in inserting event handler
  • Layan Jwei Profile Picture
    8,428 Super User 2026 Season 2 on at
  • D365FO DEV Profile Picture
    406 on at
    hi layan,
     
    they didnt help
  • Suggested answer
    Waed Ayyad Profile Picture
    9,228 Super User 2026 Season 2 on at
    Hi,
     
    Check the following code:
    DimensionAttributeValueSetStorage dimStorage;
    str _dimName;// Dimension name
    
    dimStorage = DimensionAttributeValueSetStorage::find(_rec); //default dimension RecId
    
    return dimStorage.getDisplayValueByDimensionAttribute(DimensionAttribute::findByName(_dimName).RecId);
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
     
  • D365FO DEV Profile Picture
    406 on at
    Hi Waed,
     
    Pls provide me the exact code based on my case if possible
  • Suggested answer
    Waed Ayyad Profile Picture
    9,228 Super User 2026 Season 2 on at
    Hi,
     
    Just set the str _dimName; to be str _dimName = ''CostCenter" and  _rec = Default dimension field from Purch requisition lines table.
     
    DimensionAttributeValueSetStorage dimStorage;
    str _dimName = "CostCenter";// Dimension name
    
    dimStorage = DimensionAttributeValueSetStorage::find(_rec); //default dimension RecId
    
    return dimStorage.getDisplayValueByDimensionAttribute(DimensionAttribute::findByName(_dimName).RecId);
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
     
  • D365FO DEV Profile Picture
    406 on at
    Hi wael,
     
     i have tried it but its not working. values are blank.

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

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

#1
André Arnaud de Calavon Profile Picture

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

#2
Aayush Tiwari Profile Picture

Aayush Tiwari 213

#3
Subra Profile Picture

Subra 202 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans