I cant create record when clicking new in related list

oww15
Tera Contributor

Hi guys,

 

Can someone know why I can't create a new record when clicking new in the related list for requested item. When I click new button it will redirect me to the incident form, however after filling out the form, it displays no record. This related list was created from relationships. 

 

 

 

 

 

1 ACCEPTED SOLUTION

 

Hi @oww15 

 

From what I understand is that the relationship you want is bidirectional, which means that if you view the parent record, it will display the child records, and if you view the child record, it will display the parent record. In ServiceNow, this is achieved through the use of related lists and references fields. The related lists display records related to the current record, while reference fields allow you to link records together.

 

By doing this only then you can achieve what you told, otherwise it's not possible.

 

You can follow this guideline if you wanna create the Bi-directional relationships

 

  1. Identify the parent and child records: Determine which record type will be the parent and which will be the child.

  2. Add reference field to the child record: Add a reference field to the child record that will reference the parent record. For example, if the parent record is a Request Item (RITM) and the child record is an Incident (INC), you would add a reference field on the INC record that references the RITM record.(OOB available)

  3. Set the parent record in the child record: Once you have added the reference field, you need to set the parent record in the child record. This can be done by selecting the parent record in the reference field.

  4. Add related list to the parent record: To display child records on the parent record, you need to add a related list to the parent record form. This can be done by adding a related list field to the parent record form and specifying the child record type and the reference field.

  5. Verify bidirectional relationship: Once the above steps are completed, you can verify the bidirectional relationship by checking the related list on the parent record form to see the child records, and by checking the reference field on the child record form to see the parent record.

Regards,

Ashir Waheed

View solution in original post

5 REPLIES 5

Ashir Waheed
Kilo Sage
Kilo Sage

Hi @oww15 

 

For incident related list on Requested item table, you really don't need to create a relationship. OOB link is already there.

Instead of creating a relationship try to check the following step first if they resolve the issue.

 

1. On Requested Item table, right click on the header click on Configure->Related Lists.

2. Verify that you have following available.

AshirWaheed_0-1678831960039.png

3. Add them in Selected section and save.

4. Now Try creating the incident record again. 

5. Keep the one that's required, Parent in most cases.

 

If you still wanna edit your relationship instead of this you need to add current.sys_id.

current.addQuery(current.sys_id, parent.parent); alone sys_id can't be defined in relationship.

Regards,

Ashir Waheed

 

Hi @Ashir Waheed ,

 

I created a relationship because the OOB gets the incidents whose parent is this RITM. What I need is to get the parent incident for that requested item. With the relationship I created I was able to get the parent incident for that ritm. However, when I tried your script adding the current.sys_id, it gets all the incident records. 

Just add this script to show all the incident which have your RITM as parent.

//since on incident we have parent field. 

current.addQuery("parent", parent.sys_id);

 

 

 

 

Hi @Ashir Waheed ,

 

Is it possible for them to co-exist?

For example INC123 has RITM123 as its child request item, this will show in the requested item related list. And when I clicked RITM123 it will display that INC123 is his parent in the related list.

 

And vice versa?

 

If I assigned RITM456 as parent of INC456 it will display in the related list that its parent is INC456 and if I clicked INC456 it will show in the requested item related list that its parent is RITM456?