how to check if field does not exist in old CDT

Let's say I have a CDT with two mandatory fields, A and B, used in forms in a long process. 

I then add another mandatory field C in the CDT and the interface. For processes that started after the field was added, there will be no problem.

For in-flight processes that started before, the CDT is an older version without the new Field C. Therefore it can't save on the form and the user is stuck. Updating the CDT in all the inflight processes manually is not possible.

I would like to a) use an expression to check if Field C exists in outdated CDT, if it doesn't then hide that section in the interface or b) bulk update all the CDTs in flight to the latest version without interrupting the process. 

Thanks,

Tommy

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    The way I've handled this before is to pass in a new parameter to the form, i.e. ri!isNewVersion (or ri!hasFieldXYZ), where the process model is updated to pass a value of true() into the form, so that you can use in-form logic to tell whether you're in a new instance or not. The nomenclature is completely up to you but hopefully you get the picture.
  • Expanding on Mike's suggestion, what I usually do here is add a field to the CDT during the next update, integer value, named "version". Set this in the CDT at process initiation, I use a pv!version variable, set at 2 at this time and save into your CDT prior to any Write to DS (usually script task at the very beginning). When utilizing the pv! you can increment this value in the model any time you will be adding CDT fields or making changes that affect how your forms or sub processes will process going forward.

    On your forms, utilize a local version variable with the definition:

    local!version: index(ri!CDT,"version",1)

    This will default to 1 if the version field is not present (legacy instances), or reflect 2 for newer instances. From there, you can implement logic in the form processing based on which version of your CDT is present, without manipulating any running instances, such as, if(local!version>1, show new fields, do nothing). This allows scalability on your future versioning as well.
Reply
  • Expanding on Mike's suggestion, what I usually do here is add a field to the CDT during the next update, integer value, named "version". Set this in the CDT at process initiation, I use a pv!version variable, set at 2 at this time and save into your CDT prior to any Write to DS (usually script task at the very beginning). When utilizing the pv! you can increment this value in the model any time you will be adding CDT fields or making changes that affect how your forms or sub processes will process going forward.

    On your forms, utilize a local version variable with the definition:

    local!version: index(ri!CDT,"version",1)

    This will default to 1 if the version field is not present (legacy instances), or reflect 2 for newer instances. From there, you can implement logic in the form processing based on which version of your CDT is present, without manipulating any running instances, such as, if(local!version>1, show new fields, do nothing). This allows scalability on your future versioning as well.
Children