Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

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

kalp
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

vermaamit16
Kilo Patron

Hi @kalp 

 

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

 

Thanks & Regards

Amit Verma

Thanks and Regards
Amit Verma

kalp
Tera Contributor

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 @kalp 

 

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

Thanks and Regards
Amit Verma

kalp
Tera Contributor

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

Hi @kalp 

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