Announcement

Collapse
No announcement yet.

Parent Child field creation and linkage

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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 manager

  • #2
    Why not to create one_to_many replationship using Entity Manager?

    Also there is a mistake:
    "entity": "contacts" should be "entity": "Contact"

    Comment


    • #3
      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 screen

      Comment


      • #4
        Also contacts and accounts have a many to many relationship I can't remove through entity manager

        Comment

        Working...
        X