Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

SQL error while script try to set value in text custom field

Paweł Jakimiak
Contributor
September 10, 2018

Hi,

I created script who gets the value from X field (multi user picker) and set this value to Y field (text custom field). All is ok if count of users in X field is less than 15. If count of users is more than 15, script not able to set value to the Y field. I get following SQL error:

2018-09-10 15:58:49,452 ERROR [runner.AbstractScriptListener]: *************************************************************************************
2018-09-10 15:58:49,452 ERROR [runner.AbstractScriptListener]: Script function failed on event: com.atlassian.jira.event.issue.IssueEvent, file: <inline script>
com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:CustomFieldValue][parentkey,null][customfield,15703][issue,132164][stringvalue,Elżbieta XXX, Ewa XXX, Ewa XXX, Ewelina XXX, Joanna XXX, Katarzyna XXX, Katarzyna XXX, Kinga XXX, Krzysztof XXX, Marcin XXX, Natalia XXX, Patryk XXX, Pawel XXX, Piotr XXX, Łukasz XXX][id,1383844][updated,1536587929436] (SQL Exception while executing the following:INSERT INTO jiraschema.customfieldvalue (ID, ISSUE, CUSTOMFIELD, UPDATED, PARENTKEY, STRINGVALUE, NUMBERVALUE, TEXTVALUE, DATEVALUE, VALUETYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (String or binary data would be truncated.))
    at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:299)
    at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:172)
    at com.atlassian.jira.issue.customfields.persistence.OfBizCustomFieldValuePersister.createValuesInt(OfBizCustomFieldValuePersister.java:129)
    at com.atlassian.jira.issue.customfields.persistence.OfBizCustomFieldValuePersister.updateValues(OfBizCustomFieldValuePersister.java:139)
    at com.atlassian.jira.issue.customfields.persistence.EagerLoadingOfBizCustomFieldPersister.updateValues(EagerLoadingOfBizCustomFieldPersister.java:48)
    at com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType.updateValue(AbstractSingleFieldType.java:151)
    at com.atlassian.jira.issue.fields.ImmutableCustomField.updateValue(ImmutableCustomField.java:427)
    at com.atlassian.jira.issue.fields.ImmutableCustomField.updateValue(ImmutableCustomField.java:396)
    at com.atlassian.jira.issue.fields.OrderableField$updateValue.call(Unknown Source)
    at Script658.run(Script658.groovy:199)
Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:CustomFieldValue][parentkey,null][customfield,15703][issue,132164][stringvalue,Elżbieta XXX, Ewa XXX, Ewa XXX, Ewelina XXX, Joanna XXX, Katarzyna XXX, Katarzyna XXX, Kinga XXX, Krzysztof XXX, Marcin XXX, Natalia XXX, Patryk XXX, Pawel XXX, Piotr XXX, Łukasz XXX][id,1383844][updated,1536587929436] (SQL Exception while executing the following:INSERT INTO jiraschema.customfieldvalue (ID, ISSUE, CUSTOMFIELD, UPDATED, PARENTKEY, STRINGVALUE, NUMBERVALUE, TEXTVALUE, DATEVALUE, VALUETYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (String or binary data would be truncated.))
    at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:206)
    at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:171)
    at org.ofbiz.core.entity.GenericHelperDAO.create(GenericHelperDAO.java:89)
    at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:562)
    at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:548)
    at org.ofbiz.core.entity.GenericValue.create(GenericValue.java:114)
    at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:296)
    ... 9 more
Caused by: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:INSERT INTO jiraschema.customfieldvalue (ID, ISSUE, CUSTOMFIELD, UPDATED, PARENTKEY, STRINGVALUE, NUMBERVALUE, TEXTVALUE, DATEVALUE, VALUETYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) (String or binary data would be truncated.)
    at org.ofbiz.core.entity.jdbc.SQLProcessor.executeUpdate(SQLProcessor.java:570)
    at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:198)
    ... 15 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: String or binary data would be truncated.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:258)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1535)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:467)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:409)
    at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7151)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2478)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.execu

 

 

Can you help me with this problem? For sure this is not problem with character limit in text fields. I have tried set character limit to unlimited and problem remained.

1 answer

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 10, 2018

Hello,

According to this error, you are trying to store in a database column more characters than it can accept.

Paweł Jakimiak
Contributor
September 10, 2018

From log results that script try to store data to "stringvalue" column in database. I checked length this column - it's 255 character. My values have only 163 characters (with spaces).

Suggest an answer

Log in or Sign up to answer