Open Forum

Expand all | Collapse all

Cumulative Update - Scope change on functions

  • 1.  Cumulative Update - Scope change on functions

    Posted Apr 10, 2019 10:01 AM
    ​Nav 2017
    This is for developers:
    We just applied a cumulative update to our database and discovered that some functions that were previously Global are now Local. For example: UpdateSalesLines on the Sales Header table This has caused some of our custom objects to fail compilation because these functions are no longer available to the custom objects. I know it is bad practice to change the scope back to global so we don't want to do that. I'm not fond of the idea of cloning these functions and copying them into our custom objects because if in a future cumulative update that function is modified, we wouldn't know that our cloned code needs the same modification unless we manually track where we've put cloned code. I am considering creating a global function in the object with the local function where the sole purpose would be to call the local function but that feels awkward. So I was wondering if there is a best practice approach to this situation? Thank you.

    ------------------------------
    Laura Gumbel
    Developer
    Group O
    Milan IL
    ------------------------------
    NAVUG Summit - Post


  • 2.  RE: Cumulative Update - Scope change on functions

    TOP CONTRIBUTOR
    Posted Apr 11, 2019 07:23 AM
    The good news is that in NAV 2018 and BC this function is not local anymore so I would just change it to Local = No and know that you will be all set when you upgrade.

    If Microsoft hadn't done this then when you move to AL you would have to totally recreate that function.  When you create a table extension (or a Page Extension) it does not have access to any Local Functions on the table you are creating the extension for.  This is up there for one of my biggest gripes with AL.

    Another thing you can do is to log an issue here: https://github.com/Microsoft/ALAppExtensions/issues/ which Microsoft will consider your request.  This is a great place to ask for an Event to be added as well.

    ------------------------------
    Jason Wilder
    Senior Application Developer
    Stonewall Kitchen
    York ME
    ------------------------------

    NAVUG Summit - Post


  • 3.  RE: Cumulative Update - Scope change on functions

    TOP CONTRIBUTOR
    Posted Apr 12, 2019 07:22 AM
    Small update: My middle paragraph is true (AL doesn't have access to Local Functions) but I forgot that since the function is no longer local in future versions you will have access to it from AL.

    ------------------------------
    Jason Wilder
    Senior Application Developer
    Stonewall Kitchen
    York ME
    ------------------------------

    NAVUG Summit - Post


  • 4.  RE: Cumulative Update - Scope change on functions

    Posted Apr 12, 2019 09:09 AM
    ​Thank you very much for the information Jason. All of it is good to know!! We have decided to revert the function back to global.

    ------------------------------
    Laura Gumbel
    Developer
    Group O
    Milan IL
    ------------------------------

    NAVUG Summit - Post


If you've found this thread useful, dive deeper into User Group community content by role