This is not a question but would like to share something which might be helpful

This is not a question but would like to share something which might be helpful for others.
Use Case: You have a CDT with few elements and a SAIL form which displays the elements. You want to add new elements to the CDT and update the new element to the SAIL form. But doing this will break the Sail form for the inflight tasks which are having the older versions of the CDT and doesn’t have the new element in it.
Example: You have a “Customer_Address” CDT with below structure
          MailingAddress (Customer_Address)
                                        Id (Number (Integer))
                                        LineOne (Text)
                                        LineTwo (Text)
                                        City (Text)
                                        State (Text)
                                        Country (Text)

Now you want to add the element zip code to it and make it as
          MailingAddress (BW_CMPO_Address)
                                        Id (Number (Integer))
                                        LineOne (Text)
                                        LineTwo (Text)
                                        City (Text)
                                        State (Text)
Zipcode (Number (Integer))
                                        Country (Text)

                                        
Now if you directly refer the zi...

OriginalPostID-174264

OriginalPostID-174264

  Discussion posts and replies are publicly visible

  • ...pcode in your SAIL code, the older tasks would break. The following SAIL code would not cause any issues.
    if(
    rule!CheckIfTrue(
    index(
    ri!MailingAddress,
    "Zipcode",
    true
    )
    ),
    {},
    a!textField(
    label: "Zip Code",
    instructions: "",
    labelPosition: "ADJACENT",
    value: ri!MailingAddress. Zipcode
    )
    )

    The index function above would return true when the element is not found and so the text field will not be displayed. For tasks with new version of the CDT, the index function above will return the Zipcode value (if the value is null, it will return null value) and so the text field will be displayed.
    I am sure many already know this but I hope this is helpful to someone. If someone have any better ways of doing this, please feel fre...
  • Just getting started on SAIL forms but I have been using an integer process variable as a "version" identifier that I increment when I make a change that might have the type of effect you describe. In my case a newer version of a subprocess may get called so I pass the version variable to use in the subprocess to determine whether to include the new field or not. Has been effective in isolating changes in the portal environment so it should work as well for SAIL form code.
  • Thanks for sharing madhan. Though using iVersion identifier is the commonly used approach as robins suggested, your idea might help people who have not defined this process variable until now.