In Item Doc-type I have a custom field(item_search). I want to fetch the item_code value to this custom field but I want to remove special characters in that value.
I tried writing custom script, Its fetching the value but removing the special characters not worked.
so, I tried changing the code in Item.js file
item_code: function(frm) {
if(!frm.doc.item_name)
frm.set_value(“item_name”, frm.doc.item_code);
if(!frm.doc.item_search)
frm.set_value(“item_search”, frm.doc.item_code.replace(/[^A-Z0-9]/ig, “”);
if(!frm.doc.description)
frm.set_value(“description”, frm.doc.item_code);
},
Which is the best way to achieve this? Custom script or changing the code?