We are encountering an error when attempting to set the column value on the lead entity with the following code below. The error message received and the stacktrace are listed below as well. Obviously this is a dictionary error, but I am clearly not adding any items to the column list, and have not set the column value previously. Does anyone have any ideas on what might be happening, or what I could check to make sense of this?
var rawBody = new StreamReader(stream).ReadToEnd(); var val = rawBody.Split('&') .Select(keyVal => keyVal.Split('=')) .ToDictionary(kvp => kvp[0], kvp => Uri.UnescapeDataString(kvp[1]).Replace('+', ' ')); var leadSchema = _userConnection.EntitySchemaManager.GetInstanceByName("Lead"); var l = leadSchema.CreateEntity(_userConnection); l.SetDefColumnValues(); l.SetColumnValue("srcColumnName", val["column_name"]); An item with the same key has already been added. StackTrace: at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at Terrasoft.Core.Entities.EntityColumnValueCollection..ctor(UserConnection userConnection, EntitySchemaColumnCollection columns) in C:\Projects\8.0.4.1870\TSBpm\Src\Lib\Terrasoft.Core\Entities\EntityColumnValue.cs:line 410 at Terrasoft.Core.Entities.Entity.get_ColumnValues() in C:\Projects\8.0.4.1870\TSBpm\Src\Lib\Terrasoft.Core\Entities\Entity.cs:line 848 at Terrasoft.Core.Entities.Entity.SetColumnValue(String valueName, Object value) in C:\Projects\8.0.4.1870\TSBpm\Src\Lib\Terrasoft.Core\Entities\Entity.cs:line 3024
Like
Check that your "Lead" object, where the record is modified has no duplicated columns (the error is returned from EntityColumnValueCollection, not in SetColumnValue). Also are you able to add records manually to the "Leads" section? I guess you should get some simillar error on this attempt either. Also if you are using PostgreSQL please:
1) Go to the root Web.config
2) Find the maxEntitySchemaNameLength key and modify the value to 63 there
This key controls the data reader behaviour and fixes issues of max PostgreSQL items length (table names, column names, etc.) and if your object has several columns with the lenght of name more than 63 symbols this issue can also occur.
I forgot to mention the 'SetDefColumnValues' method call was added after the error message appeared.
Check that your "Lead" object, where the record is modified has no duplicated columns (the error is returned from EntityColumnValueCollection, not in SetColumnValue). Also are you able to add records manually to the "Leads" section? I guess you should get some simillar error on this attempt either. Also if you are using PostgreSQL please:
1) Go to the root Web.config
2) Find the maxEntitySchemaNameLength key and modify the value to 63 there
This key controls the data reader behaviour and fixes issues of max PostgreSQL items length (table names, column names, etc.) and if your object has several columns with the lenght of name more than 63 symbols this issue can also occur.
Thank you Oleg! Another admin added a column in another package with the same name.