Relating record

Hello,

We have a custom module called “punches users” and another (related) custom modules called “punches”

We are inserting data into the “punches” module, one of the field we insert is “user_code”, we have the same field “user_code” in “punches users” module.

We would like to relate the “punches” record to the “punches users” by the “user_code”.

So basically we need a workflow that will search for the user_code in the “punches users” table and get the name of the record and insert it to the “punches” table.

Can calculated fields do that?

Thanks.

It sound like user_code should be a relate field, then all this would be automatic.

If you really go with Workflows, don’t look for Calculated Fields, check the add relationship actions instead.

Thanks pgr, how can I change the user_code to be the relating field? as of right now the relating field is name

You add Relate field (not “relating”) from Studio. It connects to an entire related record, not to a specific field in that record.

In punches module, you add a single relate field to punches_users module.

Dear PGR, it is still not working for me, let me tell you what I did.
we changed the names of all users punches to the actual user_code (number)
When we add user punches from the CRM it works fine,
However, we are using an online form to submit the punches, so we are now sending the user_code as the relate_c, field, but it does not relate the punches to the punches users. What do you think? Thanks again for all efforts and assistance.

i think that with a web form it’s a bit more complicated, but you should still use the correct database structure.

When you use the relate field, the CRM handles the connection between the two tables for you. It essentially stores an id in a relationship table, and then has code to handle that elegantly on screens, allowing to select related records, show related fields etc.

In order to manipulate this directly you need to understand the internal workings of it…