Is there a way to populate data from a related list into the current form?

kenduong
Kilo Contributor


Hi All,

I am trying to populate data from the related list remediation into the risk form. I want to see the complete view of risk and remediation on the same view.

1 ACCEPTED SOLUTION

Hi Ken



Use this, i hope this works



After


update/ insert


table - grc_remediation



condition


current.risk!=''



gs.addInfoMessage('started');


var gr=new GlideRecord('grc_risk')


gr.addQuery('sys_id', current.parent);


gr.query()


if(gr.next())


{


gs.addInfoMessage('Came here');


gr.u_risk_remediation=current.sys_id;


gr.update()


}


-Anurag

View solution in original post

14 REPLIES 14

Business rule


After


update/ insert


table - remediation



condition


current.risk!=''



script


var gr=new GlideRecord('risk')


gr.addQuery('sys_id', current.risk);


gr.query()


if(gr.next())


{


gr.risk_field=current.some_field;


gr.update()


}




i have assumed that the table names are risk and remediation


on the remediation table there is a field called risk


-Anurag

How did you dot walk the fields?   The info should just populate based on the current record if you used the green plus to dot-walk in the form layout.


kenduong
Kilo Contributor


Anurag- I will see if I can get that script to work , but shouldn't the business rule be on the risk table instead of remediation?



Mike Allen- I did use the green plus sign in form layout to choose the correct remediation fields, but no data populates until I manually choose the record


is should be on the remedation


-Anurag

Anurag,
I tried doing your suggestions on a demo instance. I can see that I am getting the correct remediation number using gs.addInfoMessage(current.number);


, but it is not populate in the reference field. Am i missing something simple?



After


update/ insert


table - grc_remediation



condition


current.risk!=''



var gr=new GlideRecord('grc_risk')


gr.addQuery('sys_id', current.grc_risk);


gr.query()


if(gr.next())


{


gr.u_risk_remediation=current.number;


gr.update()


}