Siebel eSales Administration Guide > Shopping Service Methods Reference > Siebel eSales Workflow Methods >

CreateOrder Method


CreateOrder method creates an order from the current quote. It creates a record in the Order Entry - Orders business component. Also, it copies records from the child business component Quote Item to Order Entry - Line Items and from the grandchild business component Quote Item XA to Order Item XA.

Preconditions for Calling the CreateOrder Method

Field maps are used to copy fields from the Quote to Order Entry - Orders, Quote Item to Order Entry - Line Items, and Quote Item XA to Order Item XA business components.

Sample field maps are shown in Table 35. See the Shopping Service business service user properties in Siebel Tools for more details.

Table 35. Sample Field Maps for the CreateOrder Method
Name
Value

Quote|Order FieldMap 100

Contact Id|Contact Id

Quote Item|Order Item FieldMap 100

Class Registration Id|Class Registration Id

Quote Item XA|Order Item XA FieldMap 101

Name|Name

Arguments for the CreateOrder Method

The CreateOrder method has the arguments shown in Table 36.

Table 36. CreateOrder Arguments
Name
Type
Data Type
Optional
Comments

Return Error Code

Input

String

Y

If equal to N, the method will not return errors.

When a method returns an error, the workflow stops. To avoid stopping the workflow, you can set this input to N. This way the Shopping Service will not return an error, but instead save the error message in the output argument Error Message. You can then handle the error message as you want.

Error Message

Output

String

Y

Stores error messages.

Quote Id

Input

String

Y

Not used.

Order Id

Output

String

Y

ID of the order record that is created.

ReturnVal

Output

String

Y

Returns Success or Fail. Not used.

Pseudo-Algorithm for CreateOrder

  1. 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.

  2. 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).

  3. 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.

    In the Shopping Service implementation, records are first loaded from Quote Item and a tree in the memory is generated. The tree is then traversed from the root, so the parent record is copied before the child records.

  4. When doing step 3, for each record in the Quote Item business component:

    If the record is a Siebel eTraining item, confirm the registration record in the eTraining business component.

  5. 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.

  6. 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.

Siebel eSales Administration Guide Copyright © 2007, Oracle. All rights reserved.