Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

FlowField based on code

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I am disappointed to find that a FlowField cannot use a small amount of CAL code.
I am trying to calculate a substring of a UK Postcode on the Customer table, e.g.: AB12 3CD -> AB12
I have done this outside NAV in Excel reports by: PostcodeDistrict = Delete3CharsFromTheEnd(StripSpaces(Postcode))

What is the best way to do this in NAV to act just like a FlowField? In other words:

  • Is not stored in the database
  • Is available on the customer page
  • Is available on the web service

Thanks!
(For anyone wondering, I did it this way because the first part is not a fixed length.)

*This post is locked for comments

  • Jeremy Vyska Profile Picture
    Jeremy Vyska 727 on at
    RE: FlowField based on code

    If you add the variable to the Page and add the variable to the page just like you would a field, and the Web Service exposes the Page object, then you will see the variable just like any field.  Sounds like that will hit your needs.  Hope that helps!

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: FlowField based on code

    Would the variable be defined on the Page or the Table?

    And once I added it to the page, would the Web Service (based on that page) automatically get that variable?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: FlowField based on code

    Thanks for the reply Jeremy.

    I prefer your first variable solution over creating and updating a new database field, since the data is already in the database.

  • Verified answer
    Jeremy Vyska Profile Picture
    Jeremy Vyska 727 on at
    RE: FlowField based on code

    Sadly, you just can't put code logic or even functions into FlowFields.

    Generally, you'd have to, on the Customer Page and in the Web Service you're exposing, set a variable, populate that variable with your logic during OnAfterGetRecord, then add the Variable to the page.

    Given the nature of the challenge you have, what you *could* do is make a new field that contains only the data you want.  Then, a quick bit of additional validation on the field when it changes to update the new PostPrefix field, along with a one-time run Processing Only routine that populates the data initially.

    Then you can do FlowFields all over the place against it.

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

News and Announcements

Announcing Category Subscriptions!

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans