Hello All, Currently I am working on a plugin where i need to set valu

Hello All,
Currently I am working on a plugin where i need to set value for "ProcessVariable" object, to pass into "ProcessStartConfig" object. But ProcessVariable setValue() function is deprecated as it origins from the TypedVariable. Even though it's working fine , since it's deprecated is there any other way to set the value other than using setValue() for ProcessVariable. or is it fine to use this function ?

OriginalPostID-228642

OriginalPostID-228642

  Discussion posts and replies are publicly visible

  • Example:

    TypedValue typedValue = new TypedValue(Long.valueOf(AppianType.INTEGER), new Long(100));
    NamedTypedValue namedTypeValue = new NamedTypedValue(typedValue,"anIntegerNumberPV");
    ProcessVariable pvInstance = new ProcessVariable(namedTypeValue);
  • Thanks Eduardo, For creating new variable this one looks fine , but i want to assign the value to the existing ProcessParameter. I tried creating the new ProcessVariable similarly and tried to assign the name ,value and instance and then passed it as ProcessParameter but it doesn't accept it. any other suggestion for existing process variable?
  • I am not creating new variables. They are variables that my process model already has. I am just creating the abstraction of those variables for my Java code to be able to identify them by Name.

    Here's how I start a process that requires 3 pv's. I am populating those pv's



    ProcessVariable[] processVariables = new ProcessVariable[3];

    TypedValue typedValue = new TypedValue(Long.valueOf(AppianType.INTEGER), new Long(100));
    NamedTypedValue namedTypeValue = new NamedTypedValue(typedValue,"anIntegerNumber");
    ProcessVariable pvInstance = new ProcessVariable(namedTypeValue);
    processVariables[0] = pvInstance;


    typedValue = new TypedValue(Long.valueOf(AppianType.STRING), new String("fromAPI"));
    namedTypeValue = new NamedTypedValue(typedValue,"wMyOtherText");
    pvInstance = new ProcessVariableInstance(namedTypeValue);
    processVariables[1] = pvInstance;


    typedValue = new TypedValue(Long.valueOf(AppianType.STRING), new String("fromAPI2"));
    namedTypeValue = new NamedTypedValue(typedValue,"zMyText");
    pvInstance = new ProcessVariableInstance(namedTypeValue);
    processVariables[2] = pvInstance;

    ProcessStartConfig config = new ProcessStartConfig();
    config.setProcessParameters(processVariables);

    pds.initiateProcess(processModelId, config);
  • Thanks Eduardo , It seems to be working fine. I should have missed something at first time.