How build relationship between user and project

Ramu8
Tera Expert

I need to build relationships between user and project (u_project) should same like as skill(cmn_skill) and user (sys_user) in servicenow where record are stored in user skills (sys_user_has_skill) as oob  please advice 

 

1 ACCEPTED SOLUTION

Danish Bhairag2
Tera Sage
Tera Sage

Hi @Ramu8 ,

 

To establish a relationship between the User and Project tables in ServiceNow similar to the skill relationship, you can create a reference field in the Project table that refers to the User table. Additionally, you can create a related list on the User table to display associated projects.

 

1. **Create Reference Field in Project Table:**

   - Go to the Project table in ServiceNow.

   - Create a new field, let's call it `user_ref`, of type Reference.

   - Set the reference table to the User table.

 

2. **Create a Related List in User Table:**

   - Go to the User table in ServiceNow.

   - Create a new related list, let's call it `projects`.

   - Configure the related list to display records from the Project table where the `user_ref` field matches the user.

 

3. **Establishing Many-to-Many Relationship:**

   - If you need a many-to-many relationship, you may consider creating a separate table (e.g., `user_project_mapping`) with reference fields to both User and Project tables.

 

4. **Populate User Skills Table:**

   - If you want to store additional information about the relationship (similar to `sys_user_has_skill`), you can create a new table (e.g., `user_project_mapping`) to store these records.

 

Keep in mind that "out of the box" (OOB) configurations might vary, so adjust these steps based on your specific ServiceNow instance and version. Additionally, consider testing the changes in a non-production environment before implementing them in your live instance.

 

Thanks,

Danish

 

View solution in original post

6 REPLIES 6

Maik Skoddow
Tera Patron
Tera Patron

Hi @Ramu8 

please refer to the following video: https://www.youtube.com/watch?v=yJttdDa-9xU 

Maik

When building ServiceNow Apps, sometimes tables will relate to each other "many to many". This is how to build m2m tables in ServiceNow. You'll learn two very different ways. 🔎 Looking for #ServiceNow talent or opportunity? http://theduke.digital/contact/ 👑 Duke Digital Media sponsorships & ...

Relationship is not working as expected

 

I created one more custom table used two reference field for two tables project and user

 

Please find below screenshot 

IMG20240101223717.jpg

IMG20240101223533.jpg

IMG20240101223516.jpg

 

 sorry i didn't understand why we are going for sys_m2m table

We can be use direct table two fields which is refering to user and project

 

Please advice

Danish Bhairag2
Tera Sage
Tera Sage

Hi @Ramu8 ,

 

To establish a relationship between the User and Project tables in ServiceNow similar to the skill relationship, you can create a reference field in the Project table that refers to the User table. Additionally, you can create a related list on the User table to display associated projects.

 

1. **Create Reference Field in Project Table:**

   - Go to the Project table in ServiceNow.

   - Create a new field, let's call it `user_ref`, of type Reference.

   - Set the reference table to the User table.

 

2. **Create a Related List in User Table:**

   - Go to the User table in ServiceNow.

   - Create a new related list, let's call it `projects`.

   - Configure the related list to display records from the Project table where the `user_ref` field matches the user.

 

3. **Establishing Many-to-Many Relationship:**

   - If you need a many-to-many relationship, you may consider creating a separate table (e.g., `user_project_mapping`) with reference fields to both User and Project tables.

 

4. **Populate User Skills Table:**

   - If you want to store additional information about the relationship (similar to `sys_user_has_skill`), you can create a new table (e.g., `user_project_mapping`) to store these records.

 

Keep in mind that "out of the box" (OOB) configurations might vary, so adjust these steps based on your specific ServiceNow instance and version. Additionally, consider testing the changes in a non-production environment before implementing them in your live instance.

 

Thanks,

Danish

 

Thanks for response

 

Able to understand till 3 points establish many to many relationship 

 

But not able to understand 4 point 

 

My requirement is to just build relationship same as skill and user on resource_plan table list

 

Please advice