Parent Child field creation and linkage
Collapse
X
-
Also contacts and accounts have a many to many relationship I can't remove through entity manager -
Ah! okay thank you for spotting that
I tried to use the one to many using entity manager, but it but for some reason it did not create a field for both the One and the Many, just the created a field for the One. I need a way for a user to see and edit both the one and the many from their respective edit details screenLeave a comment:
-
Why not to create one_to_many replationship using Entity Manager?
Also there is a mistake:
"entity": "contacts" should be "entity": "Contact"Leave a comment:
-
Parent Child field creation and linkage
So I've gone through and added
"contacts": {
"type": "hasMany",
"entity": "contacts",
"foreign": "child",
"layoutRelationshipsDisabled": false,
"required": false
}
and
"contacts": {
"type": "hasMany",
"foreign": "accounts",
"entity": "Contact",
"isCustom": true
},
to crm\application\Espo\Modules\Crm\Resources\metadat a\entityDefs\Account.json
and to crm\custom\Espo\Custom\Resources\metadata\entityDe fs\Account.json
also I've added
"account": {
"type": "belongsTo",
"required": false
},
and
"account": {
"type": "belongsTo",
"entity": "Account"
}
to crm\custom\Espo\Custom\Resources\metadata\entityDe fs\Contact.json
and I was about to do the same to
crm\application\Espo\Modules\Crm\Resources\metadat a\entityDefs\Contact.json
when I saw that it already had some odd link and field set up...
"account": {
"type": "link"
},
"accounts": {
"type": "linkMultiple",
"view": "Crm:Contact.Fields.Accounts",
"columns": {
"role": "contactRole"
}
},
"accountRole": {
"type": "varchar",
"notStorable": true,
"disabled": true
},
"accountType": {
"type": "foreign",
"link": "account",
"field": "type"
},
"account": {
"type": "belongsTo",
"entity": "Account"
},
"accounts": {
"type": "hasMany",
"entity": "Account",
"foreign": "contacts",
"additionalColumns": {
"role": {
"type": "varchar",
"len": 50
}
},
"layoutRelationshipsDisabled": true
},
should I just remove the code above and replace it with what I put into the other files?
my goal is that contacts are children of accounts, and that there's a field for this in the layout managerTags: None

Leave a comment: