Setting field values on onclick of New button on related list

janrameez
Giga Contributor

Hello,

Can anyone let me know how to pass values on to the table fields after clicking New button on the Related List?

Example:

On the INcident form, I have added a related list Incident Task and when I click on INcident Task related list's New button, I want to have the caller field of the Incident to be copied and set automatically on the opened Incident Task form.

Thanks!

4 REPLIES 4

anurag92
Kilo Sage

You need to create a New UI action with Name: "New", override the Global New Related List UI action.



Keep the condition as: (new GlideRecord(current.getTableName())).canCreate() && !RP.getListControl().isOmitNewButton() && RP.isRelatedList()   && current.getTableName() == 'incident_task'



and in the script, you can set values:



current.caller_id=current.parent.caller_id;


Anurag,



I have done the below, but it's not working:



1. Created another Global UI Action with Condition as


(new GlideRecord(current.getTableName())).canCreate() && !RP.getListControl().isOmitNewButton() && RP.isRelatedList()   && current.getTableName() == 'incident_task'


and with script as


current.assigned_to=current.parent.assigned_to;



In the Overrides field, I have selected the New UI Action that applicable on my related list.



Please let me know my mistake.


Ok 2 things, have you set the Action same as overridden new button?


If yes, try keeping the table of new button as Incident Task instead of Global and remove the 'current.getTableName() == 'incident_task'' condition.


Next, is the parent field being set as parent incident?