Task entity in the db has a field called account_id. I want to automatically populate QuoteItem based on the account_id in the Task table. So when creating an invoice, and user selects an account name from Quote entity->account field, QuoteItems populate. If I was to use a query, it would look something like this: "SELECT task.* FROM account INNER JOIN task ON account.id = task.account_id AND task.status = 'Completed' ". If it was manually creating a relationship in entitydefs->task.json/quoteitem.json, it may look something like this:
//Task entity
//Task.json
{
"links": {
"quoteitem": {
"type": "hasMany",
"foreign": "task",
"entity": "QuoteItem",
"isCustom": true
}
}
}
//QuoteItem entity
//QuoteItem.json
{
"task": {
"type": "link"
}
},
"links": {
"task": {
"type": "belongsTo",
"foreign": "quoteitems",
"entity": "Task",
"isCustom": true
}
}
}
Not too sure how and where(folder/file) to do this. May I have some assistance?
//Task entity
//Task.json
{
"links": {
"quoteitem": {
"type": "hasMany",
"foreign": "task",
"entity": "QuoteItem",
"isCustom": true
}
}
}
//QuoteItem entity
//QuoteItem.json
{
"task": {
"type": "link"
}
},
"links": {
"task": {
"type": "belongsTo",
"foreign": "quoteitems",
"entity": "Task",
"isCustom": true
}
}
}
Not too sure how and where(folder/file) to do this. May I have some assistance?
Comment