Block users from updating Rate on Order Items scre...
# ask-stanley-ai
m
Block users from updating Rate on Order Items screen
c
AI generated answer (using internal Slack threads):
To block users from updating the Rate on the Order Items screen, you would need to create a script that disables the rate field on the transaction line. You might also want to disable the total amount field. Here is a sample script that disables the quantity field if the status of the record is 'fullyBilled'. You can modify this script to disable the rate field instead:
Copy code
javascript
/**
 * @NApiVersion 2.x
 * @NScriptType UserEventScript
 */
define(['N/ui/serverWidget'],
    function(serverWidget) {
        function beforeLoad(scriptContext) {
            var record = scriptContext.newRecord;
            var status = record.getValue('statusRef');

            if(status === 'fullyBilled'){
                scriptContext.form.getSublist('item').getField('rate').updateDisplayType({displayType: serverWidget.FieldDisplayType.DISABLED});
            }
        }
        return {
            beforeLoad: beforeLoad
        };
    });
This script should be deployed to the roles that you want to restrict. ****** 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.80186969
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.791107
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.790611267
Please provide your feedback on this answer.
Thank you for your feedback
Thank you for your feedback