Skip to main content
Introduction to Code Statement

Process development

R
Written by Riku Virtanen
Updated over 7 months ago

Code Statement

Frends offers multiple different ways to extend the no-code capabilities by allowing the developers to write C#. One of these alternative ways is to use Code statements if, for example, the integration use case is not implementable with the existing Tasks. The Code statement should only be used if the developer is proficient with programming and C#. It is especially recommended to create a Frends Task instead if the code in the C# code Element is used in multiple different Processes, or becomes overly complicated.

The C# Code Element functions in the same way as the Code Element except it is possible to write multiple lines of code.

Remember the namespaces available in the statements?

In advanced settings you can give the type for the statement return value or the assigned variable.

If 'Assign variable' is set, all execution paths in the code need to end in a return or throw.

Advanced usage

In some cases there is a need for some reusable functionality in an Process that is small and simple enough to not be worth creating a one-off Task for. In this case the C# Code shape can return a Func. This reusable function can be called later in the Process multiple times with different parameters. To be able to call the function, Assign variable needs to be set.

This piece of code can now later be executed in the Process by using #var.UpperCase("foo") giving the result "FOO".

The next article is Introduction to Expression

Did this answer your question?