I have a need to do something very simple: use a calculated field to read the retail price ("price") of a product and multiply is by a percentage.
So I've set up the N:1 relationship between my custom entity and the product entity, selected the required product and now I'm working on a calculated field to take the product price from the list price of the product, multiply it by 0.9 and display it in a field.
Everything I have read says that if I use this "new_membershiplevel.price * 0.5" in the calculated field then the list price of the product will be multiplied by 50% and the value placed in this currency field.
I can't see any errors anywhere and this is something I have done successfully before, so is this a bug, or have I made a mistake?
Thanks,
Simon
*This post is locked for comments
I'm ebarassed to say I've found the answer to this issue! In case anyone else hits the same issue, the problem was that I didn't have the currency field on the form. As it is a custom entity, the currency field is not added by default and it appears that for any calcuation to work on a currency type field, the currency needs to be set. Which makes sense, I guess.
Ahhh sorry - probably a good idea!
Problem is that there is nothing coming through into the calculated field in the custom entity. This is regardless of whether I just push the contents of the "list price" field or put a calculation on it.
I need to use the list price as this is being updated from the Sage accounts system, so price lists are not really an option.
I think it's more conventional to use a price list to execute this strategy but, what is the problem? You've shown the configuration but not mentioned what's wrong.
ps- on the SDK side, such an operation would require one to execute currency.Value (money to decimal) before doing any math and then converting it back: new Money(price.Value*0.5)
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156