setFieldValue in formula field

Posted by matman on 13-Mar-2015 04:02

Hello,

I am trying to use the setFieldValue method in a formula(date) field, like this : 

rbv_api.setFieldValue("klant", {!id}, "End_of_contract", date );   

Howerver, it doesn't work. Is it not possible to use this method in a formula, or am I doing something else wrong?

Regards

Matman

All Replies

Posted by Sharavan Kumar on 13-Mar-2015 05:13

Hi ,

In Formula Field instead of setFieldvalue , please use 'return ' statement and choose return type as date or date/time .

eg: var d = new Date(rbv_api.getCurrentDate());  

return d;

Posted by matman on 13-Mar-2015 05:19

Oh sorry I don't think I was clear. With this setFieldValue I want to set the value of an other field, not the formula(date) field but just a plain date. I do this because I wan't to sort records based on the results. But when using a formula field, you can't sort. And when using a formula field, it wont update correctly because caluclations are made based on data from antother object.

Posted by pvorobie on 13-Mar-2015 11:27

Possible in triggers with "after create" or "after update" timing.

Posted by Gian Torralba on 13-Mar-2015 15:19
Hello,

You can create an object script with a rbv_api.setFieldValue() method inside or just use an update field trigger.

Thank you,
Gian
This thread is closed