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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

How to extend PriceType base enum class

(0) ShareShare
ReportReport
Posted on by 1,461

I need to add a new enum to PriceType. PriceType has Extensibile = TRUE. I added it without a problem to the PriceType.MyExtension. But PriceType also has a class for each base enum.

The following link is from 2017: docs.microsoft.com/.../pricing-app73

I copied class PriceTypeTradeAgreementMappingSales and changed it to. the header of my class looks as follow where CalcPriceSales is my new PriceType.

***

[PriceTypeFactory(PriceType::CalcPriceSales)]
final class PriceTypeTradeAgreementMappingCalcPriceSales extends PriceTypeTradeAgreementMappingSales
{

---

}

***

However when I go to trade agreement journals and add a new one with relation = CalcPriceSales and click on Lines, I get the error "PriceTypeTradeAgreementMapping::NewPriceTy has been incorrectly called".

So it definitely doesn't pick up my new class that is for the new base enum. I would have thought that the attribute PricetypeFactory would have linked it together with the inheritance from PricetypeTradeAfreementMappingSales. But it doesn't.

SysExtensionAppClassFactory.searchAndCacheClassInstanceBySysExtAttribute() returns the class name for the standard base enum: PriceSales in 

var searchStrategy = _searchStrategy? _searchStrategy : SysExtAppClassSearchStratDepth::newForCacheKey(_baseClassName, [[_attrCacheKey]]);

        var cachedResult = searchStrategy.search();

The above code at one point runs method: getClassFromSysExtAttribute which goes into the Else-part of isCacheSet. It doesn't run the useLegacyFactoryBehavior, but the "using (var lock = new SysProcessLock())".  I just can't figure out how it chooses the class to return depending on the Pricetype.

Any help is much appreciated.

I have the same question (0)
  • Verified answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    Try to clear the AOD cache: www.agermark.com/.../clear-aod-cache-including-sysextension.html

  • Retha Profile Picture
    1,461 on at

    Thank you very much Nikolaos. That worked.

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 Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 681 Super User 2026 Season 1

#2
André Arnaud de Calavon Profile Picture

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

#3
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 579

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans