I'm using DataService's web service to create new records in a simple custom object (via {{BaseUri}}/0/DataService/json/SyncReply/InsertQuery).
This object/section has a lookup to Contact, and so far in the body of the request I have been sending each Contact Id like this:
"ContactLkp": {
"expressionType": 2,
"parameter": {
"dataValueType": 10,
"value": "6530f9b7-2ca2-48a6-b529-fbfd456aa704"
}
}
However, for this to work, it is a prerequisite to previously having searched each contact's Id vía SelectQuery.
My question is, could it be possible to insert the contact by using a subQuery? It seems like it should according to this documentation (by using an expressionType of value 3), but I have been unable to create a successful subQuery/subFilter.
What I would like to do is something like this:
"ContactLkp": {
"expressionType": 3,
"subQuery": {
// Use a select query by using a parameter like the name
// or the email of the contact
}
}
With this I would be able to insert the record with only 1 request (insert) instead of 2 (select/search and then insert).
TL;DR, is it possible to include subqueries as parameters in DataService's InsertQuery?