The Zurich release has arrived! Interested in new features and functionalities? Click here for more

We have a Parent table as HR case and its child table as HR Task. In HR Case form there is a field known as "Effective Date" and same as in HR Task. I need to display the HR case Effective date value same as in HR task Effective date. Can please anyo

saurabhchande
Tera Expert

We have a Parent table as HR Case (Human Resources) and its child table as HR Task. In HR Case form there is a field known as "Effective Date" and same as in HR Task. I need to display the HR case Effective date value same as in HR task Effective date. Can please anyone help me with this ? Thanks in advance.

5 REPLIES 5

ismailsn
ServiceNow Employee
ServiceNow Employee

The field is in both child and parent table separately? When you right click on the field on both table forms and press 'Show' What does table name display as when the pop up box comes up? If the field is on task - but is on both of these forms, there is no problem. If this is the case- and the HR Task is a task record for the HR Case record, there most likely is a field on the HR Task record that references the HR case record. Once you've confirmed that you can write a glide script to make sure both values for the field are the same. Here is some psedo code:




function fixEffectiveDate(){




var target = new GlideRecord('hr_task_table');


target.addNotNullQuery('effective_date');


target.query();


while(target.next()){


var case = new GlideRecord('hr_case_table');


if(case.get(target.case_reference_field)){



case.effective_date = target.effective_date;


case.setWorkflow(false);


case.update();



}




}




}


Both the table have seperate fields.


In HR case table the element name is "u_effective_date" and in HR task table its "u_effective_date_1"


Hi Ismail,



Could you please tell me where to paste the given code? Because I tried and ran it in HR task effective date calculated value, but did not work. The value is not auto displayed which is in HR case.



Thanks,


Saurabh Chande


Mujtaba Amin Bh
Mega Guru

Why are you using two different fields if the value is same? You can use the parent field and that is why the concept of extending the tables.



Or is it only for few records the details are same and you want to copy from parent table?



Please clarify!