Let's assume you want to show the customerId value in the outputs. 

If you used just api.customerGroupEntry(), then the result in UI would be shown as e.g. "CG['customerId' = '60838']".

The correct procedure to display the value '60838' is:

About Syntax Check

It is used in two use cases:

  1. Anytime you save a formula, it checks whether the Groovy code is well formed and that the code does some additional mocking of dependencies of the current element (it usually tries to add a neutral element of the type but if it cannot infer the type, it will assume the BigDecimal type). 
    So in this case, the syntax checker is unable to infer the return type of the expression api.getElement("CG") and will decide to put there a new BigDecimal(1).

  2. Usually any logic is run twice. In the first run, it just needs to see all calls to the methods which define input params (and so the isSyntaxCheck is set to true). Otherwise it is a normal logic run and this variable is set to false. The first run is really needed for the system to know what inputs the logic will generate.

For more details on isSyntaxCheck see Miscellaneous Functions.