0

Button in table x (subscription) to create a record in table y (Deliveries) and its subtable y2 (Delivery lines)

Hey so we work with a subscription formula so the products the customer gets is preset in fields in table x (max8). I want to create a button in table x where when you click it you create a record in table y with its lines in table y2 where the products equal to the products preset in table x. 

Newbie here and tried a lot of different things but not really working. If anayone could help that would be great. 

1 reply

null
    • John_Halls
    • 2 yrs ago
    • Reported - view

    Hi Heikel

    This might not be as you have your system set up, but it might help

    If your subscriptions are set up as follows

    Customers --< Subscriptions --< SubscriptionLines >-- Products

    and your orders are set up like this

    Customers --< Orders --< OrderLines >-- Products

    Then a new order based on a subscription can be made from a button in Subscriptions like this

    let a := this;
    let b := (create Orders);
    b.Customers := a.Customers;
    b.Subscriptions := a; <-- optional line here!
    for c in SubscriptionLines do
        let d := (create OrderLines)
        d.Orders := b;
        d.Products := c.Products
    end
    

    You will need to include dates, prices, etc but this should get you going.

    Regards John

Content aside

  • 2 yrs agoLast active
  • 1Replies
  • 58Views
  • 2 Following