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);
});
What is value of {!id} token you're using?
Do I need to specify a value? Can I not use {!id} or just id in that as an argument?
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.
Any suggestions on how do I go about setting up a template parser because the help documentation does not really give any examples.
First, what is type of the page you're using? Page Editor > Page properties > Page type
The Page Type is "New"
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.
Yes it is available.
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.
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.
You need to use different technique: client-side JavaScript. You cannot use server-side template tokens on "New" page.
But rbf_getRelatedFields is client-side Javascript and not server-side.
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
Just do not use {!id} toke. Use client-side rbf_getFieldValue() instead.
and what should integration name should I use in getFieldValue? The account's field's integration name?
There are no errors Orchid. The code seems to be fine.
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.
Take a look at [mention:05b5f00eae4a468d844fa8bedcafd110:e9ed411860ed4f2ba0265705b8793d05] 's suggestion about using rbf_getFieldValue instead.
Hi,
Are there still any issues? or do you still have questions related to this?
Thanks,
Orchid