As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
// This is a groovy task // The object "applicationSpecificApi" is injected into the script binding by us, similar to the object "execution" def approvedAmount = execution.getVariable("amount"); def approvedBy = execution.getVariable("user_id"); applicationSpecificApi.authorizeSpending (approvedAmount, approvedBy);
protected void initScriptingEngines() {<br> if (resolverFactories==null) {<br> resolverFactories = new ArrayList<ResolverFactory>();<br> resolverFactories.add(new VariableScopeResolverFactory());<br> resolverFactories.add(new BeansResolverFactory());<br> }<br> if (scriptingEngines==null) {<br> scriptingEngines = new ScriptingEngines(new ScriptBindingsFactory(resolverFactories));<br> }<br>}
// While creating the engine<br>Map<Object, Object> beans = new HashMap<Object, Object>();<br>beans.put("myservice", new MyService());<br>((ProcessEngineConfigurationImpl)config).setBeans(beans);<br><br>// In a script task<br>myservice.callMyFunction()