I need to write an onLoad() client script on a table in order to :

sonita
Giga Guru

I have a status report table ; I have two fields , one called planned hours, the other one is actual hours. There is another table called resource plan table. it halso has these fileds

when I open the status report table. What I'm trying to do is to write an onLoad() client script on the status report table so when I open a record , the fileds in the status report are filled from the values from resource_plan table. Any help would be appreciated.

7 REPLIES 7

manikorada
ServiceNow Employee
ServiceNow Employee

Soni,



Is there any field which represents the link between the two tables


find_real_file.png


they should be related ! but when I look at the schema map , there is no relation!!


Deepak Ingale1
Mega Sage

Adding to what Mani has already asked you to provide, I think your requirement can be met with GlideAjax calls or Display Business rule.



GlideAjax - ServiceNow Wiki



Scripting in Business Rules - ServiceNow Wiki


This is my code so far:



function onLoad()


{




  var rp=new GlideRecord('resource_plan');



              g_form.setValue("u_planned_hrs", rp.planned_hours);


  g_form.setValue("u_actual_hrs", rp.actual_hours);



}