Set an Order ID as fixed in an OrderItem Form
Question

I solved my own last problem but now have the final problem.

I can create an order with this screen but then I have a link to add order items to that screen.

But try as I may, I cannot override the form dropdown to set it only to the newly created order.

I don’t want the dropdown I just want it to be fixed with the new orderId

I’ve tried to do something with session variables and passing input variables but to no avail. Any thoughts? .omi file attached.

CustOrd721714pm.oml

Hi Alan,

I agree with AJ that your flow is quite a bit out of the ordinary.  :-)

The way you always create a new order, every time an order item is created, seems to indicate that there is a 1:1 relation between order and orderitem ??   If that is the case, why even bother splitting it up in order and order item in your datamodel ?

Also, it seems that you always create an order when the orderitem screen is opened, with the same details as the ones of the order attached to the given orderitem.  This looks like you are going to make unwanted duplicate order records.

Also, when you come from signin screen to order item detail, you are passing nullidentifier, so in preparation you will not find orderitem with the aggregate, and then you will create an order with empty attributes.

I would expect the creation of order to be a bit more deliberate and separated from the creation of orderitem, for example, force on the signin screen to have an order selected, before choosing the add order line, pass the current order id on the input of order detail screen and use that in the create or update of order line.  And you'll have to first add the order deliberately, choose it in the list, and then be able to add order lines.

Or if you want to allow for silent creation of order on the back of the first order item, then at least pass in order id into detail screen, and if filled, do a read instead of create in the preparation.  If nullidentifier, you can keep doing what you are doing now, but as i said, this will lead to empty order attributes.

Dorine

Solution

Hi Alan,

I had a few questions on the logic in general but I figured you had a reason for the way your logic flows.

To address your immediate ask, I understand that when you create a new OrderItemDetail, you create a new Order (in the Preparation) and then want to display that OrderId to the OrderItemDetailform.
In the attached oml I made the following 2 changes to make that happen:

1. Created a local variable 'OrderId' to save the newly created OrderId

2. Pass the OrderId local variable in 'GetOrder'

3. I also changed the OrderId Dropdown to an Input field in the OrderItemDetail screen.

Regards,

AJ

CustOrd71921v2.oml

Thanks. I loaded your revision but still have a dropdown.

Ah I see, going back to your original screenshot I see that it was OrderItemDetail2 that you were referring to and I had ended up modifying OrderItemDetail instead.

I have moved those changes out of OrderItemDetail and into OrderItemDetail2 in the new oml.

CustOrd721714pmv3.oml

Hi Alan,

I agree with AJ that your flow is quite a bit out of the ordinary.  :-)

The way you always create a new order, every time an order item is created, seems to indicate that there is a 1:1 relation between order and orderitem ??   If that is the case, why even bother splitting it up in order and order item in your datamodel ?

Also, it seems that you always create an order when the orderitem screen is opened, with the same details as the ones of the order attached to the given orderitem.  This looks like you are going to make unwanted duplicate order records.

Also, when you come from signin screen to order item detail, you are passing nullidentifier, so in preparation you will not find orderitem with the aggregate, and then you will create an order with empty attributes.

I would expect the creation of order to be a bit more deliberate and separated from the creation of orderitem, for example, force on the signin screen to have an order selected, before choosing the add order line, pass the current order id on the input of order detail screen and use that in the create or update of order line.  And you'll have to first add the order deliberately, choose it in the list, and then be able to add order lines.

Or if you want to allow for silent creation of order on the back of the first order item, then at least pass in order id into detail screen, and if filled, do a read instead of create in the preparation.  If nullidentifier, you can keep doing what you are doing now, but as i said, this will lead to empty order attributes.

Dorine

Thanks everyone. A terrific video for passing parameters is here 

https://www.youtube.com/watch?v=BitY9MAv69Y


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.