I created two custom entities: course and teachingStaff which have a many-to-may relationship called courseTeachingStaff.
When I create a course, I need to define one or more teachers and one or more assistants. Both teachers and assistants are records of teachingStaff.
Reading the documentation, it seems that multiple links can share the same relationship (courseTeachingStaff, in my case) provided the necessary condition for each link.
I suppose that I have to create an additional column (using additionalColumns parameter) called "role" for the middle table course_teaching_staff where the value of "teacher" or "assistant" will be stored. Probably, in the custom/Espo/Custom/Resources/metadata/entityDefs/Course.json I need to add something like:
Unfortunately, I am rather stuck because I was not able to write a value in the "role" column of the middle table course_teaching_staff not even for a simple case when there is only one link (and not two links like I need).
I have understood that I need to configure entities using a json configuration file (one for courses and one for teachingStaff) but then I don't know what other files have to be modified or created to customize espoCRM in order to manage courses and teaching staff. It is very frustrating because I know that espoCRM can do this but even after searching the web, reading documention and posts in the forum I don't have anything working.
Really need help.
When I create a course, I need to define one or more teachers and one or more assistants. Both teachers and assistants are records of teachingStaff.
Reading the documentation, it seems that multiple links can share the same relationship (courseTeachingStaff, in my case) provided the necessary condition for each link.
I suppose that I have to create an additional column (using additionalColumns parameter) called "role" for the middle table course_teaching_staff where the value of "teacher" or "assistant" will be stored. Probably, in the custom/Espo/Custom/Resources/metadata/entityDefs/Course.json I need to add something like:
Code:
"links": { "teachers": { "type": "hasMany", "entity": "TeachingStaff", "relationName": "courseTeachingStaff", "conditions": { "role": "teacher" }, "additionalColumns": { "role": { "type": "varchar", "len": "40" } } }, "assistants": { "type": "hasMany", "entity": "TeachingStaff", "relationName": "courseTeachingStaff", "conditions": { "role": "assistant" }, "additionalColumns": { "role": { "type": "varchar", "len": "40" } } } }
I have understood that I need to configure entities using a json configuration file (one for courses and one for teachingStaff) but then I don't know what other files have to be modified or created to customize espoCRM in order to manage courses and teaching staff. It is very frustrating because I know that espoCRM can do this but even after searching the web, reading documention and posts in the forum I don't have anything working.
Really need help.
Comment