SmartService Plugin - Output Parameter as CDT APNX-1-4047-0000

Certified Lead Developer

Does anyone have a good example of a plugin where the output of the smart service is a CDT that was defined by the plugin? bonus points if it's a nested CDT. 

I'm getting really close to getting this to work. I have the CDT being successfully created by the plugin, and the smart service shows the correct type on the output tab at design time. 

When I execute the process model, I get a runtime exception:

7:39:50,921 INFO  [stdout] (default-threads - 36) 2021-12-13 17:39:50,919 [default-threads - 36] ERROR com.appiancorp.suiteapi.common.TypedValueParameterConverter - Cannot convert TypedValue
17:39:50,921 INFO  [stdout] (default-threads - 36) java.lang.IllegalArgumentException: Argument is not an array
17:39:50,922 INFO  [stdout] (default-threads - 36)      at java.lang.reflect.Array.getLength(Native Method)
17:39:50,922 INFO  [stdout] (default-threads - 36)      at com.appiancorp.suiteapi.common.RecordConverter.convertParameter(RecordConverter.java:23)
17:39:50,922 INFO  [stdout] (default-threads - 36)      at com.appiancorp.suiteapi.common.TypeConverter.convertParameter(TypeConverter.java:28)
17:39:50,923 INFO  [stdout] (default-threads - 36)      at com.appiancorp.suiteapi.common.TypedValueParameterConverter.convertValue(TypedValueParameterConverter.java:115)
17:39:50,927 INFO  [stdout] (default-threads - 36)      at com.appiancorp.suiteapi.common.TypedValueParameterConverter.getBackendValue(TypedValueParameterConverter.java:79)
17:39:50,927 INFO  [stdout] (default-threads - 36)      at com.appiancorp.suiteapi.common.TypedValueParameterConverter.convert(TypedValueParameterConverter.java:52)
17:39:50,928 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.mapper.parameters.ArrayParameterConverter.convert(ArrayParameterConverter.java:25)
17:39:50,928 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.mapper.parameters.ParameterConversionMap.convert(ParameterConversionMap.java:18)
17:39:50,929 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.mapper.parameters.BeanParameterConverter.convert(BeanParameterConverter.java:50)
17:39:50,930 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.mapper.parameters.ParameterConversionMap.convert(ParameterConversionMap.java:18)
17:39:50,931 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.mapper.parameters.BeanParameterConverter.convert(BeanParameterConverter.java:50)
17:39:50,931 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.mapper.parameters.ParameterConversionMap.convert(ParameterConversionMap.java:18)
17:39:50,931 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.mapper.parameters.ParameterPreparer.prepareParameters(ParameterPreparer.java:64)
17:39:50,932 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.driver.ipc.RequestCall.setParams(RequestCall.java:84)
17:39:50,932 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.driver.ipc.RequestCall.<init>(RequestCall.java:32)
17:39:50,932 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.services.KougarServiceInvocationHandler$KInvocationHandler.invoke(KougarServiceInvocationHandler.java:173)
17:39:50,933 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.services.KougarServiceInvocationHandler.invoke(KougarServiceInvocationHandler.java:310)
17:39:50,933 INFO  [stdout] (default-threads - 36)      at com.appiancorp.services.ProcessKougarServiceInvocationHandler.invoke(ProcessKougarServiceInvocationHandler.java:54)
17:39:50,933 INFO  [stdout] (default-threads - 36)      at com.sun.proxy.$Proxy413.completeWork(Unknown Source)
17:39:50,934 INFO  [stdout] (default-threads - 36)      at com.appiancorp.ra.workpoller.WorkServiceImpl$FunctionCompleteWork.execute(WorkServiceImpl.java:362)
17:39:50,934 INFO  [stdout] (default-threads - 36)      at com.appiancorp.ra.workpoller.WorkServiceImpl.retry(WorkServiceImpl.java:432)
17:39:50,934 INFO  [stdout] (default-threads - 36)      at com.appiancorp.ra.workpoller.WorkServiceImpl.completeWork(WorkServiceImpl.java:303)
17:39:50,934 INFO  [stdout] (default-threads - 36)      at com.appiancorp.ra.workpoller.WorkItemListener.workCompleted(WorkItemListener.java:84)
17:39:50,940 INFO  [stdout] (default-threads - 36)      at org.jboss.jca.core.workmanager.WorkWrapper.run(WorkWrapper.java:236)
17:39:50,941 INFO  [stdout] (default-threads - 36)      at org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:33)
17:39:50,941 INFO  [stdout] (default-threads - 36)      at org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:808)
17:39:50,941 INFO  [stdout] (default-threads - 36)      at org.jboss.threads.QueueExecutor.access$100(QueueExecutor.java:45)
17:39:50,941 INFO  [stdout] (default-threads - 36)      at org.jboss.threads.QueueExecutor$Worker.run(QueueExecutor.java:849)
17:39:50,941 INFO  [stdout] (default-threads - 36)      at java.lang.Thread.run(Thread.java:745)
17:39:50,942 INFO  [stdout] (default-threads - 36)      at org.jboss.threads.JBossThread.run(JBossThread.java:122)
17:39:50,943 INFO  [stdout] (default-threads - 36) 2021-12-13 17:39:50,942 [default-threads - 36] ERROR com.appiancorp.suiteapi.common.TypedValueParameterConverter - unable to access property <value> in <class com.appiancorp.suiteapi.process.ActivityReturnVariable>
17:39:50,943 INFO  [stdout] (default-threads - 36) com.appiancorp.suiteapi.common.exceptions.AppianException: Invalid Type: java.lang.IllegalArgumentException: Argument is not an array (APNX-1-4047-000)
17:39:50,944 INFO  [stdout] (default-threads - 36)      at com.appiancorp.suiteapi.common.exceptions.AppianRuntimeException.<init>(AppianRuntimeException.java:52)
17:39:50,944 INFO  [stdout] (default-threads - 36)      at com.appiancorp.suiteapi.type.exceptions.InvalidTypeException.<init>(InvalidTypeException.java:43)
17:39:50,945 INFO  [stdout] (default-threads - 36)      at com.appiancorp.suiteapi.common.TypedValueParameterConverter.convertValue(TypedValueParameterConverter.java:122)
17:39:50,945 INFO  [stdout] (default-threads - 36)      at com.appiancorp.suiteapi.common.TypedValueParameterConverter.getBackendValue(TypedValueParameterConverter.java:79)
17:39:50,945 INFO  [stdout] (default-threads - 36)      at com.appiancorp.suiteapi.common.TypedValueParameterConverter.convert(TypedValueParameterConverter.java:52)
17:39:50,945 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.mapper.parameters.ArrayParameterConverter.convert(ArrayParameterConverter.java:25)
17:39:50,946 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.mapper.parameters.ParameterConversionMap.convert(ParameterConversionMap.java:18)
17:39:50,946 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.mapper.parameters.BeanParameterConverter.convert(BeanParameterConverter.java:50)
17:39:50,946 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.mapper.parameters.ParameterConversionMap.convert(ParameterConversionMap.java:18)
17:39:50,946 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.mapper.parameters.BeanParameterConverter.convert(BeanParameterConverter.java:50)
17:39:50,947 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.mapper.parameters.ParameterConversionMap.convert(ParameterConversionMap.java:18)
17:39:50,947 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.mapper.parameters.ParameterPreparer.prepareParameters(ParameterPreparer.java:64)
17:39:50,947 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.driver.ipc.RequestCall.setParams(RequestCall.java:84)
17:39:50,947 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.driver.ipc.RequestCall.<init>(RequestCall.java:32)
17:39:50,948 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.services.KougarServiceInvocationHandler$KInvocationHandler.invoke(KougarServiceInvocationHandler.java:173)
17:39:50,948 INFO  [stdout] (default-threads - 36)      at com.appiancorp.kougar.services.KougarServiceInvocationHandler.invoke(KougarServiceInvocationHandler.java:310)
17:39:50,948 INFO  [stdout] (default-threads - 36)      at com.appiancorp.services.ProcessKougarServiceInvocationHandler.invoke(ProcessKougarServiceInvocationHandler.java:54)
17:39:50,948 INFO  [stdout] (default-threads - 36)      at com.sun.proxy.$Proxy413.completeWork(Unknown Source)
17:39:50,956 INFO  [stdout] (default-threads - 36)      at com.appiancorp.ra.workpoller.WorkServiceImpl$FunctionCompleteWork.execute(WorkServiceImpl.java:362)
17:39:50,956 INFO  [stdout] (default-threads - 36)      at com.appiancorp.ra.workpoller.WorkServiceImpl.retry(WorkServiceImpl.java:432)
17:39:50,956 INFO  [stdout] (default-threads - 36)      at com.appiancorp.ra.workpoller.WorkServiceImpl.completeWork(WorkServiceImpl.java:303)
17:39:50,956 INFO  [stdout] (default-threads - 36)      at com.appiancorp.ra.workpoller.WorkItemListener.workCompleted(WorkItemListener.java:84)
17:39:50,957 INFO  [stdout] (default-threads - 36)      at org.jboss.jca.core.workmanager.WorkWrapper.run(WorkWrapper.java:236)
17:39:50,957 INFO  [stdout] (default-threads - 36)      at org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:33)
17:39:50,957 INFO  [stdout] (default-threads - 36)      at org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:808)
17:39:50,957 INFO  [stdout] (default-threads - 36)      at org.jboss.threads.QueueExecutor.access$100(QueueExecutor.java:45)
17:39:50,957 INFO  [stdout] (default-threads - 36)      at org.jboss.threads.QueueExecutor$Worker.run(QueueExecutor.java:849)
17:39:50,958 INFO  [stdout] (default-threads - 36)      at java.lang.Thread.run(Thread.java:745)
17:39:50,958 INFO  [stdout] (default-threads - 36)      at org.jboss.threads.JBossThread.run(JBossThread.java:122)
17:39:50,958 INFO  [stdout] (default-threads - 36) Caused by: java.lang.IllegalArgumentException: Argument is not an array
17:39:50,958 INFO  [stdout] (default-threads - 36)      at java.lang.reflect.Array.getLength(Native Method)
17:39:50,958 INFO  [stdout] (default-threads - 36)      at com.appiancorp.suiteapi.common.RecordConverter.convertParameter(RecordConverter.java:23)
17:39:50,959 INFO  [stdout] (default-threads - 36)      at com.appiancorp.suiteapi.common.TypeConverter.convertParameter(TypeConverter.java:28)
17:39:50,959 INFO  [stdout] (default-threads - 36)      at com.appiancorp.suiteapi.common.TypedValueParameterConverter.convertValue(TypedValueParameterConverter.java:115)
17:39:50,959 INFO  [stdout] (default-threads - 36)      ... 26 more

My output looks like this in the code:

@Type(namespace="https://mynamespace/suite/types/", name="MyCustomResultSet")
@Name("result")
public TypedValue getResult() {
return result;
}

Don't know why it's complaining about an array. I verified I can access result.getValue() after I set the value earlier in the code. 

  Discussion posts and replies are publicly visible