Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Adding new class attribute on standard class by extension

(0) ShareShare
ReportReport
Posted on by 310

Hi experts,

I would like to know, is there any way to add new class attribute on standard class by extension method.

For example, below is the standard implementation of PurchReqDocument class, and now I want to add new attribute ExpressionHierarchyProviderAttribute for my new field of PurchReqLine table which is also referrenced from EcoResCategory.RecId.

[
WorkflowDocIsQueueEnabledAttribute(true,"@SYS152689"),
ExpressionHierarchyProviderAttribute(classStr(PurchReqExpressionProvider), tableStr(PurchReqLine), fieldStr(PurchReqLine,ProcurementCategory)),
ExpressionCurrencyFieldMapAttribute('parmApprovalAmount', 'parmCurrencyCode'),
ExpressionCurrencyFieldMapAttribute('parmApprovalAmountExclTax', 'parmCurrencyCode'),
ExpressionCurrencyFieldMapAttribute('parmSpendingLimit', 'parmCurrencyCode'),
ExpressionCurrencyFieldMapAttribute('parmSpendingLimitPreparer', 'parmCurrencyCode')
]
class PurchReqDocument extends WorkflowDocument implements SysErrorMessageHelpScopeIWorkflow
{

...

...

}

-Thanks

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Adding new class attribute on standard class by extension

    I couldn't find any document or example in standard class for this scenario. Can you try below code, it might be limitation that we can't add new attribute by extension but can't confirm it.

    [
    WorkflowDocIsQueueEnabledAttribute(true,"@SYS152689"),
    ExpressionHierarchyProviderAttribute(classStr(PurchReqExpressionProvider), tableStr(PurchReqLine), fieldStr(PurchReqLine,ProcurementCategory)),
    ExpressionCurrencyFieldMapAttribute('parmApprovalAmount', 'parmCurrencyCode'),
    ExpressionCurrencyFieldMapAttribute('parmApprovalAmountExclTax', 'parmCurrencyCode'),
    ExpressionCurrencyFieldMapAttribute('parmSpendingLimit', 'parmCurrencyCode'),
    ExpressionCurrencyFieldMapAttribute('parmSpendingLimitPreparer', 'parmCurrencyCode'),
    ExpressionHierarchyProviderAttribute(classStr(PurchReqExpressionProvider), tableStr(PurchReqLine), fieldStr(PurchReqLine,TestField))
    ]
    [ExtensionOf(classStr(PurchReqDocument))]
    public final class PurchReqDocument_C_Extension
    {
    }

  • Arif Vadsarya Profile Picture
    Arif Vadsarya 310 on at
    RE: Adding new class attribute on standard class by extension

    Hi Mohit,

    Thanks for quick reply.

    Compilation is successful but system is not picking this attribute for PurchReqDocument class.

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Adding new class attribute on standard class by extension

    Hi Arif, Can you try adding new field attribute as specified below. I have not tested the functionality but compiler is not giving any errors.

    pastedimage1684063807599v1.png

    [
        ExpressionHierarchyProviderAttribute(classStr(PurchReqExpressionProvider), tableStr(PurchReqLine), fieldStr(PurchReqLine,TestField))
    ]
    [ExtensionOf(classStr(PurchReqDocument))]
    public final class PurchReqDocument_C_Extension
    {
    }

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,187 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,966 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans