Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

How can I throw an error when user try to change offset account when location on (Journal Name form) and offset account on (General journal > Lines) are same.

(0) ShareShare
ReportReport
Posted on by 75

I need to validate the location and offset account.

When both are same and user try to change offset account on a form then it should through an error/message.

pastedimage1674137587699v1.pngpastedimage1674137676659v2.png

  • Ashraf_ahk Profile Picture
    Ashraf_ahk 75 on at
    RE: How can I throw an error when user try to change offset account when location on (Journal Name form) and offset account on (General journal > Lines) are same.

    //used validate write method on form

    DEFAULTDIMENSIONVIEW ddv;
    DimensionAttributeLevelValueAllView dalvav;
    LedgerJournalName ledgerJournalName ;

    SELECT DISPLAYVALUE
    FROM ddv
    join ledgerJournalName
    WHERE ddv.DefaultDimension == ledgerJournalName .DefaultDimension
    && ddv.NAME == 'my req location name' && ledgerJournalName .JournalName == ledgerJournalTable.JournalName;

    select DISPLAYVALUE
    from dalvav
    where dalvav.VALUECOMBINATIONRECID == ledgerJournalTrans.OFFSETLEDGERDIMENSION
    && dalvav.ValueOrdinal == 2;

    if(ddv.DisplayValue != dalvav.DisplayValue)
    {

    isValid = checkFailed('Set correct offset account location');
    }

  • Ashraf_ahk Profile Picture
    Ashraf_ahk 75 on at
    RE: How can I throw an error when user try to change offset account when location on (Journal Name form) and offset account on (General journal > Lines) are same.

    No need to use class but by using view(DimensionAttributeLevelValueAllView) I validated it easily.

  • Martin Dráb Profile Picture
    Martin Dráb 230,253 Most Valuable Professional on at
    RE: How can I throw an error when user try to change offset account when location on (Journal Name form) and offset account on (General journal > Lines) are same.

    Than this is the question you should have asked. You can't build a wall if you don't have the bricks.

    Do you understand the difference between default dimensions and ledger dimensions?

    Let's start with default dimensions on journal name. You mean LedgerJournalName.DefaultDimension, right? You can use DimensionAttributeValueSetStorage class to work with it (look for examples either on internet or F&O codebase).

  • Ashraf_ahk Profile Picture
    Ashraf_ahk 75 on at
    RE: How can I throw an error when user try to change offset account when location on (Journal Name form) and offset account on (General journal > Lines) are same.

    I don't know how to get dimension value.

  • Martin Dráb Profile Picture
    Martin Dráb 230,253 Most Valuable Professional on at
    RE: How can I throw an error when user try to change offset account when location on (Journal Name form) and offset account on (General journal > Lines) are same.

    All right, so what do you need from us. You don't know how to write any validation at all, you don't know how to get the dimension value, or what?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,253 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans