Does anyone know how to query the project linked t...
# suiteql
c
Does anyone know how to query the project linked to an opportunity?
a
Copy code
SELECT
  transaction.tranid,
  BUILTIN.DF(transactionline.entity) as entity,
  job.id
FROM
  transaction
  INNER JOIN transactionline ON transactionline.transaction = transaction.id
  INNER JOIN job ON transactionline.entity = job.id
WHERE
  transaction.id = 583353 -- id of opportunity
c
Doesn’t work, the entity points to the customer not the project.
a
Are you sure you're using transactionline.entity not transaction.entity?
My exact query with a valid opportunity yields what?
c
There is only one line in transactinLine for the opportunity, and entity is the ID of the customer
I do agree normally transactionLine.entity links to job on other transaction types, but the opportunity ONLY has a mainline which generally does not link to project
a
Are we talking about this field.
c
Correct
a
Not sure what to tell you.
We must have different configurations or something.
c
Results from your query, returning “customer / company”
We are using advanced projects, wonder if that is why
a
I believe you. The only thing I would suggest is to
select * from transaction inner join transactionline
and ctrl-f and see if you could find the job id.
Obviously filtered by opportunity id.