Passing a action value from accept to a change

i guess an example would work best, but im trying to pass currency to a changeset via the acton , can you tell me what im doing wrong

 actions do
    defaults [:read, :destroy]

    create :create do
      primary? true
      accept [
        :status,
        :customer_id,
        :delivery_date,
        :invoice_number,
        :invoice_status,
        :invoiced_at,
        :payment_method,
        :discount_type,
        :discount_value,
        :delivery_method,
        :currency
      ]

      argument :items, {:array, :map}

      change manage_relationship(:items, type: :direct_control)
      change {CalculateTotals, [currency: arg(:currency) ]}
      change {ValidateConstraints, []}
    end

You can’t do it currently with attributes the way that you can with arg. You have two options:

  1. in the change access it via Ash.Changeset.get_attribute
  2. change it to an argument:
actions do
    defaults [:read, :destroy]

    create :create do
      primary? true
      accept [
        :status,
        :customer_id,
        :delivery_date,
        :invoice_number,
        :invoice_status,
        :invoiced_at,
        :payment_method,
        :discount_type,
        :discount_value,
        :delivery_method
      ]

      argument :currency, :string
      argument :items, {:array, :map}

      change set_attribute(:currency, arg(:currency))
      change manage_relationship(:items, type: :direct_control)
      change {CalculateTotals, [currency: arg(:currency) ]}
      change {ValidateConstraints, []}
    end