var esq = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "F14Entities");
esq.AddColumn("Id");
esq.AddColumn("F14Name");
esq.Filters.Add(esq.CreateFilterWithParameters(FilterComparisonType.Equal, "F14Name", oppositeReference.SchemaName));
var entities = esq.GetEntityCollection(UserConnection);
var oppositeReferenceId = Guid.Empty;
if (entities.Count == 1) {
oppositeReferenceId = entities.First().GetTypedColumnValue("Id");
}
The above code returns the following error:
Terrasoft.Common.ItemNotFoundException: Value "Id" was not found.
at Terrasoft.Core.Entities.EntityColumnValueCollection.GetByName(String name)
at Terrasoft.Core.Entities.Entity.InternalGetColumnValue(String valueName)
at Terrasoft.Core.Entities.Entity.GetTypedColumnValue[TResult](String valueName)
at Terrasoft.Core.Process.F14Process_cd99806MethodsWrapper.ScriptTask1Execute(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)How do I get the "Id" of the record returned by the ESQ query?
Thanks,
Like
3 comments
14:31 Jan 29, 2024
Please add a screenshot of the F14Entities entity in the object designer with all columns in it. The way you described in the code should work.
16:32 Jan 29, 2024
Try adding this to the ESQ:
esq.PrimaryQueryColumn.IsAlwaysSelect = true;Then you can access the Id using this:
var id = entity.PrimaryColumnValue;Ryan
Show all comments