Copy option from list field to reference field

Yahav Mor
Tera Contributor

Hi ,

I need to copy the option from the list field  to the reference field and from the reference choose one 

YahavMor_0-1720430776365.pngYahavMor_1-1720430795204.png

 

2 REPLIES 2

Mark Manders
Mega Patron

Use an onLoad client script (and if needed an onChange one as well (you are providing very limited information as to your requirements, so a lot of guessing here)):

 

onLoad

(function executeRule() {
    var symptoms = g_form.getValue('symptoms');
    if (symptoms) {
        var filter = 'sys_idIN' + symptoms.split(',').map(function(item) {
            return "'" + item.trim() + "'";
        }).join(',');
        g_form.setFilter('symptom', filter);
    }
})();

 

 

onChange

 

(function executeRule(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue == '') {
        return;
    }

    function setSymptomFilter(symptoms) {
        var filter = 'sys_idIN' + symptoms.split(',').map(function(item) {
            return "'" + item.trim() + "'";
        }).join(',');
        g_form.setFilter('symptom', filter);
    }

    setSymptomFilter(newValue);
})(g_form.getControl('symptoms'), g_form.getValue('symptoms'), g_form.getValue('symptoms'), g_form.isLoading(), false);

 

 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

The symptoms is dot walking from the service offering table 

YahavMor_0-1720434836346.png