[4.2] - Formula return as a string does not accept a return

Posted by IramK on 05-Jul-2016 04:31

Hello,

I have a formula field and I am performing the return of the formula as a string. There is a bug with this field in the formula area.

1) var str = "";

return str; // Throws an error

2) var str = "";

str; // Works fine

I think it should work properly using the first approach. Formula field doesn't recognize a return for strings.

Iram

All Replies

Posted by Karthikeyan Bhaskaran on 07-Jul-2016 23:29

Hello Iram,


There is no Function defined which should return the str. The error is appearing due to that.

Thank you,

Karthikeyan

Posted by Karthikeyan Bhaskaran on 10-Jul-2016 22:39

Sorry I jumped too soon - it worked in other areas where you can use a template. With the blank string, I do not see a problem in the 4.2.1 which was released over the weekend. Can you please try this on the 4.2.1?

Further, if you place a token which returns String without the quotes , error is thrown.

The following works but throws an error without the quotes around the token :

var str="{!fiName#value}";

return str;

Posted by IramK on 11-Jul-2016 03:36

Hello [mention:1ad0ccbca98f4ef2ac88293a48e6d67d:e9ed411860ed4f2ba0265705b8793d05] ,

So basically it didn't work in 4.2? We won't be upgrading to 4.2.1 unfortunately so don't think I would get to test whether it would work there or not. However I have tested it in the beta release and seems to work ok there.

Cheers.

Iram

Posted by Santosh Patel on 11-Jul-2016 06:21

Iram,

Could you do a "Debug Formula" and share the results of the Parsed Formula? as the return statement should work just fine.

Posted by IramK on 11-Jul-2016 07:07

Hi Santosh,

This is the code for the formula field that gives the error. Please have a look.

var array = ["Progress", "rollbase", "Cloud", "Applications"];

var uniqueArray = array.filter(function(item, pos) {
  return array.indexOf(item) == pos;
});

var list = "";
list = uniqueArray.toString().replace(",", " | ");
rbv_api.println(list);
return list; // errors

This thread is closed