Shrijeet Sinha Posted January 2, 2019 Share Posted January 2, 2019 Hi I am getting below error when i am trying to create caseobject from business process. cause: javax.script.ScriptException: com.tibco.n2.javascript.EcmaError: TypeError: Cannot set property "firstName" of null to "SHRIJEET" Well i know it is because class is not getting instatntiated but i am definitely instantiating it and it works for normal attribute. Error is coming for attribute which is of BPM type of another "Global" class. Attached is my CaseDataModel and Process pacakge. Summary: ======== 1) BDS Project a) CaseClass created with name :orderDetails b)Gobal Class also there with name:CustomerDetails c) One attribute is caseclass isCustomerDetailsSection which is of type global class ,CustomerDetails. Exactly on step where i am setting value ofCustomerDetailsSection attributes, i am getting error. 2) Process Business Service - To take values from user task Business process: Script task - To assign values taken in user task to local datafield objects. and then call service task. SCript : //Instantiated class OrderDetails=com_example_casedatabom_Factory.createorderDetails(); CustomerDetails=com_example_casedatabom_Factory.createCustomerDetails(); //Mapping values which was passed from pageflow OrderDetails.orderId=OrderDetailsParameter.orderId; OrderDetails.orderState=OrderDetailsParameter.orderState; CustomerDetails.firstName=OrderDetailsParameter.customerDetailsSection.firstName; Log.write(CustomerDetails.firstName); CustomerDetails.lastName=OrderDetailsParameter.customerDetailsSection.lastName; Log.write(CustomerDetails.lastName); CustomerDetails.contactDetails=OrderDetailsParameter.customerDetailsSection.contactDetails; Log.write(CustomerDetails.contactDetails); CustomerDetails.address=OrderDetailsParameter.customerDetailsSection.address; Log.write(CustomerDetails.address); CustomerDetails.landmark=OrderDetailsParameter.customerDetailsSection.landmark; Log.write(CustomerDetails.landmark); //Getting all values correct till above //Issue starts from here when i am mapping value CustomerDetailsSection Attribute of caseclass which is of type GlobalClass //ERROR I get everytime : javax.script.ScriptException: com.tibco.n2.javascript.EcmaError: TypeError: Cannot set property "firstName" of null to "SHRIJEET" OrderDetails.customerDetailsSection.firstName=CustomerDetails.firstName; OrderDetails.customerDetailsSection.lastName=CustomerDetails.lastName; OrderDetails.customerDetailsSection.contactDetails=CustomerDetails.contactDetails; OrderDetails.customerDetailsSection.address=CustomerDetails.address; OrderDetails.customerDetailsSection.landmark=CustomerDetails.landmark; Other "normal" attributes of same caseclass is fine. Seems WHen global class is referenced in attribute of caseclass , that is just not getting instantiated. Please can i have advise how to proceed in this situation. Link to comment Share on other sites More sharing options...
Joshy Augustine Posted May 1, 2019 Share Posted May 1, 2019 Hi Shrijeet, Can you please see if adding the following line OrderDetails.customerDetailsSection = com_example_casedatabom_Factory.createCustomerDetails(); before OrderDetails.customerDetailsSection.firstName=CustomerDetails.firstName; resolves the issue 'customerDetailsSection' object does not seem to be getting instantiated in the script which probably explains the error message 'Cannot set property "firstName" of null to "SHRIJEET"' Thanks, Joshy Link to comment Share on other sites More sharing options...
Ketaki Anilkumar Lolage Posted May 10, 2019 Share Posted May 10, 2019 Hi, Shrijeet. Instead of assigning values to the customerDetailsSection individually, you can do this: OrderDetails.customerDetailsSection=CustomerDetails; I've tested it and it works. Thanks, Ketaki. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now