AshPhoenix.Form.for_action/3
works well with resource attributes, but throws error saying attribute does not exists, when used for an action with arguments.
Is what I am trying to do supported?
This action requires that after a person is added successfully, it proceeds to doing other business logics, so I have to submit all person details at once.
create :quick_add do
argument :work_email, :string, allow_nil?: true
argument :supervisor_employee_no, :string, allow_nil?: true
argument :tin, :string, allow_nil?: true, description: "Tax Identification Number"
argument :mobile_phone, :string, allow_nil?: true
argument :department_id, :uuid, allow_nil?: true
argument :job_title_id, :uuid, allow_nil?: true
change after_action(&Zippiker.People.Person.Changes.AddUserChange.change/3)
end
Validating this form throws:
** (KeyError) key :work_email not found in: #Zippiker.People.Person<
Here is how I am building the form:
defp get_form(%{actor: actor}) do
Form.for_action(Person, :quick_add, actor: actor)
|> to_form()
end