Auto numbering issue when record view is specified via logged in account

Hi Everyone,

Can you help me with my problem in auto numbering, I can view all records since there’s no filtering that I set on the view settings, but when I add a filter lets say only the record that the user can view are only the records that he made, but when add a record the reference no. with format “WES 20-0000X” will go back to WES 20-00001 it should be WES 20-00010 when I add another record. Can you help me with this. Because we restrict the users to view the record that the others user’s created

Hello Muhaymin,

 

If no record exists, which is likely to happen at the beginning of the year, it sets the number “00001”

 

Custom automatic numbering:

https://developer.kintone.io/hc/en-us/articles/115002656914

 

Please appoint the query itself like the one below, otherwise no matter what the year is, it will count up.

 

var query = {

'app': kintone.app.getId()

};

 

Hopefully, this helps.

 

Sean

Hi Sean,

I got the same problem with Muhaymin. I have a low programing knowledge.

I have edit code as above 

from

var query = {

'app': kintone.app.getId(),
'query': 'Date_for_auto_num > "' + dtmin + '" and Date_for_auto_num < "' + dtmax + '" order by Auto_num desc limit 1'

};

to

var query = {

‘app’: kintone.app.getId()

};

However the result doesn’t change, when the record run to xxxx9 then it will back xxxx1 again.

please advise me 

Hello Trithot,

 

By the following processing, it generates a criteria

specified query to see if the record with the year

appointed to the “Date_for_auto_num” field.

 

var dt = record['Date\_for\_auto\_num'].value;

var dtyy = dt.substring(0, 4);

var dtmin = dtyy + '-01-01';

var dtmax = (parseInt(dtyy, 10) + 1) + '-01-01';




var query = {

'app': kintone.app.getId(),

'query': 'Date\_for\_auto\_num \> "' + dtmin + '" and Date\_for\_auto\_num \< "' + dtmax + '" order by Auto\_num desc limit 1'

};

So, if you have deleted part of the code;

 

'query': 'Date\_for\_auto\_num \> "' + dtmin + '" and

Date\_for\_auto\_num \< "' + dtmax + '" order by Auto\_num desc limit 1'

 

Please include that part of the code as well.

 

When the record does not exist, it will go back to 00001.

So, please appoint the query itself, otherwise no matter what the year is,

it will count up.

 

Custom automatic numbering:

https://developer.kintone.io/hc/en-us/articles/115002656914

 

Could you try this out and see if it resolves the issue?