Updating an Existing Property on Workflow vote

Hello,

After a user votes on a workflow, I want to update an existing property (_conversation_history). The code below is what I am using.

It appears that the code is generating the correct string in the variable (newconvo)), but it is not updating the property on the item?

Innovator inn = this.getInnovator();
Item controlledItem = this.apply("GetControlledItem");
if (controlledItem.isError()) {
return inn.newError("smc_TechInquiry_Notifications: Retrive Workflow: Unexpected error: " + controlledItem.getErrorString());
}
// get the message from requestor and reply to requestor

string messagefrom = controlledItem.getProperty("_message_from_requestor", "");
string replyTo = controlledItem.getProperty("_reply_to_requestor", "");
string history = controlledItem.getProperty("_conversation_history","");

string newconvo = history + " " + messagefrom + " " + replyTo;

string message = controlledItem.getPropertyCondition("_conversation_history");
this.setProperty("_conversation_history",newconvo);

return this;

Thank you for your help!

Parents
  • I don´t see any "apply" in your code. You set the Property, but only to the temporary context. You don´t seem to use edit/apply to actually save your new value. 

    And I see a second problem. As far as I understand you want to update your history value:

    You use this line to get the value:

    string history = controlledItem.getProperty("_conversation_history","");

    But that line to update the value:

    this.setProperty("_conversation_history",newconvo);

    In your context "this" represents the "Activity" item while controlledItem represent your change process. 
    I am not sure if controlledItem.setProperty in combination with edit/apply would work, cause the controlled item is something generated by the helper function. But you can give it a try. 

    If it doesn´t work, get the id of the controlledItem and do a direct edit of the Change process.

Reply
  • I don´t see any "apply" in your code. You set the Property, but only to the temporary context. You don´t seem to use edit/apply to actually save your new value. 

    And I see a second problem. As far as I understand you want to update your history value:

    You use this line to get the value:

    string history = controlledItem.getProperty("_conversation_history","");

    But that line to update the value:

    this.setProperty("_conversation_history",newconvo);

    In your context "this" represents the "Activity" item while controlledItem represent your change process. 
    I am not sure if controlledItem.setProperty in combination with edit/apply would work, cause the controlled item is something generated by the helper function. But you can give it a try. 

    If it doesn´t work, get the id of the controlledItem and do a direct edit of the Change process.

Children
No Data