I have a bussiness process whicc extracts some values from a pdf, from the extraction on the pdf, there is a string value: "SecondaryPayerName".
now I have on a table "GCSeekPayer", some values and i need a script task to find if a value is in the "SecondaryPayerName" string.
I'm getting an error about the column "Id" not being found, but the column exists, the table has data, there are no spelling errors.
this is my script:
string secondaryPayerName = Get("SecondaryPayerName");
// Normalize: lowercase and remove spaces
string normalizedSecondaryPayerName = secondaryPayerName?.ToLower().Replace(" ", "") ?? "";
var esq = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "GCSeekPayer");
esq.AddColumn("GCPayerName");
esq.AddColumn("Id");
var entities = esq.GetEntityCollection(UserConnection);
Guid payerCode = Guid.Empty;
foreach (var entity in entities) {
string payerName = entity.GetTypedColumnValue("GCPayerName");
if (!string.IsNullOrEmpty(payerName)) {
// Normalize payer name too
string normalizedPayerName = payerName.ToLower().Replace(" ", "");
if (normalizedSecondaryPayerName.Contains(normalizedPayerName)) {
payerCode = entity.GetTypedColumnValue("Id");
break;
}
}
}
Set("SecondaryPayerCode", payerCode);
return true;