Hi, I'm fairly new to developing apps for Sharepoint so please go easy! I'm having a problem joining two lists using CAML in Javascript. What I'm trying to do may not even be possible but from the research I've done so far I believe it should be, but I'm obviously going wrong somewhere. There are two lists in my app that are joined by a lookup column. The parent list is named TransactionHeader and the child list is named TransactionItems. For every item in the TransactionHeader list there will be one or more related items in the TransactionItems list. What I'm trying to do is retrieve items from the TransactionItems list but join to the TransactionHeader list so that I can also retrieve related data. The CAML I'm using is as follows:
var query;
query += "<View>";
query += " <ViewFields>";
query += " <FieldRef Name='ItemStatus' />";
query += " <FieldRef Name='ItemDate' />";
query += " <FieldRef Name='myReviewedBy' />";
query += " </ViewFields>";
query += " <ProjectedFields>";
query += " <Field Name='myReviewedBy' Type='Lookup' List='myTransactionHeaders' ShowField='ReviewedBy' />";
query += " </ProjectedFields>";
query += " <Joins>";
query += " <Join Type='Left' ListAlias='myTransactionHeaders'>";
query += " <Eq>";
query += " <FieldRef Name='TransactionHeader' RefType='Id' />";
query += " <FieldRef List='myTransactionHeaders' Name='ID'>";
query += " </Eq>";
query += " </Join>";
query += " </Joins>";
query += "</View>";
This CAML always results in a 'Cannot complete this action' message being displayed. A little more information in case it's important; after building the query I'm loading the TransactionItems list like so:
var ctx = new SP.ClientContext.get_current();
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml(myCaml);
var list = ctx.get_web().get_lists().getB