Skip to main content
May 15, 2025
Question

can we pass constant to process model as process parameter?

  • May 15, 2025
  • 5 replies
  • 0 views

I want to create a generic process model for update constant. I used update constant smart service as it required constant as input which is of type content constant. so i want to pass constant as process parameter.

is it possible or is there any other way to do this?

    5 replies

    stefanhelzle0001
    May 15, 2025

    No, passing a reference to a constant as a process variable is not supported. Making this a generic process will not work.

    May 15, 2025
    i want to pass constant as process parameter.

    There is no variable type called content constant, so its not possible

    varuntejg243705
    May 15, 2025

    Hi [mention:07a26341b0094b23b9aa068de0a694b2:e9ed411860ed4f2ba0265705b8793d05] ,

    When you try to pass as mentioned you will get Null as Constant ID in the Update Constants inputs.


    So It's not possible to do that thing!

    mathieud0001
    May 15, 2025

    I would as a general rule avoid updating constants and would suggest using a database field instead. Updating a constant creates a new version and having many versions of an object can cause performance issues down the line.

    mikes0011
    Brainy
    May 15, 2025

    I echo Mathieu's warning that it's a good idea to not update general-use constants procedurally, except in rare special cases where you have a strong reason.  I would point out, though, that the modern version of the Update Constant service actually does have a way to turn off "new versions", i.e. you can force a straight-up overwrite, which could be useful for constants that act merely as flags / toggles, where no version history would ever be relevant or useful.

    A while ago I figured out a way to update constant by name (if you have a way of passing a valid constant name into your subprocess) - this uses a combo of tricks to look up the constant's ID (note this requires at least one plugin), and the ID is passed to the smart service in lieu of a direct reference to the constant.  Keeping the new data type in line with the constant you're updating will be up to you - use at your own risk i guess [emoticon:ad09a845b95e4cb28c5d9684a032037c]

    extract(
      getcontentdetailsbyuuid(
        getconstantorruleuuidbyname("TEST_CONST_FOR_UPDATE")
      ),
      "Id: ",
      ", Parent:"
    )