How to get user that updated a record.
it seems that in created by there is an Actor. but i can not make another field updated by to set it to Actor also. I can select workspace members but this should not be selectable. Consept is to create a correction tasks for the person that broke a record listing all the mistakes
25 Replies
Hey, updatedBy is not implemented yet but it is planned to be
do we have idea when?
I'm trying to make an extension for this, it's almost done, but I have to figure out how to update properly the field via API as it normally results in error from unique constraint
You can check the code here https://github.com/BOHEUS/twenty/tree/updated_by/packages%2Ftwenty-apps%2Fupdated-by
GitHub
twenty/packages/twenty-apps/updated-by at updated_by · BOHEUS/twenty
Building a modern alternative to Salesforce, powered by the community. - BOHEUS/twenty
I have yet to understand why this works separated in test.ts but not in extension
Also there is another issue on this tasks. when in workflow you want to create a task you can not set the relation object

so i can even not decide to assign unti you fix it the creator but i can not connect the task to the object that i refer
CC: @thomast
What would be the perfect way to do it? Create a generic workspaceMember relation type field like ACTOR with post-update hook checking if update was done by user and not by API and updated field isn't updatedBy?
Won't lie, can't figure out a way to bypass the constraint via API in app even though it's working outside the app
it seems that here we have in this chat 2 issues:
* Updated By is not available and you can not set actor to a field if you want to created this field manually
* creation of task by workflow does not give you the possibility to set relation field.
Is it possibile to know when could these be fixed if they are already in plan?
Yeah
I am also having the same issue here
@Weiko what are the requirements for Twenty ORM to throw the violation of foreign key exception?
The metadata layer is directly using TypeORM, only Workspace schema record CRUD goes though TwentyORM. Which constraint is failing during your field update?
Response from server container
Ah, this is not when you update a field but a company, this is going though Twenty ORM then indeed
Is it when you run the code from test.ts in the branch you shared above?
This appears only when app is triggered
The FK constraint complains because you are probably providing a wrong id for your workspaceMemberId
You are adding a new field relation to each object targetting workspaceMembers then you are updating a company providing a variable named userId as a workspaceMemberId value. If it's not a proper workspaceMemberId it will fail
Just to be sure, userId given from Twenty to app when trigger conditions are met is not the same as workspaceMemberId?
Okay, thanks for showing me the direction, I solved the problem and updatedBy plugin should work properly now
I'll try to create a PR once I get a proper internet connection and some testing
Here's a PR for an extension https://github.com/twentyhq/twenty/pull/15937
GitHub
Updated by extension by BOHEUS · Pull Request #15937 · twentyhq/t...
Working updated by extension which shows the workspace member behind the newest change
Yes, not the same indeed, you need to fetch workspaceMemberId instead and it should be in the payload as well.
Seems like you figured it out yourself 🙂
@kyrpav extension has been merged, feel free to test it out and give feedback on it!
11.5? or it will be then later released as docker?
As far as I know, you have to clone the repo or specific folder and go with instructions attached to app
It's not bundled together with Twenty, @martmull are there plans for extensions app shop?
Yes, no timeline yet but this is planned
I am using 1.11.5 latest Dockerised version. What is the procedure to install the application? I have seen the readme page to install this extension app.Is there any guide on how to do it in dockerised version.
Currently there's no other way than:
- downloading twenty-cli
- cloning whole repo
- going to packages/twenty-apps/community/updated-by
-
twenty auth login
- twenty app sync
- adding required variables in Settings > Integrations > Updated by
One optimization can be done with cloning only specific folder within whole folder (or submodule once core team extracts whole twenty-apps module to separate repo) but that's something I have yet to figure out