Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

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
Giga 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