Set new record values before insert / LiveView

I want to set a value uuid for a new record. I created a util function that read type of changeset action and sets the value in changeset.
The issue is that I want to set the value in schema module in changeset f, so it is a central location for population of fields.
The thing is that in a standard code action is set only after the Repo insert is executed.

def changeset(client, attrs) do
client
    |> cast(attrs, [:uuid, :name])
    |> DataUtils.set_uuid
...
def set_uuid(changeset) do
    if get_change(changeset, :insert) do
      uuid = Ecto.UUID.generate
...

how about changing the conditional check in set_uuid to detect whether the uuid has already been set (e.g. ) rather than whether the action is ':insert? There’s a similar example here setting name rather than uuid: Setting a default value for a Schema in changeset

But the value will not be there, cause it is not on the form, and it will be set also on change event.