How to copy value of a field from one form and use it in another form

Community Alums
Not applicable

Hi Team,

 

I have written a display BR to copy value in scratchpad on one form. I am trying to use it onLoad client script which is written on another form. When I am trying to print that value I am getting as Undefined.

 

Please suggest me how to get that value so that I can fetch value of other field based on that value

Below is used in Display BR:

g_scratchpad.edge=current.u_edge;
gs.info("hello :"+g_scratchpad.edge);

 

In OnLoad client script written on another form, when I am cheking I am getting infomessage as Undefined

var edge=g_scratchpad.edge;
g_form.addInfoMessage('client :'+edge);

 

If above way is incorrect, then tell me what approach I should follow?

7 REPLIES 7

Community Alums
Not applicable

Hi Raghav,

 

The issue is not resolved. I will tell you clear steps:

1) I have a form "cmdb_ci_class_interface"with field "Edge" having some value which is a reference field

Ankur20_0-1670861735257.png

 

I also have a "segment" field which is also a reference field on this form. When I click on segment reference lookup icon, it will populate list of records from the form "sn_cmdb_ci_class_segment" , we can also see a "New" button to create a record, 

Ankur20_3-1670861903061.png

 

When we click on New button, i will have 3 fields Name,Company, Edge. Now here is the requirement. As soon as we click on New button, the "Company" field should autopopulate with value based on "edge" field value in the first form. 

In order to acheive this, I am writing onLoad Client script on "Segment" form which will load, when we click on New button. But I do not know how to send the value of "edge" field which is on "Interface" form.

 

As you said in the script include do GlideRecord but how should I fetch the value of Edge field from Interface form?

To accomplish any requirement of this sort, there should be a relationship b/w two tables.

Which I don't see in this case.

 


Raghav
MVP 2023

Hello Just following this thread and thought what if the target table is connected to another table 

and that another table is conencted to the source table ...


so its like 
table 1 (value of the source field ) ------ connected to -------  lets just say this is table 2 ------- connected to -------- table 3 ( where the value of the source field needs to be reflected on a field).

how to go from this ? 
hope my sample makes sense.... 

thanks in advance...