Hi All
I'm trying to add a column of a related entity. In this instance from a custom entity to the systemuser to retrieve the 'entityimage_url' field. I can achieve it by adding a linked entity and then the addColumn method, but this creates an outer join filter that causes problems when I try to filter the control. Is it possible to just add the column? I can already retrieve other columns from the systemuser table because the relationship exists, just not this column.
Thanks for any help on this!
Just to tease out my problem a bit more...
If I use the following code:
const userLink = {
name: "systemuser",
from: "systemuserid",
to: "a1a_assigneduser",
linkType: "outer",
alias: "assigneduser",
};
context.parameters.workflowDataSet.linking.addLinkedEntity(userLink);
context.parameters.workflowDataSet.addColumn("entityimage_url", "assigneduser");
The column is added successfully, but the following filter is added that stuffs up filtering:
My workaround is to add a dummy column from the related systemuser table, retrieve its alias and then use that to add my column like this:
const linkedEnts = context.parameters.workflowDataSet.linking.getLinkedEntities();
const systemuserTable = linkedEnts.find(x => x.name === "systemuser")
context.parameters.workflowDataSet.addColumn("entityimage_url", systemuserTable?.alias);
I have to do this because the alias isn't 'systemuser', but some random guid that changes on deployment - it would be great if it wasn't. This workaround creates a bug when filtering - when I expect 5 records to be returned the totalresultcount will be accurate, but it will return a full 'page' of data regardless. In my instance that's 50 records as seen below.
Anyone have a better solution?
User | Count |
---|---|
4 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
5 | |
5 | |
3 | |
2 | |
1 |