Naming Series not set properly via Data Import

Hi everyone, I have given format:{field_name} in auto name doctype itself and wrote code to set value for that field_name on before_save event. once the value is set for that field means the naming series is also set for that record and is working fine.

But the problem arises via the Data Import tool means the naming series is not as per our code and one record is only uploaded via the data import tool because the naming series is set as field_name name itself so another data is not uploaded successfully it shows field_name(naming series) already exists.

Any idea to resolve this issue.


Any idea guys?

Hi, Can you please share the code you have written, so that it will be clearer to understand, why it’s not workin or malfunctioning.

Hi @Tribikram_Sahu, thanks for your reply. I have written code in js on the before_save event

before_save: function(frm){
if(field1 && field2 && field3) {
var test = field1 + ’ ’ + field2 + ’ '+ field3;

Here field4 is given in the doctype Auto name section like format:{field4}. While doing manually system correctly takes the format of field4 value to the naming series for that record. But while comes to Data Import system does not take this code and the naming is also set as field4 not the value of that “field4”.

I think before_save function doesn’t allow you to run during any Import. You can try on_save once. I am not sure but I just hope it will work. Just let me know if it does the magic for you :slight_smile:

Hi @Tribikram_Sahu, thanks for your kind reply. I have changed the naming series through code in the autoname method and it is working now via Data Import also.


Cool, Glad to know.