How to use parent record field value when create a new record from related list

Saurav Bhardwa2
Tera Contributor

In problem form we have created a new cmdb_ci extended outage related list. I have also created a custom field in outage table which is referencing the problem table. 
I have requirement, I wanted to auto-populate the problem number in the custom problem field when we are creating a outage record from related list. 
Can anyone please help me how to achieve this?

1 ACCEPTED SOLUTION

Pravindra1
Tera Guru

Hi @Saurav Bhardwa2 , It should auto populate if you have mapped Problem sys_id (Parent) to Outage record at the time of creation of Problem>Outage relationship.

Pravindra1_0-1685688774874.png

Here I have  mapped Task_Number with Parent Sys_ID, then Problem number is auto populated in Task number field.

Pravindra1_1-1685688857567.png

 

View solution in original post

9 REPLIES 9

Pravindra1
Tera Guru

Hi @Saurav Bhardwa2 , It should auto populate if you have mapped Problem sys_id (Parent) to Outage record at the time of creation of Problem>Outage relationship.

Pravindra1_0-1685688774874.png

Here I have  mapped Task_Number with Parent Sys_ID, then Problem number is auto populated in Task number field.

Pravindra1_1-1685688857567.png

 

Thank you @Pravindra1, that worked

 

Hey @Pravindra1 , I want to set the begin and end date as well, which are mapped with other problem table fields. When I am mapping those, it was removing the whole related list from the outage related list in problem form. I have tried setValue, but it was not working in relationship script. 

Is there a wat to achieve this from Relationship script?

 

Hi @Saurav Bhardwa2 , Other fields cannot be populated from relationship script.

As Problem Sys_Id is populated on Outage form,  you can write OnLoad Client script on 'cmdb_outage' table to  populate other fields from problem record.

wndydngy
Tera Expert

Hi,

 

You can implement this by creating a Relationship. 

 

Applies to table: Problem
Queries from table: Outage

 

Query with:

current.addQuery('custom_field', problem.sys_id);
 
 
The custom reference field should be automatically populated with the Problem display value whenever you create an Outage from the related list.
 
Let me know if it helps. Thanks!