Does anyone know how to cast the return of method getRunningValue of a ProcessVa

Does anyone know how to cast the return of method getRunningValue of a ProcessVariableInstance object to a CDT? I am getting the ProcessVariableInstance and its instanceType is my CDT. I have imported the CDT into Eclipse. But i am getting a ClassCastException when i try to do the following:

ProcessVariableInstance pviProposal = pes.getProcessVariable(process.getId(), "proposal");
Proposal proposal = (Proposal) pviProposal.getRunningValue();

Thank a lot...

OriginalPostID-97898

OriginalPostID-97898

  Discussion posts and replies are publicly visible

  • Hi mimar,
    Are you able to achieve this.
    If yes, could help me how you cast the return of method in case of CDT's and primitive type objects ?
  • Hello Mahipalc,
    Yes i managed to solve this issue using the CDTHelper classes. You can find them in Portal to SAIL plugin. I just import and use them in my plugin.
    Have a look at it and if you need any more help or information i will certainly try to help you.
  • Thanks for your help mimar.
    Actually am just trying to return the o/p of getRunningValue(), but facing below error:
    ---------
    'The Function Module com.appian.pkg.GetProcessVariables could not be installed due to invalid type: Invalid Type: Unable to determine type with QName of [{http://www.appian.com/ae/types/2009}Long]. Use the @Type annotation to indicate the type of a function parameter. The deprecated ’type’ attribute for the @Parameter annotation has been removed
    ---------
    If you know, could you tell me how to define Type attribute in case of "Primitive return types" and "CDT's".
  • From the error above i understand that your function is not installed at all. Are you using a deprecated version of the plugin due to CDT change?
    If so try to add the following annotation:
    @Type(namespace = <cdt namespace>, name = <The old CDT name e.g. CDT^1>)

    I am not sure if this can help...
  • Yes, the function is not installed at all. Am just retrieving process variable values (of a process) by getRunningValue(). Am not sure what could be the return type of my function in this case, becuase i dont know what would be the type of process variable.
    Even I tried by keeping "String" as return type of the function. Still getting above "@Type" annotation error.
    Could you tell how to configure @Type for primitives (whatever you said is for CDT's)