BPM, Workflow, and Case

 View Only

 Process instance caseProps issue using jsFunction_createDiscretionaryActivityWithProps

Szymon Wislocki's profile image
Szymon Wislocki posted Thu October 02, 2025 08:10 AM

Hello,

so in our project, I tried using tw.system.createDiscretionaryActivityWithProps to create a process-based activity for a case throughout its lifecycle – after it's created and after the user requests it (after the previous instance has finished, of course).
 
However, we're having a problem with this method: each subsequent activity, except the first one, corrupts the case object (tw.local.caseProperties). Even though it has all the case property keys and its structure (displayName, value), each value is empty. In reality, the case (e.g., in the preview) works correctly and has all the values ​​provided, but they've disappeared within the activity instance, so it doesn't work correctly.
 
Our use case (for each run, incl. first instance):
const lsOfKeys = new tw.object.listOf.String
lsOfKeys[0] = 'CRU_Step'
const lsOfVals = new tw.object.listOf.String
lsOfKeys[0] = 'Registration'
tw.system.createDiscretionaryActivityWithProps(
  CASE_ID,
  TOS_ID,
  ACTIVITY_NAME,
  lsOfKeys,
  lsOfVals,
  true
)
Has anyone else encountered a similar problem? Should this be considered a bug, or does this method simply require some implementation approach?