Hello,
Is there a way I could get the related Object 'name' for an existing record using select query? Currently it returns back the ID of the related record. Kindly let me know.
Correct, this will work. URL example tested in my environment:
http://localhost:8080/rest/api/selectQuery?query=select+name+from+child+where+R629945%3D629958&maxRows=500&sessionId=f8707ccd173d4db78a552ece7894996c@5903
Query:
select name from child where R629945=629958
This is assuming there is 1:N relationship between "parent" and "child" objects and 629958 is record's ID on parent side.
You could set the "composite" parameter of your REST API call to "1", this is "0" by default. When set to "1" it will include the related record in the output. This included related record will contain the "name" field.
I dont think you have the parameter "composite" in a SelectQuery REST API call?
Ah sorry, no you don't have that with queries. You could use the template way of fetching data, example: "SELECT "{!R116103884.name}" FROM subscription". Do not forget the quotes around the {!R116103884.name} or it won't work.
That is the response i get back..:
<resp status="ok"> <row> <col>{!Raccount.name}</col> </row> <row> <col>{!Raccount.name}</col> </row> <row> <col>{!Raccount.name}</col> </row> </resp>
Doesnt look right to me.
When running it in Rollbase itself, those template tokens actually do get replaced. Unfortunately this doesn't seem to work for the REST API.
I can't find a way to solve this problem using only one query. Rollbase queries don't seem to accept more than 1 object in the FROM and also subqueries the way I tried them aren't possible :/
Hi,
In REST API we cannot get the value "name" of the related object, at this point you may want to
1. Add another query to get the name of the related record, as matman said only one possible query every request
2. Create another Text Field that will hold the name of that related object, update that field every create or update of the record via Update Field trigger. In your REST query just select that text field.
Regards,
Orchid
REST API selectQuery works the same way as server-side API selectQuery. Please prepare query using debugger "Test Query" tool.
Could you suggest a possible answer to this with an appropriate query?
Hi,
I tested the REST API query and could not get directly the name too of the related object. This could be a possible enhancement to future release.
Other alternative way above, I would suggest #2, it is easier to setup :)
Regards,
Orchid
Please provide query you're using.
Could you suggest a possible answer to this with an appropriate query?
Flag this post as spam/abuse.
Correct, this will work. URL example tested in my environment:
http://localhost:8080/rest/api/selectQuery?query=select+name+from+child+where+R629945%3D629958&maxRows=500&sessionId=f8707ccd173d4db78a552ece7894996c@5903
Query:
select name from child where R629945=629958
This is assuming there is 1:N relationship between "parent" and "child" objects and 629958 is record's ID on parent side.