How can I add a custom field to a pricelevel
# ask-stanley-ai
t
How can I add a custom field to a pricelevel
c
AI generated answer (using internal Slack threads):
To add a custom field to a price level, you would need to use SuiteScript or a workflow. However, it's important to note that you cannot directly add a custom field to a price level. Instead, you can create a custom field on the item record and then use a script or workflow to populate that field based on the price level. Here's a general approach: 1. Create a custom field on the item record. This field will hold the value from the price level that you want to capture. 2. Create a script or workflow that triggers when the price level changes. This script or workflow should get the value from the price level and set it in the custom field you created in step 1. For example, in a client script, you could use the
fieldChanged
entry point to trigger the script when the price level changes. In the script, you would get the new price level value and set it in the custom field. Here's a pseudo-code example:
Copy code
javascript
function fieldChanged(context) {
    if (context.fieldId === 'price') {
        var priceLevel = context.newValue;
        var itemRecord = context.currentRecord;
        itemRecord.setValue('custitem_my_custom_field', priceLevel);
    }
}
In this example,
custitem_my_custom_field
is the ID of the custom field you created on the item record. This script sets the value of the custom field to the new price level whenever the price level changes. ****** 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.82264936
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.819759369
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.819167912
Please provide your feedback on this answer.