Forum Discussion

shwnhlgn's avatar
shwnhlgn
Ideator III
9 years ago

Changing Default Functions When an Item is Saved

I want to have a time stamp for each unique Related Item for a particular Item. So I set up a simple method to save the parent, any time a specific field is changed on the related item. That way the modified_on field is accurate to the minute. The issue is I do not want the form to reset to default on every save. I just want it to stay as is. Any suggestions?  

2 Replies

  • Do you have to use the modified_on property for your tracking? If not, then you could create another date and time field on the parent item. Hook a method on after add of the relationship itemtype where the method updates the property on the parent. The updating of the parent may be a little tricky. If using regular methodologies do not work, then you might have to use SQL to do it. As long as the parent property is not editable by the user then SQL update is less concerning. Dennis
  • Thanks for the feedback Dennis. I am using the modified_on property currently. I think I have a solution that works for me. I attached a method to a boolean field that simply saves the related item upon edit. And the modified_on field shows the time is was edited. For some reason the save method attached to the boolean didn't move the parent back to the default view like the string data field did. I previously tried a custom data field with date and time but it was relatively slow to populate. I'll look at using SQL for future solutions if this comes up again.