Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Sheet Worker event when repeating section row is added?

I see in the docs there are Sheet Worker events when a row in a repeating section is removed or changed but there is no event for when a row is created. Is this correct? If I want something to happen only on row creation is there a good way to do that? I tried using the change event but looking at the `eventInfo` object there doesn't appear to be any way to discern if it's an update or a newly created row... 
1611000142
Finderski
Pro
Sheet Author
Compendium Curator
If you set the default value to something that should only happen during character creation, you should be able to use eventInfo.previousValue to determine if it's a change. But, yeah, I'm not aware of a specific "create" or "new" event like there is for remove.
Hmm, yeah, that's a good idea. It might work to add a hidden `isNew` attribute initially set to true or something and check that then set it to false in the Sheet Worker. Really weird there isn't an event for row creation though.
1611029202
GiGs
Pro
Sheet Author
API Scripter
Its because the row isnt actually created until you save an attribute within it. You can see this for yourself on a character sheet. Click Add to add a new row to the section: at this point, you'll see the rows inputs, selects and so on appear. But if you then tab away or click elsewhere on the sheet, that row will vanish.  Because with nothing saved to it, it doesnt yet exist.