Data Model - is it possible to reference a field inside the same model?

This one is probably a little odd, but I’m not finding anything that indicates how to do this. I have a data model I’m creating for products (cheap e-commerce solution, :wink: ) and I’d like to be able to reference the price field in the model to build calculated discounts (i.e. annual subscription saves 10% off, so I’d do price * 12 * .1). I’m assuming state doesn’t exist in the data models, but is there a rough equivalent of this that I could use in the code to generate the values (so they’d be visible in the model itself)?

Hi @chtbks-jason

You can possibly use Change Hook(Available inside advanced option of model). So with change hook you will have access to price modal and then you can use js code to fetch price data and update lets say total price field on product data modal.

Give it a shot and let me know if you face any issues!

I’ll give that a shot. Thanks @garima

1 Like