M2M relationship is common in practical project. Therefore, I’d like to show you how to create M2M relationship in ServiceNow.
Below is the database
UML referenced by this experiment.
1. We need to create a test application for this experiment
Studio -> Click ‘Create Application’ and select ‘Start from scratch’
2. Create ‘Students’ and ‘Classes’ table individually.
3. Insert relating columns from UML diagram
4. Then, create the M2M relationship in ServiceNow
Studio -> click ‘Create Application File’ and select ‘Many to Many Definition’
5. Then setup the relationship between ‘Students’ and ‘Classes’ tables (it doesn’t matter for setting students table as “from” table or “to” table)
6. After that, the new application files were created
7. Then we can add columns to the m2m table
Studio -> Tables -> click ‘M2m Demo Enrollments’ and click “New” to create Table Columns
8. In order to test it, you can go to “Application Navigator”, and select “System Definition -> Tables”. Then filter ‘M2M Demo Enrollment” table. Then you can find the default UI to insert a new record to this m2m relationship table.
Note:
If you want to delete “M2M Definition”, you need to disable “
sys_m2m” -> “delete” of ACL temporarily.
No comments:
Post a Comment