Error while creating Function in BPM Studio 10.3.1.0

I want to create a function which returns a String. To achieve this I have followed the below steps –

1) Created a Method in BPM studio 10.3.1.0 by navigating through Catalogue component->BPM Object->Right click on the BPM object and select New Method->Give any name for method. (I gave “sample_Method“).

2) “sample_Method” method window opened in the BPM studio.

3) As my method should return a string, I placed my code in the “sample_Method” method window as below –

String strMsg = “The String to be returned”;
return strMsg;

But after I place the above code and when compiled an error message saying “return statement can only be present in functions.” was displayed in BPM studio.

I tried many options but was unable to fix this error. After lot of struggle and research finally I was able to fix this issue.

In order to return a string from a method, we need to create a Function. To know how to create a Function from a Method, please click here.

Only Function can return something, but not a Method. So by defining the Return Type, a Method becomes a Function.

Advertisements
This entry was posted in Oracle Business Process Management (BPM) and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s