How to update a constant programmatically

I have a list of constants and want to update them all one at a time. I'm using the smart service to update constants but it seems to require me to manually specify the constant to update. 

I tried doing the following.

In my form I have the data subset in my form which I use to set the value

 
  local!scoreData: todatasubset(
    {
      {parameter:"Change Management Complexity Simple", value: cons!BPMT_VAL_NEW_PROCESS_EFFECTIVENESS_SIMPLE_VALUE, consName: " BPMT_VAL_NEW_PROCESS_EFFECTIVENESS_SIMPLE_VALUE"}, 
      {parameter:"Change Management Complexity Moderate", value: cons!BPMT_VAL_NEW_PROCESS_EFFECTIVENESS_MODERATE_VALUE, consName: "BPMT_VAL_NEW_PROCESS_EFFECTIVENESS_MODERATE_VALUE"}, 
      {parameter:"Change Management Complexity High", value: cons!BPMT_VAL_NEW_PROCESS_EFFECTIVENESS_HIGH_VALUE, consName: "BPMT_VAL_NEW_PROCESS_EFFECTIVENESS_HIGH_VALUE"},   
      {parameter:"Effectiveness Simple", value: cons!BPMT_VAL_CHANGE_MGMT_COMPLEXITY_SIMPLE_VALUE, consName: "BPMT_VAL_CHANGE_MGMT_COMPLEXITY_SIMPLE_VALUE"}, 
      {parameter:"Effectiveness Moderate", value: cons!BPMT_VAL_CHANGE_MGMT_COMPLEXITY_MODERATE_VALUE, consName: "BPMT_VAL_CHANGE_MGMT_COMPLEXITY_MODERATE_VALUE"}, 
      {parameter:"Effectiveness High", value: cons!BPMT_VAL_CHANGE_MGMT_COMPLEXITY_HIGH_VALUE, consName: "BPMT_VAL_CHANGE_MGMT_COMPLEXITY_HIGH_VALUE"}, 
      {parameter:"Cost reduction Threshold 1", value: cons!BPMT_VAL_250K, consName: "BPMT_VAL_250K"},
      {parameter:"Cost reduction Threshold 2", value: cons!BPMT_VAL_1M, consName: "BPMT_VAL_1M"}
    }
  ),

I created a loop in the process model to grab one item at a time and pass it into the smart service node in the following way.

constant:

getconstantorruleuuidbyname(index(index(pv!scoreData.data, "consName", null),pv!counter,null))

value:

=index(index(pv!scoreData.data, "value", null),pv!counter,null)

If I run this I get the following error: "The constant specified is invalid or does not exist. Constant ID: -2,147,483,647". It doesn't like that I'm passing the uuid instead of an actual constant.

Is there a way to get around this?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    I've done something like this before, and without seeing your full code (and without access to my previous code at the moment) I'm not sure what the disconnect might be, but I'm fairly sure that it's possible to do this with the right combination of plug-ins and finesse.

    Just to double-check, and this probably isn't it, but FYI your first "consName" has a leading space in its value - that might(?) be throwing something off.

Reply
  • 0
    Certified Lead Developer

    I've done something like this before, and without seeing your full code (and without access to my previous code at the moment) I'm not sure what the disconnect might be, but I'm fairly sure that it's possible to do this with the right combination of plug-ins and finesse.

    Just to double-check, and this probably isn't it, but FYI your first "consName" has a leading space in its value - that might(?) be throwing something off.

Children
No Data