Sending Field Values when Clicking New Button of Related List

pauloferreira
Kilo Explorer

Hi,

 We have a requirement that when user clicks in the new button of the related list “Project Change Requests” of the “Project” form:

find_real_file.png

The values from the “Project manager” field and “Sponsor” (custom) field of the “Project” form:

 find_real_file.png

Goes to the 2 custom fields “Project Manager” and “Sponsor” of the “Project Change Request” form:

find_real_file.png

Can anyone help us to achieve this please?

Thanks and best regards,

Paulo

 

 

 

 

 

1 ACCEPTED SOLUTION

Mahendra RC
Mega Sage

Hi pauloferreira,

If you only want values from the “Project manager” field and “Sponsor” (custom) field of the “Project” form should go to the 2 custom fields “Project Manager” and “Sponsor” of the “Project Change Request” form only when  user clicks on New button in related list on "Project" table then you can use the Display Business rule and onLoad client script as shown below:

Display BR on "Project Change Request" table:

(function executeRule(current, previous /*null when async*/) {

g_scratchpad.projectManager= current.parent.project_manager; // use Parent and Project Manager field name of "Project Change                                                                                                        Request" table
g_scratchpad.sponsor= current.parent.sponsor;// use Parent and Sponsor field name of "Project Change                                                                                                                     Request" table
gs.info("projectManager : " + g_scratchpad.projectManager);
gs.info("sponsor: " + g_scratchpad.sponsor);

})(current, previous);

onLoad Client Script on "Project Change Request" table:

function onLoad() {

if(!g_form.getValue('project_manager'))  // use Project Manager field name of "Project Change                                                                                                                  Request" table
g_form.setValue('project_manager', g_scratchpad.projectManager);
if(!g_form.getValue('sponsor'))  // use sponsor field name of "Project Change                                                                                                                                Request" table
g_form.setValue('sponsor', g_scratchpad.sponsor);

}

Please let me know if you face any issue in this.

Please mark it correct, if it resolves your problem.

Thanks

 

 

View solution in original post

5 REPLIES 5

Hi Mahendra,

 

Did the above solution work for you.

 

I have a similar requirement, the display business rule part worked for me (validated in the system log). however, the client script did not work. The values are not getting set to the referenced table new record creation.

 

Best Regards,