Comments between two custom tables - should reflect each other
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 04:37 AM
Hello everyone,
I have issues coming up with a solution for communication between two custom tables.
When a comment is added in the Communication , I want the same comment to appear on my referenced record (and vice versa).
This was done with a Before business rule, but that does not always work as intended.
Sometimes it does not add the comment, and it needs to be posted twice before showing up on form.
What is the best way to do this?
Seems like there is not easy solution...
The current BR looks something like this:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 04:55 AM
Create a flow on the sys_journal_field table on insert of a record where name is one of your tables and element is comments.
Then run an 'if' with condition trigger-name is a, look up record for b and add comment and vice versa. Just make sure you're not creating a loop.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 06:57 AM
Thanks for the idea, but is that really needed?
Cannot it not be a flow between just the two custom tables?
I have a hard time visualize how the flow conditions should look, and how to make sure it actually copies over the comments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2024 02:32 AM
In that case you need two flows, because you can only trigger a flow on one table. Creating it on the sys_journal_field table, only requires one flow. So for 'is that really needed', the answer is 'no', but easier to maintain than your flow between two tables.
Trigger on sys_journal_field table where element is comments and name is 'table a' or name is 'table b'.
If trigger.name = table A
look up record for table B where related_field_for_table_a.sysID = trigger.element_id
update record found by setting comments to trigger.value
If trigger.name = table B
look up record for table A where related_field_for_table_b.sysID = trigger.element_id
update record found by setting comments to trigger.value
In case it is a many to many relation, you can do a look up records and then a for each loop to update the records.
My advice is to add some 'loop prevention' in there by updating the comments with 'Comment from table x: ' and then the comment. And in your trigger you can add 'value does not contain 'comment from table ' to make sure those aren't copied again.
Your own idea can work in the same way, only then you will be creating two flows, doing the same.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark