- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-25-2019 04:09 PM
Instance: Kingston Patch 14
I am attempting to update a 'Receiving Slip Line Item' using a 'Fix Script'.
Script is as follows:
var rcli = new GlideRecord('proc_rec_slip_item');
rcli.get('RCL9999999');
rcli.query();
while (rcli.next())
{
gs.log('Receiving Slip Item: ' + rcli.sys_id,'me');
gs.log('Serial Numbers: ' + rcli.u_serialnumbers, 'me');
gs.log('Quantity: ' + rcli.quantity, 'me');
rcli.u_serialnumbers = 'ACCC123456788|ACCC123456789';
rcli.quantity = 2;
rcli.update();
}
Upon execution I get the following results:
[Domain Paths] Query against table proc_rec_slip_item restricted by domain values [ABC[<SYS_ID], global]
me: Receiving Slip Item: <SYS_ID>
me: Serial Numbers: ACCC123456788|ACCC123456789|ACCC1234567810
me: Quantity: 3
GlideSession message was modified by sanitization. [message=Unique Key violation detected by database (Duplicate entry '<SYS_ID>' for key 'PRIMARY')][sanitized=Unique Key violation detected by database (Duplicate entry '<SYS_ID>' for key 'PRIMARY')]
FAILED TRYING TO EXECUTE ON CONNECTION 4: INSERT INTO proc_rec_slip_item (`u_serialnumbers`, `quantity`, `purchase_line`, `sys_mod_count`, `u_isserialized`, `received`, `sys_updated_on`, `sys_domain_path`, `number`, `sys_id`, `received_by`, `sys_updated_by`, `receiving_slip`, `sys_created_on`, `sys_domain`, `sys_created_by`) VALUES('ACCC123456788|ACCC123456789', 2, '<SYS_ID>', 0, 1, '2019-04-24 15:13:15', '2019-04-25 20:54:01', '!!!/!!!/', 'RCL99999', '<SYS_ID>', '<SYS_ID>', '<EMAIL>', '<SYS_ID>', '2019-04-25 20:54:01', '<SYS_ID>', '<EMAIL>') /* abc021, gs:<SYS_ID>, <SYS_ID>*/
Unique Key violation detected by database (Duplicate entry '<SYS_ID>' for key 'PRIMARY')
: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '<SYS_ID>' for key 'PRIMARY': org.mariadb.jdbc.internal.SQLExceptionMapper.get(SQLExceptionMapper.java:132)
Based on the error statement it looks like its attempting to INSERT a duplicate record.
In the script I am executing an UPDATE.
WHY is it trying to execute an INSERT?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-25-2019 04:17 PM
Vinod Kumar Kachineni
Community Rising Star 2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-25-2019 04:17 PM
Vinod Kumar Kachineni
Community Rising Star 2022

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-25-2019 04:49 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-25-2019 09:19 PM
I was referring to the get() function in the code which was taking in a Number.
Vinod Kumar Kachineni
Community Rising Star 2022

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā04-25-2019 04:17 PM