Travel Request process in the getting start sample version 7.0.0

Hi,
I am trying to do the travel request in the getting started, but when I submit the initiation form I got the following error:

**USERNAME=helen.kelly | org.bonitasoft.engine.core.process.instance.api.exceptions.SProcessInstanceCreationException: PROCESS_DEFINITION_ID=4777866935891891811 | 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.setDepartureDate() is applicable for argument types: (null) values: [null]
Possible solutions: setDepatureDate(java.util.Date), getDepatureDate()
**
can someone help? whet is wrong

Thanks in advance.

3 Likes

Hi nasser,

I had the same problem. The reason is the documentation which is wrong in some parts. Search for “departure” and “depature” and make sure you just use one of those variants, ideally the one without the typo :slight_smile:

After fixing this, I could run the process without problems.
(but there seem to be more problems with the documentation, because the application page does’nt show any data for me in the “my pending requests” and “my approved requests” tables)

I have this error when click Start

USERNAME=helen.kelly | javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement

Hello, suddenly the script to catch the userName stopped working. I have this service task:

![service task][service task]
[service task]: http://i.imgur.com/gCI6lsB.png

with this script:

return BonitaUsers.getProcessInstanceInitiator(apiAccessor,processInstanceId).getUserName();

It works correctly, but suddenly I get this error in bonita.log. In other process the same has occurred. I have checke “resolve dependencies automatically”.

2015-07-30 19:57:24.392 +0200 org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork org.bonitasoft.engine.log.technical.TechnicalLoggerSLF4JImpl log GRAVE: THREAD_ID=145 | HOSTNAME=Usuario-PC | TENANT_ID=1 | org.bonitasoft.engine.core.process.instance.api.exceptions.SActivityStateExecutionException : "PROCESS_DEFINITION_ID=8916244329602994221 | PROCESS_NAME=Travel Request | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=7 | ROOT_PROCESS_INSTANCE_ID=7 | FLOW_NODE_DEFINITION_ID=4712334614962966914 | FLOW_NODE_INSTANCE_ID=19 | FLOW_NODE_NAME=Obtener UserId | org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: Expression getUserId with content = depends on BonitaUsers is neither defined in the script nor in dependencies." org.bonitasoft.engine.core.process.instance.api.exceptions.SActivityStateExecutionException: PROCESS_DEFINITION_ID=8916244329602994221 | PROCESS_NAME=Travel Request | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=7 | ROOT_PROCESS_INSTANCE_ID=7 | FLOW_NODE_DEFINITION_ID=4712334614962966914 | FLOW_NODE_INSTANCE_ID=19 | FLOW_NODE_NAME=Obtener UserId | org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: Expression getUserId with content = depends on BonitaUsers is neither defined in the script nor in dependencies. at org.bonitasoft.engine.execution.StateBehaviors.executeOperations(StateBehaviors.java:660) at org.bonitasoft.engine.execution.state.ExecutingAutomaticActivityStateImpl.onEnterToOnFinish(ExecutingAutomaticActivityStateImpl.java:48) at org.bonitasoft.engine.execution.state.FlowNodeStateWithConnectors.execute(FlowNodeStateWithConnectors.java:73) at org.bonitasoft.engine.execution.state.FlowNodeStateWithConnectors.execute(FlowNodeStateWithConnectors.java:35) at org.bonitasoft.engine.execution.FlowNodeExecutorImpl.executeState(FlowNodeExecutorImpl.java:128) at org.bonitasoft.engine.execution.FlowNodeExecutorImpl.updateState(FlowNodeExecutorImpl.java:182) at org.bonitasoft.engine.execution.FlowNodeExecutorImpl.stepForward(FlowNodeExecutorImpl.java:164) at org.bonitasoft.engine.execution.FlowNodeExecutorImpl.executeFlowNode(FlowNodeExecutorImpl.java:317) at org.bonitasoft.engine.execution.work.ExecuteFlowNodeWork.work(ExecuteFlowNodeWork.java:72) at org.bonitasoft.engine.execution.work.TxBonitaWork$1.call(TxBonitaWork.java:48) at org.bonitasoft.engine.execution.work.TxBonitaWork$1.call(TxBonitaWork.java:44) at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:312) at org.bonitasoft.engine.execution.work.TxBonitaWork.work(TxBonitaWork.java:53) at org.bonitasoft.engine.execution.work.LockProcessInstanceWork.work(LockProcessInstanceWork.java:79) at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42) at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42) at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42) at org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork.work(FailureHandlingBonitaWork.java:66) at org.bonitasoft.engine.work.BonitaWork.run(BonitaWork.java:56) at org.bonitasoft.engine.work.SequenceRunnableExecutor.innerRun(SequenceRunnableExecutor.java:47) at org.bonitasoft.engine.work.BonitaRunnable.run(BonitaRunnable.java:35) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: Expression getUserId with content = depends on BonitaUsers is neither defined in the script nor in dependencies. at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.evaluateRightOperandExpression(OperationServiceImpl.java:198) at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.calculateRightOperandValue(OperationServiceImpl.java:120) at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.executeOperators(OperationServiceImpl.java:105) at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.execute(OperationServiceImpl.java:94) at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.execute(OperationServiceImpl.java:81) at org.bonitasoft.engine.execution.StateBehaviors.executeOperations(StateBehaviors.java:657) ... 23 more Caused by: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: Expression getUserId with content = depends on BonitaUsers is neither defined in the script nor in dependencies. at org.bonitasoft.engine.expression.impl.GroovyScriptExpressionExecutorCacheStrategy.evaluate(GroovyScriptExpressionExecutorCacheStrategy.java:137) at org.bonitasoft.engine.expression.impl.ExpressionServiceImpl.evaluate(ExpressionServiceImpl.java:86) at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionWithResolvedDependencies(ExpressionResolverServiceImpl.java:213) at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsFlatten(ExpressionResolverServiceImpl.java:120) at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluate(ExpressionResolverServiceImpl.java:83) at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.evaluateRightOperandExpression(OperationServiceImpl.java:193) ... 28 more Caused by: groovy.lang.MissingPropertyException: No such property: BonitaUsers for class: BScript25 at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50) at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231) at BScript25.run(BScript25.groovy:1) at org.bonitasoft.engine.expression.impl.GroovyScriptExpressionExecutorCacheStrategy.evaluate(GroovyScriptExpressionExecutorCacheStrategy.java:134)

Hi,

I am using bonitasoft 7.4.1 version i following the Getting started videos and documentation from official website.
while creating travel req getting error


( 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.reason)


please help me anyone.

In Pool variables, i edit the business data variables here i have attached the code.

def travelRequestVar = new com.company.model.TravelRequest()
travelRequestVar.departureDate = travelRequestInput.departureDate
travelRequestVar.numberOfNights = travelRequestInput.numberOfNights
travelRequestVar.hotelNeeded = travelRequestInput.hotelNeeded
travelRequestVar.destination = travelRequestInput.destination
travelRequestVar.reason = travelRequestInput.reason3
travelRequestVar.status = “pending”
travelRequestVar.userId = BonitaUsers.getProcessInstanceInitiator(apiAccessor, processInstanceId).getUserName();
return travelRequestVar

I wrote the line as per the video : http://www.bonitasoft.com/resources/videos/getting-started-tutorial

travelRequestVar.userId = BonitaUsers.getProcessInstanceInitiator(APIAccessor, (long) processInstanceId).id

It worked (no error) after I re-wrote it as per the article: http://documentation.bonitasoft.com/6.x-7.2/getting-started-tutorial-2

travelRequestVar.userId = BonitaUsers.getProcessInstanceInitiator(apiAccessor, processInstanceId).id

(note the APIAccessor vs apiAccessor in both lines)

After going deeper into the getting started tutorial I think I found the reason why the application page does’nt show any pending or approved requests: The example never instantiates the userId variable with a value… The only variable we instantiate with a value ist status:

import com.company.model.TravelRequest;

TravelRequest newTravelRequest = new TravelRequest();

newTravelRequest.setUserId(travelRequestTravelRequest.userId);
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;

Does anyone know how to set the value for the userId?
I made the TravelTool Overview page working fine with just filtering by status, so I am sure this is the reason (of course problem then is that any request is shown)

Hello peterp_va,
to do it I add a service task between start event and Manager review task.
In this service task, go to operations tab and add a new operation:
Select BDM “travelRequest”, select java method and select “setUserId”. Insert a script named “getUserId” with this code:

return BonitaUsers.getProcessInstanceInitiator(apiAccessor,processInstanceId).getUserName();

This update de travelRequest.UserId value to the initiator username.

I hope you find it useful. I’m sorry for my English. Regards,

Actually you can replace directly in the script:

travelRequestTravelRequest.userId

with

BonitaUsers.getProcessInstanceInitiator(apiAccessor,processInstanceId).getUserName().

It’s simpler than creating an additional task with an operation.

Thank you all for your support, all the best.

Thanks antoine, this works for me so far.
But for the getting started tutorial to work we need the Userid of the ProcessInstanceInitiator instead of the user name. How to retrieve the id?

Simply replace getUserName() by getId().

You can refer to the javadoc for all methods available on Bonita User Java class.

I already tried this, but I can’t submit the form then.

I realized that the attribute TravelRequest.userId was created with data type string but the returned userId is of type long so type conversion was the way to go:

newTravelRequest.setUserId(String.valueOf(BonitaUsers.getProcessInstanceInitiator(apiAccessor,processInstanceId).getId()));

Now, it works like a charm for me :slight_smile:

Thank you all for your ideas, great to have this community support!

There are a couple of errors in the documentation “Getting_started_tutorial” in addition to documented by peterp_va.
“Update the application page”
fourth point says:
An External API valled Variable With the value myPendingRequests …/API/bdm/businessData/com.company.model.TravelRequest?q=findByUserAndStatus&p=0&c=10&f=userId={{myUserId}}&f=status=pending
I should say:
An External API valled Variable With the value myPendingRequests …/API/bdm/businessData/com.company.model.TravelRequest?q=findByUserIdAndStatus&p=0&c=10&f=userId={{myUserId}}&f=status=pending

fifth point says:
An External API valled Variable With the value myApprovedRequests …/API/bdm/businessData/com.company.model.TravelRequest?q=findByUserAndStatus&p=0&c=10&f=userId={{myUserId}}&f=status=Approved

I should say:
An External API valled Variable With the value myApprovedRequests …/API/bdm/businessData/com.company.model.TravelRequest?q=findByUserIdAndStatus&p=0&c=10&f=userId={{myUserId}}&f=status=Approved


Hay un par de errores en la documentación del “Getting_started_tutorial” además de lo documentado por peterp_va.
En “Update the application page”,
cuarto punto dice:
An External API variable valled myPendingRequests with the value …/API/bdm/businessData/com.company.model.TravelRequest?q=findByUserAndStatus&p=0&c=10&f=userId={{myUserId}}&f=status=pending
deberĂ­a decir:
An External API variable valled myPendingRequests with the value …/API/bdm/businessData/com.company.model.TravelRequest?q=findByUserIdAndStatus&p=0&c=10&f=userId={{myUserId}}&f=status=pending

quinto punto dice:
An External API variable valled myApprovedRequests with the value …/API/bdm/businessData/com.company.model.TravelRequest?q=findByUserAndStatus&p=0&c=10&f=userId={{myUserId}}&f=status=Approved

deberĂ­a decir:
An External API variable valled myApprovedRequests with the value …/API/bdm/businessData/com.company.model.TravelRequest?q=findByUserIdAndStatus&p=0&c=10&f=userId={{myUserId}}&f=status=Approved

Thanks for the feedback! I’m actually updating the documentation and just found the same issue. Update should be available soon on official documentation page.

Hi Antoine,

Is the update available yet, and when will the release notes for 7.1.0 be available? :slight_smile:

thanks and regards
Seán

Hi Sean

Updated version of the tutorial is available in documentation .

I assume you speak about the release note of version 7.0.1. It is available here: http://www.bonitasoft.com/products/download/bonita-bpm-701-release-notes

Regards,

Antoine

Thanks and,

No I really meant 7.1.0… :slight_smile:

regards

Hi,

Can you share your process .bos file so I can try to reproduce the issue?

Thanks

I could solve, but now have other issue, when click in create a new travel request It appears error 404.

Where send or share? the file .bos? thank for you help