akin9
Tera Contributor

Hi @Tushar  

I have tried the same  above script still we are facing the same issue.

from payload we posted characterstic value is ,madurai,pune and chennai still its updating pune only

pls check and support this.

(function executeRule(current, previous /*null when async*/) {

var characteristicGR = new GlideRecord('sn_ind_tmt_orm_order_characteristic_value');
characteristicGR.addQuery('sn_ind_tmt_orm_order_task', current.sys_id); // Filter by the current order task
characteristicGR.addQuery('characteristic.name', 'sitename'); // Filter by the characteristic name
characteristicGR.query();

var siteNameValue = '';  


while (characteristicGR.next()) {
    // Retrieve the characteristic_value (or characteristic_option_value) from the record
    var tempSiteNameValue = characteristicGR.characteristic_option_value; // Replace with the correct field name if different
   
    // If we find a valid site name, update the siteNameValue variable (you can adjust logic here if needed)
    if (tempSiteNameValue) {
        siteNameValue = tempSiteNameValue;
    }
}


if (siteNameValue) {
    current.u_site_name = siteNameValue;
}

})(current, previous);