Ash FrameworkAF
Ash Framework3y ago
16 replies
tommasop#2001

If I set an argument default in a Flow I have it `nil` in a custom step

defmodule MmsBiztalk.Flows.Rollback do
  use Ash.Flow

  flow do
    api MmsBiztalk

    argument :resource, :string do
      allow_nil? false
    end

    argument :step, :integer do
      default 1
    end

    argument :resource_id, :integer

    returns :get_last_data_in_resources
  end

  steps do
    custom :get_last_data_in_resources, MmsBiztalk.Flows.Steps.LastDataInResources do
      input %{resource: arg(:resource), resource_id: arg(:resource_id)}
    end

    transaction :back_in_time, MmsBiztalk.DataIn do
      map :cycle_resources_changes, result(:get_last_data_in_resources) do
        custom :rollback_resource, MmsBiztalk.Flows.Steps.RollbackResource do
          input %{
            resource: arg(:resource),
            change: element(:cycle_resources_changes),
            step: arg(:step)
          }
        end
      end
    end
  end
end

in MmsBiztalk.Flows.Steps.RollbackResource the value of input.step is nil.
Was this page helpful?