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

SaveCartAsTemplate


SaveCartAsTemplate generates a template from a quote. The implementation is Template (see OrderTemplate) with some special considerations, such as you cannot copy a Siebel eAuction, Siebel eTraining, or Siebel eEvents Management line item into a template.

Expected Preconditions Before the Method Can Be Called

Field maps are used to copy fields from the Quote to Quote Template, Quote Item to Quote Template Item, and Quote Item XA to Quote Template Item XA business components.

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

Table 43. Sample Field Maps for the SaveCartAsTemplate Method
Name
Value
Quote|Quote Template FieldMap 100
Contact Id|Contact Id
Quote Item|Quote Template Item FieldMap 100
Product Id|Product Id
Quote Template Item XA|Quote Item XA FieldMap 100
Attribute Id|Attribute Id

Arguments

The SaveCartAsTemplate method has the arguments shown in Table 44.

Table 44. SaveCartAsTemplate Arguments
Name
Type
Data Type
Optional
Comments
Quote Name
Input
String
Y
Saves the Shopping Cart as a template with this name.
Quote Name Field
Input
String
Y
Tells the Shopping Service which field is the quote name.
By default, it is Name if this input argument is not used.
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. In order not to kill the workflow, you can set this input to N. This way, the Shopping Service will not return an error but instead will save the error message in the output argument Error Message. You can then handle the error message as you wish.
Error Message
Output
String
Y
Stores error messages.
ReturnVal
Output
String
Y
Returns Success or Fail. Not used.

Pseudo-Algorithm

  1. Get the Quote Template, Quote Template Item, Quote Template Item XA, Quote, Quote Item, and Quote Item XA business components.
  2. The Quote Template business component is already positioned on the correct record, as the OrderTemplate method is row-sensitive.

  3. Check the Quote Name input argument. Query the Quote business component to see if there is an existing record with the same name.
  4. If there is, go to step 3;

    Else go to step 4.

    As Quote Template is a special type of Quote, the Quote business component can be used to search both Quote and Quote Template.

  5. Set Error Message to indicate there is a duplicate name. Check the Return Error Code input argument.
  6. If Return Error Code = N, do not return an error;

    Else return an error.

  7. Create a record in the Quote Template business component. Use the Quote to Quote Template field maps to copy fields from the record in the Quote business component to the record in the Quote Template business component. Set the Name to the Quote Name input argument.
  8. Copy each record in the Quote Item business component to the Quote Template Item business component, but skip line items that are Siebel eAuction or Siebel eTraining items by checking the Class Registration Id and Auction Item Id.
  9. NOTE:  As in the OrderTemplate method, make sure the hierarchical relationship is copied correctly by copying each parent record before its child records. Also copy the child records from Quote Item XA to Quote Template XA.


 Siebel eSales Administration Guide 
 Published: 18 April 2003