Getting started tutorial for Bonitasoft 7.0 : No signature of method: com.company.model.TravelRequest.setUserId() error

Hi, I had the same problem with the Getting Started tutorial as was reported on july:
I run the application and get the error:

USERNAME=helen.kelly | org.bonitasoft.engine.core.process.instance.api.exceptions.SProcessInstanceCreationException: PROCESS_DEFINITION_ID=5045596222900762195 | PROCESS_NAME=Travel Request | PROCESS_VERSION=1.0 | org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: groovy.lang.MissingMethodException: No signature of method: com.company.model.TravelRequest.setUserId() is applicable for argument types: (java.lang.String) values: [3]
Possible solutions: setUserid(java.lang.String), getUserid()

It seems that you have corrected the tutorial since the last time this error was reported. I am using the following script to initialize the data:

import com.company.model.TravelRequest;

TravelRequest newTravelRequest = new TravelRequest();

newTravelRequest.setUserId(String.valueOf(BonitaUsers.getProcessInstanceInitiator(apiAccessor,processInstanceId).getId()));
newTravelRequest.setDepartureDate(travelRequestTravelRequest.departureDate);
newTravelRequest.setNumberOfNights(travelRequestTravelRequest.numberOfNights);
newTravelRequest.setHotelNeeded(travelRequestTravelRequest.hotelNeeded);
newTravelRequest.setDestination(travelRequestTravelRequest.destination);
newTravelRequest.setReason(travelRequestTravelRequest.reason);
newTravelRequest.setStatus(“pending”);

return newTravelRequest;

My only guess would be that the type for the UserId that I am initializing is not String.
Thanks a lot for any help!

Hi,

Are your referring to this tutorial:
http://documentation.bonitasoft.com/getting-started-tutorial

If that is the case, there is no userId attribute for the TravelRequest object.
If you added it yourself, you may check the type of the attribute by looking the data modeler available from the Development > Business Data Model > Manage menu of the Studio.

Hope this helps,

USERNAME=helen.kelly | org.bonitasoft.engine.core.process.instance.api.exceptions.SProcessInstanceCreationException: PROCESS_DEFINITION_ID=7144423146527212184 | PROCESS_NAME=Travel Request | PROCESS_VERSION=1.0 | org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: groovy.lang.MissingMethodException: No signature of method: org.bonitasoft.engine.identity.impl.UserImpl.id() is applicable for argument types: (java.lang.String) values: [pending]
Possible solutions: is(java.lang.Object), find(), find(groovy.lang.Closure), wait(), any(), getId()
Porfa, Alguien sabe como solucionarlo?

Hi,

thanks a lot for your answer. In fact I am using Bonita 7.0 (not 6.5) and the tutorial that is here: http://documentation.bonitasoft.com/getting-started-tutorial-0

There is a userId attribute for TravelRequest and it is defined as String in the data model. The method setUserId is generated automatically and it seems that the type transformation proposed in the tutorial :
String.valueOf(…) does not work for this method.
So, the problem is still there…

Where can I find the setUserId method for TravelRequest?

Thanks a lot for your help!

Ah sorry, I pointed to the wrong tutorial.

I just figured out what is wrong with your process: it is a problem of case in the name of the method you called.

If you look at your data model, you will notice that your attribute is named userid with lowercase “i” (it should be userId if you follow the instructions). This will generate a setUserid method in the TravelRequest BDM object.
Now the problem is that you have called the method setUserId with an uppercase “I” as instructed.

In conclusion, you must either rename the attribtue or use the right method.
Be careful as Groovy and JavaScript are both case-sensitive.

Hope this helps,