Update constant smart service Invalid Cast: Cannot cast from type 'Document' to type 'Content Constant'

I am getting the error:

Details:  Invalid Cast: Cannot cast from type 'Document' to type 'Content Constant' (Data Inputs)

When trying to replace the constant contents, which is a constant that is a list of Documents. How do I fix?

It doesn't work for replace version yes nor no. 

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Lead Developer
    in reply to ginao0001

    As David indicated - for the smart service to work, you have to select the constant from the picker.  I'm not sure if there's any way to do it via the expressionable editor (which is what you probably did) which would work.  The problem this creates is, when the process goes to update the constant, instead of seeing a *reference to the constant* (which you'd get from the constant picker), instead it's evaluating the constant and returning its value - hence your error message.

Children
  • I'm a bit confused - this sounds the opposite of the screenshot David provided, but I tried the selecting from my constants in the env as you suggested and it worked. This process model needs to update 1-3 constants depending on a condition though, and I am testing the updating 2 constants - it throws the same error even though I updated the second one the same way. How can we update multiple constants in the same process model?

  • 0
    Certified Lead Developer
    in reply to ginao0001

    The best I can suggest is that you might need to configure an Update Constant node unique to each Constant which you need to update - and use in-process logic (gateways, etc) to decide which one(s) to execute at a given time.  For the error you're still getting, you probably need to make sure the type of data you're passing into the node for the new constant value exactly matches the constant's type (which would include both data type as well as list/single).