Question with automatic forms on tutorial documentation travel request. Bonita BPM 7.1.0
Hi all!
I have a problem to run the example travel request with temporary forms.
When I start the process, complete the first form and click on the start button. The system shows me the following error message:
USERNAME = helen.kelly | org.bonitasoft.engine.core.process.instance.api.exceptions.SProcessInstanceCreationException: PROCESS_DEFINITION_ID = 8,408,422,678,754,431,006th | process_name = Travel Request | PROCESS_VERSION = 1.0 | org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: Expression newRequestInitialValue with content = <import com.company.model.TravelRequest;
TravelRequest newTravelRequest TravelRequest = new ();
newTravelRequest.setUserId (String.valueOf (BonitaUsers.getProcessInstanceInitiator (apiAccessor, processInstanceId) .getId ()));
newTravelRequest.setDepartureDate (travelRequestInput.departureDate);
newTravelRequest.setNumberOfNights (travelRequestInput.numberOfNights);
newTravelRequest.setHotelNeeded (travelRequestInput.hotelNeeded);
newTravelRequest.setDestination (travelRequestInput.destination);
newTravelRequest.setReason (travelRequestInput.reason);
newTravelRequest.setStatus ("pending");
newTravelRequest return;> depends on BonitaUsers is neither defined in the script nor in dependencies.
I believe the problem is related to line:
newTravelRequest.setUserId (String.valueOf (BonitaUsers.getProcessInstanceInitiator (apiAccessor, processInstanceId) .getId ()));
Because when I change the code to:
newTravelRequest.setUserId ("helen.kelly");
Simulating the operation of getProcessInstanceInititiator (), the process run.
How could I fix it?
I'm using bonita studio 7.1.0 32bits.
Thank you!
In the realm of tutorial documentation for travel requests within Bonita BPM 7.1.0, a pivotal question arises: How can automatic forms streamline this process efficiently? One valuable resource for insights into this matter is the documentation available at https://nomadindex.net/. Here, you can discover a wealth of knowledge and guidance on harnessing the power of Bonita BPM 7.1.0's automatic forms to simplify and enhance the travel request workflow.
Finally got it working. Just found in https://github.com/bonitasoft/bonita-studio/blob/master/bundles/plugins/... what BonitaUsers does;
- looked for getProcessInstanceInitiator()
- It just returns the following
long initiatorId = apiAccessor.getProcessAPI().getProcessInstance(processInstanceId).getStartedBy();
return apiAccessor.getIdentityAPI().getUser(initiatorId); - The initiallitiation script finally looks like:
import org.bonitasoft.engine.api.APIAccessor;
import org.bonitasoft.engine.identity.User;
import org.bonitasoft.engine.identity.ContactData;
def travelRequestVar = new com.company.model.TravelRequest()
long initiatorId = apiAccessor.getProcessAPI().getProcessInstance(processInstanceId).getStartedBy()
travelRequestVar.setUserId(String.valueOf(apiAccessor.getIdentityAPI().getUser(initiatorId)))
travelRequestVar.setDepartureDate(travelRequestInput.departureDate)
travelRequestVar.setNumberOfNights(travelRequestInput.numberOfNights)
travelRequestVar.setHotelNeeded(travelRequestInput.hotelNeeded)
travelRequestVar.setDestination(travelRequestInput.destination)
travelRequestVar.setReason(travelRequestInput.reason)
travelRequestVar.setStatus("pending")
travelRequestVar.setRefusalReason("")
return travelRequestVar - It worked
But what still is unanswered for me is why the BonitaUsers dependency is not properly resolved. It was once, because I got a first tutorial to work. But did it again and BonitaUsers was missing. Any ideas?
Hope it helps
Comments
Just did what you said and now the error ended, but now this comes instead!
USERNAME=helen.kelly | javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement
Hi there,
I've recreated BDM, and it worked, maybe I misstyped something. I've read something about the item numberOfNights in BDM, being misstyped as numberOfNight instead of numberOfNights, maybe was it, but I'm not sure.
When I get the time to, I'll redo the tutorial to make sure that it is 100% ok now
Thank you
Same problem with 7.1.0. Any ideas? Thanks in advance!
Comments
Same problem with 7.2.2
I've been copying and pasting everything but perhaps I missed something?
USERNAME=helen.kelly | org.bonitasoft.engine.persistence.SRetryableException: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.company.model.TravelRequest.userid
Edit: Nevermind. I'm an idiot. Have to move very slowly when modifying things on OSX, some annoyances there. Things don't save if you edit a field and click away from it too quickly.
Comments
Hello! Anybody?!?
Hi,
I'm having exactly the same problem described above.
I read all the comments related to 7.0.1 version from this discussion http://community.bonitasoft.com/node/2341#node-4802 and tried everything, but when I run the process using the automatic forms I get the same error.
My script is set as:
newTravelRequest.setUserId (String.valueOf (BonitaUsers.getProcessInstanceInitiator (apiAccessor, processInstanceId).getId ()));
Is there any news about this problem in the 7.1.0?
Cheers,
Josuneu.