NS AdminA
09/25/2024, 2:59 PMCeligo AI
09/25/2024, 3:00 PMAI generated answer (using internal Slack threads):Based on the conversations, it seems you want to filter the custom field 'custbody1' to only show vendors starting with 'V-' in their name. This can be achieved by creating a client script that filters the vendors based on the condition you specified. Here is a general idea of how you can achieve this: 1. Create a client script that will be triggered on field change or field source of 'custbody1'. 2. In the script, you can use the
record.getCurrentSublistValue
method to get the current value of the 'custbody1' field.
3. Then, you can use the search.create
method to create a search on the vendor records. In the filters of the search, you can specify that the vendor name should start with 'V-'.
4. Once you get the results of the search, you can use the Field.removeSelectOption
method to remove all the current options of the 'custbody1' field.
5. Then, you can use the Field.insertSelectOption
method to add the vendors that start with 'V-' to the 'custbody1' field.
Here is a pseudo code example:
javascript
function fieldChanged(context) {
if (context.fieldId === 'custbody1') {
var currentVendor = context.currentRecord.getCurrentSublistValue({
sublistId: 'item',
fieldId: 'custbody1'
});
var vendorSearch = search.create({
type: search.Type.VENDOR,
filters: [
['entityid', 'startswith', 'V-']
],
columns: ['entityid']
});
var vendorSearchResult = vendorSearch.run().getRange({start: 0, end: 1000});
for (var i = 0; i < vendorSearchResult.length; i++) {
var vendorId = vendorSearchResult[i].getValue('entityid');
context.currentRecord.getField({fieldId: 'custbody1'}).removeSelectOption({value: vendorId});
}
for (var i = 0; i < vendorSearchResult.length; i++) {
var vendorId = vendorSearchResult[i].getValue('entityid');
context.currentRecord.getField({fieldId: 'custbody1'}).insertSelectOption({
value: vendorId,
text: vendorSearchResult[i].getText('entityid')
});
}
}
}
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
09/25/2024, 3:01 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.821898043
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.821526349
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.81352967
Celigo AI
09/25/2024, 3:01 PM