cancel
Showing results for 
Search instead for 
Did you mean: 

How to set a default value for an object reference field in a script....

Former Member
0 Kudos

Hi!

I have an extension definition field defined as type 'object reference', that I would very much like to set to a default value for in a script.

I can set other extension definition field default values easily enough in the script, but when I try to update any of the three fields associated with the object reference field (i.e.xxx_OBJECT_ID, xxx_CLASS_ID, xxx_OBJECT_NAME) the script throws a null exception...

So my question is does anyone know how to do this? ...or am I just making a schoolboy scripting error ...or is it impossible to do this in scripting?

Many thanks!

Stuart

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Mudit - thank you!

I was over complicating it but it works perfectly now.

Best regards,

Stuart

Former Member
0 Kudos

Hi

Since your field is an object reference one, in order to set a default value you first have to locate the home instance of the object , obtain the object reference of the default value you want to set and then use set() to set the default value of your extension field.

Regards

Mudit Saini