Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

How to customize "sales this Month" cue based on the current user.

Posted on by 70
Hi,
 
My client requirement is to show "sales this month" based on the sales done by himself. How to set filter for the same?
 
So wrote a code like below: but getting Error: The following fields must have the same type:Field: User ID <-- Created By

Table: Cust. Ledger Entry <-- Activities Cue

Type: Code <-- GUID.
 
but both user ID and created by fields are GUID data type only.
 
 field(70000; SalesThisMonth; Decimal)
        {
            FieldClass = FlowField;
            //CalcFormula = sum("Cust. Ledger Entry"."Sales (LCY)" where("Document Type" = filter(Invoice), "Posting Date" = filter('-1Y' .. 'CD')));
            CalcFormula = sum("Cust. Ledger Entry"."Sales (LCY)" where("Document Type" = filter(Invoice), "Posting Date" = filter('CM'), "User ID" = field(SystemCreatedBy)));
            Caption = 'Sales Amount This Month';
            AutoFormatExpression = GetAmountFormat();
            AutoFormatType = 11;
            DecimalPlaces = 0 : 0;
        }
  • Suggested answer
    gdrenteria Profile Picture
    gdrenteria 10,249 Most Valuable Professional on at
  • Suggested answer
    Umut Dogan Koc Profile Picture
    Umut Dogan Koc 62 on at
    How to customize "sales this Month" cue based on the current user.
    Hello,
     
    Must it be a flow field? You can create a normal field and make calculation on a trigger instead of using a flow field.

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,572 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,792 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans