Pseudo-Algorithm for CreateOrder
Get the Quote, Quote Item, Quote Item XA, Order Entry - Orders, Order Entry - Line Items, and Order Item XA business components.
The Quote business component is already positioned on the correct record, as the CreateOrder method is row-sensitive.
Create a record in the Order Entry - Orders business component. Use Quote|Order FieldMap n to copy fields from the Quote business component to the Order Entry - Orders business component.
Note: Only fields that have been fetched from the database will be copied over. Fields fetched are fields that either have the property Force Active set to True or that are displayed in the applet or that have been activated in scripting with method BusComp.ActivateField(FieldName).For each record in the Quote Item business component, copy it to the Order Entry - Line Items business component using the Quote Item|Order Item FieldMap n field maps. To maintain hierarchical relationships, copy the parent record before copying its child records. Also copy records from the grandchild business component Quote Item XA to Order Item XA.
Note: As Quote Item and Order Entry - Line Items have hierarchies, you cannot simply loop through the records in Quote Item and copy them to Order Entry - Line Items. You need to maintain the hierarchical relationship. To do this, you need to copy the parent record before you copy its child records.When doing step 3, for each record in the Quote Item business component:
Set the CurrentOrderId profile attribute to the order that is created;
Set the Order Id output argument;
Clear the CurrentCheckOutQuoteId profile attribute;
If the Id of the quote record equals the CurrentQuoteId profile attribute, clear the CurrentQuoteId profile attribute by setting it = EMPTY_CART.
Set the Error Message output argument if there is any error;
If Return Error Code = N, do not return an error;
Else return an error.