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

Anand Kumar P
Giga Patron
Giga Patron

Hi @kalyani23,

Check if its empty or not 

if (!current.parent) {
current.parent = current.parent_activity.parent.toString();
}

 

Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand

Hi Anand,

I tried giving the above code as u mentioned , but it showing as no preview available . 

kalyani23_0-1706164492473.png

 

Pratiksha2
Mega Sage

Hello @kalyani23 - 

 

What specific value are you attempting to set to the parent field?

Could you please share more details about the specific value you intend to set in the parent field? This additional information will help me provide you with a more accurate solution.

 

Thanks,

Pratiksha

Hi Pratiksha,

kalyani23_0-1706165486316.png

 as shown in this image i want set parent field , which is a reference filed . 

the parent activity referenced record  contains  parent value . i want to set the same value here.