Set default value using in custom table using other filed

Mateusz Żebrowski asked on December 2, 2014 11:00

I've created table with two fields ItemID and ParentID. I'd like to set default value of ParentID on ItemID (for porpose of sorting). I've try using macro but typing {%ItemID} don't give expected results. So how can I do i t?

Correct Answer

Brenden Kehren answered on December 2, 2014 13:36

You could just include the ItemOrder field by default (when creating the custom table) and already have your sort field setup for you. This will automatically pick the next largest number which should follow very closely with your ItemID (unless you reorder them). Also, this will allow you to resort using the out of the box functionality vs. having to code for it. If you don't choose this way, I'd highly recommend a global handler as Sandro mentioned.

1 votesVote for this answer Unmark Correct answer

Recent Answers

Sandro Jankovic answered on December 2, 2014 12:27


One valid approach could be to use a global handler to update the table after the record has been saved as explained in this forum post. More information is available in the documentation.

Please let me know if you have any additional questions or concerns.

Best Regards,


1 votesVote for this answer Mark as a Correct answer

Mateusz Żebrowski answered on December 2, 2014 18:20

Both of you have good idea. Thanks.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.