Sayeed Hossen Bappy
04/21/2025, 9:41 AMCeligo AI
04/21/2025, 9:41 AMAI generated answer (using internal Slack threads):To achieve this, you can use a SuiteScript to dynamically populate the dropdown list. You can create a SuiteScript that runs on the form and populates the dropdown list with the values from the 'Sample Request' custom record. The script should also check the 'Sample Tracking Form' custom record to see which 'Sample Request' values have already been selected, and exclude those from the dropdown list. This can be done by performing a search on the 'Sample Tracking Form' custom record and comparing the results with the 'Sample Request' values. Here is a basic example of how you might do this:
javascript
function beforeLoad(type, form, request){
if(type == 'create'){
var sampleRequestField = form.getField('custrecord_sample_tracking_request_id');
var sampleRequestValues = searchSampleRequestValues();
var usedSampleRequestValues = searchUsedSampleRequestValues();
var availableSampleRequestValues = sampleRequestValues.filter(function(value){
return usedSampleRequestValues.indexOf(value) == -1;
});
availableSampleRequestValues.forEach(function(value){
sampleRequestField.addSelectOption(value.id, value.name);
});
}
}
function searchSampleRequestValues(){
// Perform a search on the 'Sample Request' custom record to get all values
// Return an array of objects, each with an 'id' and 'name' property
}
function searchUsedSampleRequestValues(){
// Perform a search on the 'Sample Tracking Form' custom record to get all used 'Sample Request' values
// Return an array of ids
}
This script should be deployed as a User Event script on the 'Sample Tracking Form' custom record. The beforeLoad
function is triggered when the form is loaded, and it populates the 'Sample Request Selector' dropdown list with the available 'Sample Request' values.
******
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
04/21/2025, 9:41 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.839421272
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.83902818
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.834273398
Celigo AI
04/21/2025, 9:41 AM