Retrieving only records created by user

0
In an application an entity has the attribute CREATOR. Now we want to only display the records created by the logged in user (= CREATOR) The XPath constraint would be : [CREATOR = $currentUser/Name] This constraint works in a Retrieve activity. Thise constraint cannot be used on a dataview/datagrid widget (Data Source type XPath) and as an XPath constraint in the Access rules within the entity on the assigned role. In those cases the check value (second part) has to be in quotes, making it a literal. When the Data Source type Database is used, we can also add a constraint, which seems to look correct, but transformed to an XPath constraint the second part is quoted again. How can we retrieve the preferred data records using this constraint? Where in the programme logic do we have to add this constraint to get the wanted result?
asked
3 answers
1

Make the user the topmost dataview. Then inside this user dataview you can create a datagrid Creator over the association User - Creator.

Regards,

Ronald

answered
1

From your description, it sounds like you have an attribute on your entity to hold the string value of the creator name. It would be far better to use an association between your entity and the Account object, and set this to the currentUser when you create a record (you can do this in an After Create microflow defined on the Event Handlers tab of your entity). This association between the entity record and the account that created it can then be used easily to filter the records to show via an x-path.

One other alternative is to use the built-in System members for the entoty - Owner, if enabled, will contain a link to the System.User record of the person who created the record. The problem with this is that not all users will have rights to see other users data, so you cannot display this attribute in your form, only use it in workflow. So, it is probably better to create your own association as described above.

answered
0

Thanks for the replies.

I think I was not completely clear. The log in user is an employee and is only allowed to see their own data, not of the other employees. The log in is created by an different user than the user who registered the employee in the data base (if it were the same user, I do not think that user would have the GUID available and stored on the entity).

But browsing through the course material I notice an illustration using a microflow, that might work as I would like. At least in a microflow I can used mentioned XPath constraint.

answered