Siebel Product Administration Guide > Siebel Configurator Scripts > Siebel Configurator Script Events and Methods >

GetCPInstance Method


This method returns the entire structure of a customizable product as a property set.

Syntax

GetCPInstance(ps)

Argument
Description

ps

Can be created with TheApplication().NewPropertySet();

Items

Not applicable.

Returns

Returns the structure of the customizable product as a property set. Depending on the structure of the customizable product, the property set can be complex. To learn how to access the property set, use the following JavaScript code to dump the property set to a file. You can then study the property set structure to determine how to access it using a script.

/*

Use the PropertySetToFile(PropSet, fileName, title) API in your script.

   Note that fileName must be double slashed, as demonstrated in the example below:

      PropertySetToFile(InputsPS, "..\\temp\\testPSexport.txt", Inputs into " + MethodName);

   This will write the property set to a text file in the Siebel temp directory.

*/

function PropertySetToFile (PropSet, fileName, title)

{

   var file = Clib.fopen(fileName, "at");

   LogData(("\n---------------------------------------------------"), file);

   LogData(("Start Process " + Clib.asctime(Clib.gmtime(Clib.time()))), file);

   LogData(title, file);

   LogData("PROVIDED PROPERTY SET", file);

   WritePropertySet(PropSet, file, 0);

   Clib.fclose(file);

   return (CancelOperation);

}

function WritePropertySet(PropSet, file, Level)

{

   if ((Level == "") || (typeof(Level) == "undefined")){

         Level = 0;

   }

   var indent = "";

   for (var x = 0; x < Level; x++){

         indent += "\t";

   }

   var psType = PropSet.GetType();

   var psValue = PropSet.GetValue();

   LogData((indent + "Type: " + psType + " Value: " + psValue), file);

   var propName = PropSet.GetFirstProperty();

   while (propName != ""){

      var propValue = PropSet.GetProperty(propName);

      LogData((indent + propName + " = " + propValue), file);

      propName = PropSet.GetNextProperty();

   }

   var children = PropSet.GetChildCount();

   for (var x = 0; x < children; x++){

         LogData(( indent + "CHILD PROPERTY SET " + x), file);

         WritePropertySet(PropSet.GetChild(x), file, (Level + 1));

   }

}

function LogData(DataString, file)

{

   try {

      Clib.fputs((DataString + "\n"), file);

      Clib.fflush(file);

   }

   catch (e){

         // no action

   }

}

Siebel Product Administration Guide Copyright © 2010, Oracle and/or its affiliates. All rights reserved. Legal Notices.