Return

Before Linx 6.4.0, a SetValue function was needed to set $.Result and return a result from a function or service.

In Linx 6.4.0 and higher there is a Return function in the Linx plugin that can be used for this.

Note:
With the introduction of the Result function:
  • The $.Result option has been removed from all dropdowns throughout the Linx Designer.
  • The result of a function can only be set by using the new Return function.

How it works

A Return function must be added to the relevant function or service at the point in the process where the function/service is to be exited and a potential value returned.

If a function has been configured to have a result, but it contains no Return function the Linx Designer will show a validation message that reads: "Not all code paths return a result."

When this validation is shown, you need to drag a Return function from the Linx plugin into your applicable function. Usually, the Return function will be the last item in your execution sequence.



Solution Upgrades

While upgrading solutions to Linx 6.4.0 will affect the execution sequences contained in your functions, the impact should not be significant. However, to be completely safe, we recommend that you make a backup of your solutions before you upgrade them.

Automatic Upgrades

Upon opening older solutions in Linx 6.4.0, most of the functions they contain will be automatically upgraded. This upgrade will result in some of the components being converted. However, the upgrade will not affect the logic of your solution and does not require any intervention from you.

Manual Upgrading

In some cases Linx cannot perform an automatic upgrade. In such cases the validation messages below will be shown:

  • “Not all code paths return a result.”

  • “Cannot locate reference(s) [$.Result]”

Double-clicking on the second validation message will guide you directly to the SetValue function that needs to be manually replaced.

Nullable properties on result types

Nullable properties on result types, which are often used in API related functions and services, e.g. with RESTHost, will produce validation errors when the original SetValue functiuon was not at the end of the execution sequence.

It is important to remember that when there is a result that is returned by a function (at the end of the execution sequence), then it must be handled by a Return function.

The way to fix this type of upgrade issue depends on your actual scenario. You may want to replace all SetValue functions with Return functions, or you may want to add a Return function at the end of the execution sequence to handle the function's returned output value.