Need to change a table number field prefix whose data pulled via integration

Poorva Bhawsar
Mega Sage

Hi Community,

 

I have some data getting pulled from snowflake into servicenow custom table. In servicenow, i have given a prefix there but as its getting pulled from snowflake, its mapping with the prefix which is there in snowflake for number field.

 

I want to change the prefix of the number field to that which i have given in number maintenance table.

 

How to change the prefix for the data which is getting pulled via integration.

 

Thanks

1 ACCEPTED SOLUTION

I fixed it, it should be after insert/update instead of before.

View solution in original post

6 REPLIES 6

Abbas_5
Tera Sage
Tera Sage

Hello @Poorva Bhawsar,

Please refer to the links below:
https://www.servicenow.com/community/itsm-forum/changing-prefix-of-a-table-auto-number/td-p/734415


If it is helpful, please mark it as helpful and accept the correct solution. In the future, it might be helpful for someone to refer to this solution.

Thanks & Regards,

Abbas Shaik

Yeah i have already written a before BR.

 

var record = new GlideRecord('xyz');
    record.query();
    while (record.next()) {

        record.number = record.number.replace('ABC', 'PQR');
        record.setWorkflow(false); //Do not run business rules
        record.autoSysFields(false); //Do not update system fields
        record.update();
    }
 
Currently its insert/update both. It should be update only right?

Yes, you can try.

instead of update it should be insert only. But the last record is taking wrong one which is getting pulled via integration. Others are updating based on BR.