in fieldChanged function, after changing value of ...
# ask-stanley-ai
t
in fieldChanged function, after changing value of item sublist's rate field, how i get the value of the new total
c
AI generated answer (using internal Slack threads):
In the
fieldChanged
function, after changing the value of the item sublist's rate field, you can get the value of the new total by using the
getCurrentSublistValue
method on the
currentRecord
object. Here is a sample code snippet:
Copy code
javascript
function fieldChanged(context) {
    var currentRecord = context.currentRecord;
    var sublistName = context.sublistId;
    var fieldName = context.fieldId;

    if (sublistName === 'item' && fieldName === 'rate') {
        var newTotal = currentRecord.getCurrentSublistValue({
            sublistId: sublistName,
            fieldId: 'total'
        });
        console.log('New Total: ', newTotal);
    }
}
In this code,
fieldChanged
is a function that is triggered when a field value is changed. The
context
object contains information about the current record, the sublist id, and the field id. If the sublist is 'item' and the field that was changed is 'rate', then it gets the new total value from the 'total' field in the 'item' sublist and logs it to the console. Please note that this code assumes that the 'total' field is available in the 'item' sublist and that it is updated automatically when the 'rate' field is changed. If this is not the case, you may need to calculate the new total manually based on the new rate and the quantity. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.80981946
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.806106
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.804103673
Please provide your feedback on this answer.