I am creating a new record:
var schema = UserConnection.EntitySchemaManager.GetInstanceByName("UsrTable");
var entity = schema.CreateEntity(UserConnection);
entity.SetDefColumnValues();
entity.SetColumnValue("UsrColumn", columnValue);
entity.Save();
var recordId = entity.GetColumnValue("Id");
and then creating a linked record in a related table:
var schema2 = UserConnection.EntitySchemaManager.GetInstanceByName("UsrRelatedTable");
var entity2 = schema2.CreateEntity(UserConnection);
entity2.SetDefColumnValues();
entity2.SetColumnValue("UsrTable", recordId);
entity2.Save();
I'm getting the following error referring to the `UsrTable` lookup column in `UsrRelatedTable` table when running the process:
Terrasoft.Common.ItemNotFoundException: Value "UsrTable" was not found.
at Terrasoft.Core.Entities.EntityColumnValueCollection.GetByName(String name)
at Terrasoft.Core.Entities.Entity.SetColumnValue(String valueName, Object value)
at Terrasoft.Core.Process.UsrImportCustomersSubMethodsWrapper.DeserialiseJSONExecute(ProcessExecutingContext context)
at Terrasoft.Core.Process.ProcessScriptTask.InternalExecute(ProcessExecutingContext context)
at Terrasoft.Core.Process.ProcessFlowElement.ExecuteItem(ProcessExecutingContext context)
at Terrasoft.Core.Process.ProcessFlowElement.Execute(ProcessExecutingContext context)
The question is essentially how to initialise a lookup column with a record Id.