cancel
Showing results for 
Search instead for 
Did you mean: 

A reflection error occurred accessing the object.-- Error

Former Member
0 Kudos

I am trying to update from default field value to some other value by using the script definition, however system is throwing the "A reflection error occurred accessing the object."

If anyone has any idea/solution please help me.

regards

Sumanta

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sumanta,

Can you please give that line of code where you are trying the update. That will help in giving proper answers.

Thanks

Devesh

Former Member
0 Kudos

Hi Devesh,

Thanks for the quick reply. See the below line of code i am using.Here "CURRENCY" is the field name (It's a List Box) and in this example i am using the Field value as "ZAR" as per the esourcing screen,however in the script it is returning as "-2147483538:601:ZAR". I am getting the "A reflection error occurred accessing the object" when updatng to any other field value ("-2147483442:601:AOA") etc.

//str_Currency= doc.getExtensionField("CURRENCY").get().toString();

setFieldValue("-2147483538:601:ZAR");

Please let me know if you need any more information.

Regards

Sumanta

Former Member
0 Kudos

Sumanta,

I am not sure if your wrote a Field/Field Data Edit script or a Validate script.

In case you wrote a Validate script, try this :

doc.getExtensionField("CURRENCY").get().setDisplayName("ZAR");

Let us know if the script has been written in some other context or if you still face the error.

Thanks

Devesh

Former Member
0 Kudos

Hi Devesh,

I wrote a Field Validation Script and as per your guidelines i update the script,however got the different error.

new changed script

doc.getExtensionField("CURRENCY").get().setDisplayName("AOA");

and also tried with

doc.getExtensionField("CURRENCY").get().setDisplayName("-2147483442:601:AOA");

and the error message received is like

Error executing script: Sourced file: inline evaluation of: ``doc.getExtensionField("CURRENCY").get().setDisplayName("AOA"); . . . '' : target exception.

It is not allowing to modify/update the existing field value by using script.

Please let me know if you have any suggestion.

Regards

Sumanta

Former Member
0 Kudos

Hi Sumanta,

It was a mistake on my part.

If you have written a Field Validation Script then Try this :


import com.frictionless.api.doccommon.masterdata.CurrencyIBeanHomeIfc;
import com.frictionless.api.doccommon.masterdata.CurrencyIfc;

currBean = IBeanHomeLocator.lookup(session, CurrencyIBeanHomeIfc.sHOME_NAME).findUnique("AOA");

setFieldValue(currBean.getObjectReference());

In case of a Document Lifecycle Event script replace setFieldValue by doc.setCurrency. Also remember to replace "AOA" by the appropriate curreny ID when you need it.

Thanks

Devesh