Formula field value cannot be retrieved using Ajax API selec

Posted by Rollbase User on 22-Feb-2010 03:04

Hi Pavel and Matt I want to know if there is a work around on how to get a value of a formula field using you select query. I notice that formula fields cannot be selected as a field and cannot be use also in where clause.

All Replies

Posted by Admin on 22-Feb-2010 12:18

Depending on your situation, you may be able to set up a trigger on create/update which copies the formula field's value to a new text field and reference the text field with the Select query.. I've had to do something similar to this before.

Posted by Admin on 23-Feb-2010 17:39

I just added the following disclaimer to Chapter 6 of documentation:

Important: only columns with input values (text, decimal, etc) can be used in SELECT API. Dependent fields, such as formulas or related fields, cannot be used in SELECT API. Relationship field can be used, but will bring up only id of first related record (not an array of all related records).

Hope that will help.

Posted by Admin on 23-Feb-2010 22:37

Yes I would second this approach if accessing the formula result is important via the query API or as a field in general.

Posted by Admin on 07-Mar-2010 02:28

Matt,

It will be really helpful if formula fields can be access using query. It will improve the developers coding because if we uses triggers, it will just add another process and triggers only run on certain conditions like after create or update. I have created several JS right now and I uses the rbv_api a lot and I encountered several times also on this circumstances where I need to get the value in my formula field. Aside from the triggers, I also need to add another field that will hold the value for my trigger (Field update). In other cloud technology such as Salesforce, our BA's is the one creating the formula's and triggers because they can easily understand that all fields in an object is accesible using a merge token but as for Rollbase, we can't let our BA's do that work because they will just cause as troubles fixing their formulas and triggers.

Posted by Admin on 07-Mar-2010 02:42

Pavel,

Does change in value of formula fields does not call triggers also? What will be the work around if I wanted to call my field update trigger once my value in a formula fields change?

Posted by Admin on 07-Mar-2010 11:06

Triggers do not invoke other triggers to avoid uncontrolled and unwanted chain reactions. If you want to update related field when base record is updated you can do so through specially designed triggers "Update related records".

Posted by Admin on 07-Mar-2010 12:32

I just added a new setting which allows to enable depending triggers when particular trigger is running. Please read disclaimer before use.


Posted by Admin on 08-Mar-2010 00:00

Thanks Pavel, I'll try this one.

Posted by Admin on 08-Mar-2010 02:09

Hi again Pavel,

I look into the new setting you added and I'm not sure how this works but what I am looking for is to call a trigger after my formula field updates or changes.

If the alternative way to do this is call a trigger after a trigger, maybe I should determine which triggers should run after the trigger.

Posted by Admin on 08-Mar-2010 11:31

Now we have several ways to do that:
1. Explicitly invoke trigger on dependent record
2. Invoke all "On Update" triggers through new check box
3. Invoke dependent triggers through "Update Related" trigger

If this still not clear I suggest you wait for documentation on workflow. I'm currently working on extended Rollbase documentation.

This thread is closed