How to set default value for reference field , only when that field value is empty

kalyani23
Tera Contributor

Hi ,

I want to set default value in parent field (type reference), only when the field value is empty.

i have given this below code line :

javascript:current.parent= current.parent_activity.parent.toString();

but looks like not working . 

Can anyone help with this code.

 

Thanks in advance

Kalyani

 

 

15 REPLIES 15

Amit Verma
Kilo Patron
Kilo Patron

Hi @kalyani23 

 

On which table you have this field ? Also, could please elaborate a bit on your requirement through screenshots ?

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

Hi Amit,

The table used here is Skill tracker Activities . and it contains fields such as Activity code /Parent activity/Parent.

record 1 - Activity code- LSNVSPV273 and parent - STREQ0001084

record 2. in same table i am creating child record for the above activity code record 

show it shows parent activity as above record (LSNVSPV273 ), also i want it to show parent value same as above that is (eg.STREQ0001084).

i tired executing the above query , it is returning correct sys_id. but the preview record is showing unavailable .

 

Thanks & Regards,

Kalyani

Hi @kalyani23 

 

Have you tried using Auto-Populate feature which I highlighted earlier ? Also, to which table is the field "Parent" is being referred ?

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

Hi Amit,

As i mentioned earlier , i couldnt find the autopopulate tab here . I am trying to set default value in dictionary override of a parent field in task table (global).

Tai Vu
Kilo Patron
Kilo Patron

Hi @kalyani23 

Have you tried the Default value in the field dictionary?

The default value populates the field on the blank form for a new record, and also subsequently when the new record is submitted if the field is empty.

Specify a default field value

 

In your case it could be like below.

 

javascript:current.parent_activity.parent.toString();

 

Screenshot 2024-01-25 at 14.50.24.png

 

Cheers,

Tai Vu