rbf_getRelatedFields not returning a value

Posted by IramK on 17-Oct-2014 06:40

Hello,

I am trying to use retrieve a value of my field for a relationship and I have used this function rbf_getRelatedFields in the following way given below. However I am getting an error: Data Object with id 0 not found. Any suggestions on where I am going wrong?

rbf_getRelatedFields("R112536491", {!id}, "account_type",
function(relName, objId, values)
{
var account_type;
alert(values.length);
account_type = values[0];
alert(account_type);
});

All Replies

Posted by pvorobie on 17-Oct-2014 06:47

What is value of {!id} token you're using?

Posted by IramK on 17-Oct-2014 07:00

Do I need to specify a value? Can I not use {!id} or just id in that as an argument?

Posted by pvorobie on 17-Oct-2014 07:33

Template parser will set value for you if available (for instance, on record View page). But, since you're facing error, the question still stands. Please check HTML code on your page to find out why you're having an error.

Posted by IramK on 17-Oct-2014 08:30

Any suggestions on how do I go about setting up a template parser because the help documentation does not really give any examples.

Posted by pvorobie on 17-Oct-2014 08:59

First, what is type of the page you're using? Page Editor > Page properties > Page type

Posted by IramK on 17-Oct-2014 09:01

The Page Type is "New"

Posted by pvorobie on 17-Oct-2014 09:03

Also, please make sure that {!id} token you're using is listed in helper UI which is available to you when you type your code in Rollbase.

Posted by IramK on 17-Oct-2014 09:04

Yes it is available.

Posted by pvorobie on 17-Oct-2014 09:04

On "New" page there is no record in scope, so there is no valid value for {!id} toke.

Basically, the system does not know which record you're referring to.

Posted by IramK on 17-Oct-2014 09:12

Because it is a related field whose value I am interested in from my parent Object i.e. Parent Object: Account, child Object: Third Party Application. So I'd like to access the value of a field from my parents Object which in this case is Account. I understand there is no "third party application" in scope which is why there is no valid id but I have an account object available to me from which I am interested in retrieving the field value.

Posted by pvorobie on 17-Oct-2014 09:14

You need to use different technique: client-side JavaScript. You cannot use server-side template tokens on "New" page.

Posted by IramK on 17-Oct-2014 09:24

But rbf_getRelatedFields is client-side Javascript and not server-side.

Posted by Orchid Corpin on 17-Oct-2014 10:00

Can you make it in one line from your rbf_getRelatedFields ..... to function(relName, objId, values)

also can try to see the console(F12) if there are any errors?

Regards,

Orchid

Posted by pvorobie on 17-Oct-2014 10:09

Just do not use {!id} toke. Use client-side rbf_getFieldValue() instead.

Posted by IramK on 17-Oct-2014 10:36

and what should integration name should I use in getFieldValue? The account's field's integration name?

Posted by IramK on 17-Oct-2014 10:38

There are no errors Orchid. The code seems to be fine.

Posted by Orchid Corpin on 17-Oct-2014 10:50

I see you are in the "NEW" page, you cannot use rbf_getRelatedFields, this is for existing records which you get the the related object's field values. When in new page the {!id} is not yet existing and you get that error "Data object with id 0 not found". Try to use that in a View or Edit page.

Posted by Orchid Corpin on 17-Oct-2014 11:14

Take a look at [mention:05b5f00eae4a468d844fa8bedcafd110:e9ed411860ed4f2ba0265705b8793d05] 's suggestion about using rbf_getFieldValue instead.

Posted by Orchid Corpin on 30-Oct-2014 17:41
Hi,

Are there still any issues? or do you still have questions related to this?

Thanks,
Orchid
This thread is closed