Hi,
I am new to scripting and am facing the following issue in a Script Definition. In Supplier Management screen of Sourcing, when a business user creates a new Contact for a supplier, I need to replace the contact's user ID with another value. This is the code snippet that I tried:
currentRec = doc.getObjectReference();
contactHome = (ContactIBeanHomeIfc)IBeanHomeLocator.lookup(session, ContactIBeanHomeIfc.sHOME_NAME);
contact = contactHome.find(currentRec);
.. some more lines of code to print out the contact first name, user ID etc which worked fine..
contact.setName("Hello123");
This script gave the following inline script evaluation error while saving the contact:
Error executing script: Sourced file: inline evaluation of: ``import com.sap.odp.api.ibean.*; import com.sap.odp.api.ibean.common.*; import . . . '' : Method Invocation contact.setName.
The script definition is for Class 600 - Contact. I checked the Reference Guide and found that User ID display field in UI is mapped to database field NAME and the corresponding getter/setter methods in the bean are getName and setName.. getName() gives me the user ID that the user enters while creating the record. But when I try to modify that value in a pre-save script using the above code I am getting this error..
Can anyone please help me out? Why is Sourcing not letting me call the setName() method?