Calculated field value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 03:43 PM
Hi All,
I have a scenario and I would like to confirm if it is possible or not.
In the entitlements section, I added a field called (Top up tokens) as shown below:
The logic is when we want to add more tokens/entitlement to the customer, instead of doing it manually and adding it to the Total Units & Remaining Units, to go and add it to the top up tokens then it will reflect on the relevant fields.
For example:
Total Units = 1000
Remaining Units = 1000
and we want to add 200, so if I add 200 to the field (Top up tokens) the system should add this 200 to the total units to be 1200 and to the remaining units to be 1200.
Total Units = Total units + Top up tokens
Remaining Units = Remaining Units + top up tokens.
I used the (calculated value field) (GlideAggregate) but it did not work because the result will be added to one of the variables.
Any thoughts?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2024 12:42 AM
What exactly happened?
Are the fields of the same type? A simple BR or client script should do the trick, assuming your are adding the same type (calculating from a string onto a numeric field will mean that you have to create a numeric value of the string).
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2024 12:56 AM
Hi Mark,
Yes, both fields are (Integer) and this is the calculation script that I am using:
However, when I add a value to the field (Top-up tokens) e.g., 200, the calculation adds triple this number to the (Total Units) field as shown below:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2024 04:26 AM
Check all other rules/scripts/flows that do something with the 'total' field. Maybe another calculation is colliding with yours?
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2024 04:47 AM
Thanks Mark,
I do not see any rules, scripts, flows, etc that can impact it. So, instead of using the (calculated value/field) I created a business role as shown below and it works perfectly fine except for one issue which is:
When I add any number to the field (top up tokens) it gets added to the field (Total units) as expected. but if I add the same number, it does not work. e.g., if I add 1000 then save and I try to add 1000 again it does not work, if I add any other number it works fine.
Somehow, when I want to add the same value of last time, the system does not consider it a change and it does not add it which could be useful in most scenarios but not in mine. I also removed the object (previous) from the code but it did not resolve the issue.