Scripting Namespace |
Class | Description | |
---|---|---|
![]() | AddItemArgument | Represents an argument for adding an item to a collection. |
![]() | ByteArrayContent | Wrapper for System.Net.Http.ByteArrayContent. |
![]() | HttpContent | Wrapper for System.Net.Http.httpContent. |
![]() | MultipartFormDataContent | Wrapper for System.Net.Http.MultipartFormDataContent. |
![]() | StreamContent | Wrapper for System.Net.Http.StreamContent. |
![]() | StreamReader | Wrapper of System.IO.StreamReader for IronPython Scripting with limited set of features |
![]() | StringContent | Wrapper for System.Net.Http.StringContent. |
Interface | Description | |
---|---|---|
![]() ![]() | IAction |
Quote Action
![]() Execute Reprice actionPython for action in Quote.Actions: if action.Name == "Reprice" and action.IsPrimaryAction: Quote.ExecuteAction(action.Id) break |
![]() | IActionCollection | Quote action collection |
![]() | IAddItemArgument | Represents an argument for adding an item. |
![]() ![]() | IAdditionalDiscount |
Additional discount represent the additional discounts on the quote.
User can add/remove/change additional discounts via Scripting.
![]() Adding new additional discount to quotePython ad = Quote.NewAdditionalDiscount(); ad.DiscountPercent = 10; ad.Description = "New discount added via scripting"; Quote.AddAdditionalDiscount(ad); Change additional discountPython ad = Quote.GetAdditionalDiscount("New discount added via scripting"); ad.DiscountPercent= 5; Remove additional discountPython Quote.RemoveAdditionalDiscount("New discount added via scripting"); |
![]() | IAdditionalDiscountCollection | Additional discount collection |
![]() | IAliases | Alias functions. |
![]() ![]() | IApiResponse |
This is abstract class which represent the response of custom API call.
If ApiResponse is not provided within the script the result would be
![]() ![]() This code define HTML response after logic in custom API script. Python #some custom logic ApiResponse = ApiResponseFactory.HtmlResponse("some HTML"); |
![]() | IApiResponseFactory | API Response |
![]() | IApproversResponsibility | Approvers Responsibility |
![]() | IApproversResponsibilityCollection | Approvers Responsibility Collection |
![]() | IAssert | Class containing helper assert methods. Primary usage should be for writing automated tests although it can be used also in production scripts for guard clauses. |
![]() | IAssetAttribute | Asset Attribute |
![]() | IAssetConfiguration | Asset Configuration |
![]() | IAssetContainer | Asset Container |
![]() | IAssetContainerRow | Asset Container Row |
![]() | IAssetItem | Asset line item |
![]() | IAssetMainItem | Asset main item |
![]() | IAttachedDocument | Attached document |
![]() | IAttachedDocumentCollection | Attached documents collection |
![]() | IAttachment | Represents an attachment to an email. |
![]() ![]() | IAuthorizedRestClient |
Client for communication with RESTful services using Authorization header built with credentials defined in Credentials Management
![]() Call current weather data for one locationCall service with providing city name and country/region code. API responds with a list of results that match a searching word.API call: http://api.openweathermap.org/data/2.5/weather?q={city name},{country/region code} Parameters: q city name and country/region code divided by comma, use ISO 3166 country/region codes Python #response is in JSON form of: #{"main":{"temp":291.05,"pressure":1016,"humidity":88,"temp_min":288.15,"temp_max":296.15}, #"weather":[{"id":701,"main":"Mist","description":"mist","icon":"50n"}], #"id":5391959,"name":"San Francisco","cod":200,"base":"stations"} response = RestClient.Get('http://api.openweathermap.org/data/2.5/weather?q=SanFrancisco,usa') Quote.GetCustomField('City').Content = response.name Quote.GetCustomField('Weather Today').Content = str(response.weather[0].main) Quote.GetCustomField('Weather Today Details').Content = str(response.weather[0].description) Quote.GetCustomField('Weather Temperature MIX').Content = str(response.main.temp_max) Quote.GetCustomField('Weather Temperature MAX').Content = str(response.main.temp_min) Submit an HTTPS POST request with basic authentication using credentials defined in Credentials Management and JSON input data to the serverSubmits JSON data to be processed to a specified resource and returns JSON response.Response is deserialized, in order to be used as object in scripting. Python #example of url service url = 'https://testcallidus.com/CallidusPortal/services/some-example-service' headers = {} #example of input JSON data data = '[{"name": "SaaS Net New Revenue", "periodType": "month", "type": "Measurement", "value": { "amount": 100, "unitType": "USD" }}]' #make HTTPS POST and receive response in form of dynamic entity response = AuthorizedRestClient.Post('CredentialsFromStore', url, data, headers) #Populate Quote custom fields Quote.GetCustomField('Bonus type').Content = response.name Quote.GetCustomField('Bonus amount').Content = str(response.value.amount) Quote.GetCustomField('Bonut unit type').Content = response.value.unitType |
![]() | IBeforeAddToQuoteEventArguments | Argument provided when 'On AddToQuote' event occurs. |
![]() | IBeforeConfigureEventArguments | Argument provided when 'On Configure' event occurs. |
![]() | IBeforeProductAddToQuoteEventArgument | Context available for the event raised before product is being added/updated to the quote. Also raised after the item is being reconfigured and before updated back to the quote. |
![]() | IBusinessPartner | Business partner interface. |
![]() | IBusinessPartnerPermission | Business partner permission. |
![]() | IBusinessPartnerRepository | Business partner repository. Used to retrieve data about business partners. |
![]() ![]() | ICompany |
Company information
![]() Check if user belongs to "SAP" company and notify user using IWorkflowContext within custom action script.Python if User.Company.Name == "SAP": WorkflowContext.ClientScript = "alert('Welcome to SAP!')"; |
![]() ![]() | IContainer |
Container information
![]() Move container row upMoving of container row has impact on the total order of container rows, so if row is identified while iterating through container rowsperform moving of row and add break to exit the current iteration. See following code as example. Python container = Product.GetContainerByName("Assets") for row in container.Rows: if row['LicenceKey'] == 'Licence 2': container.MoveRowUp(row.RowIndex) break |
![]() ![]() | IContainerColumn | Container column information |
![]() | IContainerColumnCollection | Container column collection |
![]() | IContainerProperty | Container property information |
![]() | IContainerPropertyCollection | Container property collection |
![]() | IContainerRow | Container row information |
![]() | IContainerRowCollection | Container row collection |
![]() | IConvert | Helper string conversion class. |
![]() | ICrmLandingEventArguments | Argument provided when 'On Landing From Crm' event occurs. |
![]() | ICryptography | Utility methods related to cryptography. |
![]() ![]() | ICustomer |
Customer inforamtion
![]() Check if bill to customer is selected and show alert message using IWorkflowContext within custom action script.Python if Quote.BillToCustomer is not None: WorkflowContext.ClientScript = "alert('" + Quote.BillToCustomer.FirstName + " " + Quote.BillToCustomer.LastName + "')"; |
![]() | ICustomerHelper | Customer helper interface |
![]() ![]() | ICustomFieldChangedArgument |
Custom field change argument is passed when the custom field change event occurs.
This class can be accessed via "arg" variable within the custom field change event handler.
![]() Using this argument on custom field change scriptPython diff = float(arg.NewValue) - float(arg.OldValue); Quote.GetCustomField("CustomField1").Content = "You have changed custom field value for " + str(diff) + " points." |
![]() | IDocumentPricingResponse | Pricing condition data. |
![]() | IFederationUtility | Federation helper methods |
![]() | IFileHelper | File helper |
![]() | IGeneratedDocument | Generated document |
![]() | IGeneratedDocumentCollection | Generated documents collection |
![]() | IHttpUtility | Provides methods for encoding and decoding URLs when processing Web requests. |
![]() | IHttpWebClientProtocol | HttpWebClientProtocol |
![]() | IItemAction | Item Action |
![]() | IItemActionCollection | Item action collection |
![]() | IItemActionId | |
![]() | IItemCustomField | Item custom field data. Contains additional data related to quote item custom field. |
![]() | IItemCustomFieldCollection | Item custom field collection |
![]() | IItemInfo | ItemInfo class is used to add additional information to cart item. These additional information can be added via administration. |
![]() | IJsonHelper | Represents an object with which we can serialize/deserialize JSON data. |
![]() ![]() | IKeyAttribute |
Key Attributes allow setting up an attribute as search criteria on the user side.
This means that the user can search for quotes based on the value of their Key Attributes.
User can set input value for Key Attribute via Scripting
![]() Setting input value without reconfigure for Key Attribute through ScriptingPython for item in Quote.MainItems: if item.GetKeyAttributeByAttributeName("Memory") is not None: item.GetKeyAttributeByAttributeName("Memory").SetInputValue("Memory key") Setting input value with reconfigure for Key Attribute through ScriptingPython for item in Quote.MainItems: if item.GetKeyAttributeByAttributeName("Memory") is not None: item.GetKeyAttributeByAttributeName("Memory").SetInputValue("Memory key", True) if item.GetKeyAttributeByAttributeName("Processor") is not None: item.GetKeyAttributeByAttributeName("Processor").SetInputValue("Processor key", False) Setting the key attribute value without reconfigure through ScriptingPython for item in Quote.MainItems: if item.GetKeyAttributeByAttributeName("Memory") is not None: item.GetKeyAttributeByAttributeName("Memory").SetInputValue("Memory_cpq") Setting the key attribute value with reconfigure through ScriptingPython for item in Quote.MainItems: if item.GetKeyAttributeByAttributeName("Memory") is not None: item.GetKeyAttributeByAttributeName("Memory").SetInputValue("Memory_cpq", True) if item.GetKeyAttributeByAttributeName("Processor") is not None: item.GetKeyAttributeByAttributeName("Processor").SetInputValue("Processor_cpq", False) |
![]() | IKeyAttributeCollection | Key attribute collection |
![]() ![]() | ILineItem |
Line Item
![]() Getting Key Attribute by attribute system id through ScriptingPython for mainItem in Quote.MainItems: if mainItem.ProductName == "Laptop": for lineItem in mainItem.LineItems: if lineItem.ProductName == "Laptop bag": Quote.GetCustomField("Custom Field 1").Content = lineItem.GetKeyAttribute("laptop_bag_cpq").Label Getting Key Attribute by attribute name through ScriptingPython for mainItem in Quote.MainItems: if mainItem.ProductName == "Laptop": for lineItem in mainItem.LineItems: if lineItem.ProductName == "Laptop bag": Quote.GetCustomField("Custom Field 2").Content = lineItem.GetKeyAttributeByAttributeName("Laptop Bag").Label Getting Key Attribute by attribute label through ScriptingPython for mainItem in Quote.MainItems: if mainItem.ProductName == "Laptop": for lineItem in mainItem.LineItems: if lineItem.ProductName == "Laptop bag": Quote.GetCustomField("Custom Field 3").Content = lineItem.GetKeyAttributeByLabel("Laptop Bag").ParsedValue Python item = Quote.GetItemByQuoteItem("2.1") Quote.GetCustomField("Custom Field 4").Content = item.AsLineItem.GetKeyAttributeByLabel("Memory").Label |
![]() | ILineItemCollection | Line item collection |
![]() | ILog | ILog class write messages to log |
![]() | IMailAddress | Represents the address of an electronic mail sender or recipient. |
![]() | IMailMessage | MailMessage used by SmtpClient to send mails. |
![]() ![]() | IMainItem |
Main item
![]() Check if copy action is available and execute itIn order to easy get item action id, use item action id constants in following format:Quote.ItemActionId.CopyItemId, Quote.ItemActionId.EditItemId, Quote.ItemActionId.UpgradeToNewProductVersionItemId etc. Python for item in Quote.MainItems: if item.PartNumber == "PART-NUMBER-123": for action in item.Actions: if action.Id == Quote.ItemActionId.CopyItemId: item.Copy() Getting Key Attribute by attribute system id through ScriptingPython for item in Quote.MainItems: if item.GetKeyAttribute("Hard Drive") is not None: ka = item.GetKeyAttribute("Hard Drive") ka.Label = "Hard Drive" Getting Key Attribute by attribute name through ScriptingPython for item in Quote.MainItems: if item.GetKeyAttributeByAttributeName("Hard Drive") is not None: ka = item.GetKeyAttributeByAttributeName("Hard Drive") ka.Label = "Hard Drive" Getting Key Attribute by attribute label through ScriptingPython for item in Quote.MainItems: if item.GetKeyAttributeByLabel("Hard Drive") is not None: ka = item.GetKeyAttributeByLabel("Hard Drive") ka.Label = "New label for Hard Drive" Python item = Quote.GetItemByQuoteItem("2.1") Quote.GetCustomField("Custom Field 1").Content = item.AsMainItem.GetKeyAttributeByLabel("Memory").Label Calculating Rolled Up values of Main ItemsPython miItems = [] for item in Quote.MainItems: miItems.append(item) miItems.reverse() for mi in miItems: mi.RolledUpListPrice = mi.ListPrice mi.RolledUpExtendedListPrice = mi.ExtendedListPrice mi.RolledUpNetPrice = mi.NetPrice mi.RolledUpExtendedAmount = mi.ExtendedAmount mi.RolledUpEndCustomerUnitPrice = mi.EndUserNet mi.RolledUpEndCustomerExtendedPrice = mi.EndUserExtendedAmount mi.RolledUpCost = mi.Cost mi.RolledUpExtendedCost = mi.ExtendedCost mi.RolledUpDiscountAmount = mi.DiscountAmount for li in mi.LineItems: if li.IsOptional: continue mi.RolledUpListPrice += li.ListPrice mi.RolledUpExtendedListPrice += li.ExtendedListPrice mi.RolledUpNetPrice += li.NetPrice mi.RolledUpExtendedAmount += li.ExtendedAmount mi.RolledUpEndCustomerUnitPrice += li.EndUserNet mi.RolledUpEndCustomerExtendedPrice += li.EndUserExtendedAmount mi.RolledUpCost += li.Cost mi.RolledUpExtendedCost += li.ExtendedCost mi.RolledUpDiscountAmount += li.DiscountAmount Inline edit of existing configurable item on the quoteConfiguration of quote main item can be updated automatically through scripting without leaving currently opened quote (for example, by clicking custom quote action with following script example).All quote calculations will be executed in the same way as item is manually updated from the configurator. Important note - rules will not be triggered when attribute values are modified through scripting. To enforce standard CPQ rules' execution, add Product.ApplyRules() before doing update of configuration. Python for mainItem in Quote.MainItems: if mainItem.ProductName == 'Maintenance': mainItem.Edit() Product.Attributes.GetByName('Maintenance duration').SelectValue('5-YEARS') Product.Attributes.GetByName('Contract Type').AssignValue('Updated contract') if Product.Attributes.GetByName('1 Year Support').SelectedValue is not None: Product.Attributes.GetByName('1 Year Support').SelectedValue.IsSelected = False Product.UpdateQuote() break |
![]() | IMainItemCollection | Main item collection |
![]() | IMarket | Market |
![]() ![]() | ImutualTLSRestClient |
Client for communication with RESTful services using client certificates generated/uploaded via Cerificate Management feature: Setup -> Security -> Certificate Management -> System Certificates (name of the certificate with Client Certificate Authentication purpose).
![]() Call current weather data for one locationCall service with providing city name and country/region code. API responds with a list of results that match a searching word.API call: http://api.openweathermap.org/data/2.5/weather?q={city name},{country/region code} Parameters: q city name and country/region code divided by comma, use ISO 3166 country/region codes Python #response is in JSON form of: #{"main":{"temp":291.05,"pressure":1016,"humidity":88,"temp_min":288.15,"temp_max":296.15}, #"weather":[{"id":701,"main":"Mist","description":"mist","icon":"50n"}], #"id":5391959,"name":"San Francisco","cod":200,"base":"stations"} response = mTLSRestClient.Get('ApiCertificate', 'http://api.openweathermap.org/data/2.5/weather?q=SanFrancisco,usa') Quote.GetCustomField('City').Content = response.name Quote.GetCustomField('Weather Today').Content = str(response.weather[0].main) Quote.GetCustomField('Weather Today Details').Content = str(response.weather[0].description) Quote.GetCustomField('Weather Temperature MIX').Content = str(response.main.temp_max) Quote.GetCustomField('Weather Temperature MAX').Content = str(response.main.temp_min) Submit an HTTPS POST request with client certificate authentication and JSON input data to the serverSubmits JSON data to be processed to a specified resource and returns JSON response.Response is deserialized, in order to be used as object in scripting. Python #example of url service url = 'https://testcallidus.com/CallidusPortal/services/some-example-service' headers = { } #example of input JSON data data = '[{"name": "SaaS Net New Revenue", "periodType": "month", "type": "Measurement", "value": { "amount": 100, "unitType": "USD" }}]' #make HTTPS POST and receive response in form of dynamic entity response = mTLSRestClient.Post('AuthorizationCertificate' ,url, data, headers) #Populate Quote custom fields Quote.GetCustomField('Bonus type').Content = response.name Quote.GetCustomField('Bonus amount').Content = str(response.value.amount) Quote.GetCustomField('Bonut unit type').Content = response.value.unitType |
![]() | INetworkCredential | Provides credentials for password-based authentication. |
![]() | INotifications | Notifications. |
![]() | IPartnerFunction | Partner function interface. |
![]() | IPartnerFunctionRepository | Partner function repository. Used to retrieve data about partner functions. |
![]() | IPartnerFunctionTranslation | Partner function translation interface. |
![]() | IPostedFile | Posted File information |
![]() | IProduct | Product information |
![]() | IProductAddEditArgument | Product added/updated argument is passed when the product added/updated to the quote event occurs. |
![]() | IProductAttribute | Product attribute information |
![]() | IProductAttributeCollection | Product attribute collection |
![]() | IProductAttributeValue | Product attribute value information |
![]() | IProductAttributeValueCollection | Product attribute value collection |
![]() | IProductBeforeAddToQuoteEventArgument | Before product Add to quote argument is passed before 'Product is added to the quote' event occurs. |
![]() | IProductErrorMessages | Product error messages. Messages are shown in the responder part of the configurator as errors. |
![]() ![]() | IProductHelper |
Helper class which allow us to globally manipulate the products.
![]() Check if product is simple by product's system idPython if ProductHelper.IsSimpleProduct("Laptop_Computer_cpq"): Quote.GetCustomField("SimpleProducts").Content = "Laptop is simple product" else: Quote.GetCustomField("SimpleProducts").Content = "Laptop is configurable product" Inline adding new product with configuration to the quoteProduct with configuration can be configured and added automatically through scripting without leaving currently opened quote (for example, by clicking custom quote action with following script example)or can be inlined configured and added from other product's configurator through script attached on some product event (When product rule execution ends, When product configuration is completed, Before Add to quote, When product is added to quote etc.). All quote calculations will be executed in the same way as item is manually added from the configurator. Important note - rules will not be triggered when attribute values are modified through scripting. To enforce standard CPQ rules' execution, add Product.ApplyRules() before doing update of configuration. Python inlineProduct = ProductHelper.CreateProduct('Maintenance_cpq') inlineProduct.Attributes.GetByName('1 Year Support').SelectValue('1') inlineProduct.Attributes.GetByName('Maintenance duration').SelectValue('1-YEAR') inlineProduct.Attributes.GetByName('Contract Type').AssignValue('New contract signed') inlineProduct.AddToQuote() |
![]() | IProductInfo | Provides information about a product exposed on 'On Configure' event. |
![]() | IProductMessages | Product configuration template messages. Messages are shown in the responder part of the configurator. |
![]() | IProductTab | Product Tab information |
![]() ![]() | IProductTabChangedArgument |
Product tab change argument is passed when the product tab change event occurs.
This class can be accessed via "arg" variable within the product tab change event script.
![]() Using this argument on product tab change scriptPython if arg.NameOfCurrentTab == 'Second tab': Product.Attributes.GetByName("Message").AssignValue("You have changed tab from " + arg.NameOfPreviousTab + " to " + arg.NameOfCurrentTab); |
![]() | IProductTabCollection | Product tab collection |
![]() | IProductType | Product Type information |
![]() ![]() | IProductTypeItem |
Represent product type quote item
![]() Setting product type's discount amount according to subtotal for currently selected marketPython for productTypeItem in Quote.ProductTypes: if productTypeItem.SubtotalInMarket > 1500: productTypeItem.DiscountAmount = 250 else: productTypeItem.DiscountAmount = 50 |
![]() | IProductTypeItemCollection | Product type item collection |
![]() | IProductValidationMessage | Product Validation Message |
![]() | IProductValidationMessageCollection | Product validation message collection |
![]() ![]() | IQuote |
Quote
![]() Execute quote actionIn order to easy get quote action id, use action id constants in following format:Quote.QuoteActionId.ViewQuoteId, Quote.QuoteActionId.DeleteQuoteId, Quote.QuoteActionId.ArchiveQuoteId, Quote.QuoteActionId.CopyQuoteId, Quote.QuoteActionId.QuoteWonId etc. Python Quote.ExecuteAction(Quote.QuoteActionId.PlaceOrderId) Adding new additional discount to quoteSee IAdditionalDiscount how to set additional discount in the quoteAttaching the specified Opportunity to quotePython Quote.AttachToQuote("0063000000aiy99AAA") Changing Quote Status to specified Quote StatusPython Quote.ChangeQuoteStatus("Waiting for Approval") Determining whether quote contails any Product with specified system id(s)Python if Quote.ContainsAnyProduct("SMB_Desktop_computer_cpq", "Laptop_IBM_cpq"): Quote.CustomFields.DisallowValues("Custom Field Name 1", "Custom Field Value 1", "Custom Field Value 2") Determining whether quote contains any Product with specified product name(s)Python if Quote.ContainsAnyProductByName("SMB Desktop", "Laptop IBM"): Quote.CustomFields.Allow("Hard Drive", "Memory") Determining whether quote contains any Product with specified part number(s)Python if Quote.ContainsAnyProductByPartNumber("SMB 12345", "IBM 12345") Quote.CustomFields.Allow("Hard Drive", "Memory") Determining whether quote contains any item with specified Product Type system id(s)Python if Quote.ContainsAnyProductType("Hardware_cpq", "Software_cpq") Quote.GetCustomField("Info").Content = "Quote is containing hardware and software products" Determining whether quote contains any item with specified Product Type name(s)Python if Quote.ContainsAnyProductTypeByNames("Hardware", "Software") Quote.GetCustomField("Info").Content = "Quote is containing hardware and software products" Getting Additional Discount from quoteSee IAdditionalDiscount how to get additional discount in the quoteGetting Custom Field by strong nameSee IQuoteCustomField how to get custom field by strong nameGetting Quote Item by quote itemPython if Quote.GetItemByQuoteItem(1) is not None: Quote.GetCustomField("Custom Field 1").Content = Quote.GetItemByQuoteItem(1).AsMainItem.RolledUpExtendedAmount Python if Quote.GetItemByQuoteItem("1.1") is not None: Quote.GetCustomField("Custom Field 2").Content = Quote.GetItemByQuoteItem("1.1").AsMainItem.RolledUpDiscountAmount Getting Quote Item by unique identifierPython if Quote.GetItemByUniqueIdentifier("293f526d-37ad-4c7b-af66-182a7d3f3f0d") is not None: Quote.GetCustomField("Custom Field 3").Content = Quote.GetItemByUniqueIdentifier("293f526d-37ad-4c7b-af66-182a7d3f3f0d").AsMainItem.ShippingCostInMarket Getting Items by Product Type system idPython quoteItems = Quote.GetItemsByProductTypeSystemId("Hardware_cpq") for item in quoteItems: totalHardwarePrice = totalHardwarePrice + item.ListPriceInMarket Getting latest generated Document FilePython fileName = Quote.GetLatestGeneratedDocumentFileName() Getting latest generated Document File in bytesPython fileInBytes = Quote.GetLatestGeneratedDocumentInBytes() Getting generated document listPython docList = Quote.GetGeneratedDocumentList() Getting generated document list by template namePython docList = Quote.GetGeneratedDocumentList("templateName") Getting attached document listPython docList = Quote.GetAttachedDocumentList() Getting attached document by document idPython doc = Quote.GetAttachedDocument(100) Getting Product Type Item by specified product type system idPython if Quote.GetProducType("Software_cpq") is not None: Quote.GetCustomField("Custom Field 1").Content = Quote.GetProducType("Software_cpq").ProductTypeNameTranslated Getting Product Type Item by specified product type namePython if Quote.GetProductTypeByName("Software") is not None: Quote.GetCustomField("Custom Field 1").Content = Quote.GetProductTypeByName("Software").ProductTypeNameTranslated Creating new additional discountSee IAdditionalDiscount how to create additional discount in the quoteRemoving additional discountSee IAdditionalDiscount how to remove additional discount from the quoteCreate new revision for the quote and set it activeSee IQuoteInfo how to create new active revision.Showing custom messagesPython Quote.Messages.Add("message") |
![]() | IQuoteActionId | |
![]() ![]() | IQuoteCustomField |
Quote Custom Field
![]() Setting content of Custom FieldPython Quote.GetCustomField("Custom Field 1").Content = "new content" Getting content of Custom FieldPython if Quote.GetCustomField("Custom Field 1") is not None: cf = Quote.GetCustomField("Custom Field 1").Content Setting visibility of Custom FieldPython Quote.GetCustomField("Custom Field 2").Visible = False Setting label of Custom Field. |
![]() ![]() | IQuoteCustomFieldAttributeValue |
Quote Custom Field Attribute Value
![]() Disallow Custom Field attribute valuePython customField = Quote.GetCustomField("CD or DVD drive") for value in customField.AttributeValues: if value.DisplayValue == "Combo DVD/CD-R 12/52/16/52": value.Allowed = False Set Custom Field attribute value code as Custom Field contentPython customField = Quote.GetCustomField("CD or DVD drive") for value in customField.AttributeValues: if value.DisplayValue == "Combo DVD/CD-R 12/52/16/52": Quote.GetCustomField("Custom Field 1").Content = value.ValueCode |
![]() | IQuoteCustomFieldAttributeValueCollection | Quote custom field attribute value collection |
![]() ![]() | IQuoteCustomFieldCollection |
Quote custom field collection
![]()
The IQuoteCustomFieldCollection class wrap the list of IQuoteCustomField and expose the methods for quote custom fields manipulations. ![]() Allowing Custom Field(s) by strong name(s)Python Quote.CustomFields.Allow("Custom Field Name 1") Python Quote.CustomFields.Allow("Custom Field Name 1", "Custom Field Name 2", "Custom Field Name 3") Disallowing Custom Field(s) by strong name(s)Python Quote.CustomFields.Disallow("Custom Field Name 1") Python Quote.CustomFields.Disallow("Custom Field Name 1", "Custom Field Name 2", "Custom Field Name 3") Allowing value of Custom Field by custom field's strong name and attribute value system idPython Quote.CustomFields.AllowValue("Custom Field Name 1", "Custom_Field_1_Value_1_cpq") Allowing values of Custom Field by custom field's strong name and attribute value system idsPython Quote.CustomFields.AllowValues("Custom Field Name 1", "Custom_Field_1_Value_1_cpq", "Custom_Field_1_Value_2_cpq") Allowing value of Custom Field by custom field's strong name and attribute value codePython Quote.CustomFields.AllowValueByValueCode("Custom Field Name 1", "Value 1") Allowing values of Custom Field by custom field's strong name and attribute value codesPython Quote.CustomFields.AllowValuesByValueCodes("Custom Field Name 1", "Value 1", "Value 2", "Value 3") Disallowing value of Custom Field by custom field's strong name and attribute value system idPython Quote.CustomFields.DisallowValue("Custom Field Name 1", "Custom_Field_1_Value_1_cpq") Disallowing values of Custom Field by custom field's strong name and attribute value system idsPython Quote.CustomFields.DisallowValues("Custom Field Name 1", "Custom_Field_1_Value_1_cpq", "Custom_Field_1_Value_2_cpq") Disallowing value of Custom Field by custom field's strong name and attribute value codePython Quote.CustomFields.DisallowValueByValueCode("Custom Field Name 1", "Value 1") Disallowing values of Custom Field by custom field's strong name and attribute value codesPython Quote.CustomFields.DisallowValuesByValueCodes("Custom Field Name 1", "Value 1", "Value 2", "Value 3") Assigning the specified text to Custom Field.Python Quote.CustomFields.AssignValue("Custom Field Name 1", "New text value") Disallowing all Custom Field Values except values with specified attribute value system id(s)Python Quote.CustomFields.DisallowAllValuesExcept("Custom Field Name 1", "Custom_Field_1_Value_1_cpq") Python Quote.CustomFields.DisallowAllValuesExcept("Custom Field Name 1", "Custom_Field_1_Value_1_cpq", "Custom_Field_1_Value_2_cpq") Disallowing all Custom Field Values except values with specified attribute value code(s)Python Quote.CustomFields.DisallowAllValuesExceptByValueCodes("Custom Field Name 1", "Value 1") Python Quote.CustomFields.DisallowAllValuesExceptByValueCodes("Custom Field Name 1", "Value 1", "Value 2", "Value 3") Selecting Custom Field Value by attribute value system id.Python Quote.CustomFields.SelectValue("Custom Field Name 1", "Custom_Field_1_Value_1_cpq") Selecting Custom Field Value by attribute value code.Python Quote.CustomFields.SelectValueByValueCode("Custom Field Name 1", "Value 1") Reseting the custom field(s)Python Quote.CustomFields.Reset("Custom Field Name 1") Python Quote.CustomFields.Reset("Custom Field Name 1", "Custom Field Name 2", "Custom Field Name 3") Setting the specifed Custom Field(s) optionalPython Quote.CustomFields.SetOptional("Custom Field Name 1") Python Quote.CustomFields.SetOptional("Custom Field Name 1", "Custom Field Name 2", "Custom Field Name 3") Setting the specifed Custom Field(s) requiredPython Quote.CustomFields.SetRequired("Custom Field Name 1") Python Quote.CustomFields.SetRequired("Custom Field Name 1", "Custom Field Name 2", "Custom Field Name 3") |
![]() ![]() | IQuoteHelper |
Helper class which allow us to globally manipulate the quotes.
![]() Reassign quote to specified userReturn parameter is of type IQuoteInfo,containing new quote id, new user id, new composite quote number and new composite quote number crypted. Python quoteInfo = QuoteHelper.Reassign("00021520", "jsmith", True) Dispose currently loaded quote environment in order to delete quoteExecuting delete on currently loaded quote will cause break.In order to delete loaded quote, it should be first disposed by using Quote.Dispose() - IQuote. Python quoteCompositeNumber = Quote.CompositeNumber Quote.Dispose() QuoteHelper.Delete(quoteCompositeNumber) |
![]() ![]() | IQuoteInfo |
Quote Info helper
![]() Create new active revision and get data for new revisionPython revisionInfo = Quote.CreateNewRevision(True) |
![]() ![]() | IQuoteItem |
Represent abstract class which expose common interface for main and line items
![]() Getting Quote Item as main item and setting it's mrc rolled up extended cost for currently selected market as custom field contentPython item = Quote.GetItemByUniqueIdentifier("293f526d-37ad-4c7b-af66-182a7d3f3f0d") Quote.GetCustomField("Custom Field 1").Content = item.AsMainItem.MrcRolledUpExtendedCostInMarket Getting Quote Item as line item and setting it's translated attribute name as custom field contentPython item = Quote.GetItemByUniqueIdentifier("293f526d-37ad-4c7b-af66-182a7d3f3f0d") Quote.GetCustomField("Custom Field 2").Content = item.AsLineItem.AttributeNameTranslated Getting Key Attribute by attribute system id through ScriptingSee IMainItem and ILineItem how to get key attribute by attribute system id through ScriptingGetting Key Attribute by attribute name through ScriptingSee IMainItem and ILineItem how to get key attribute by attribute name through ScriptingGetting Key Attribute by attribute label through ScriptingSee IMainItem and ILineItem how to get key attribute by attribute label through Scripting |
![]() | IQuoteItemAttribute | Represents attribute of the product referenced in Quote Item |
![]() | IQuoteItemAttributeCollection | Collection of all attributes selected in product referenced in Quote Item |
![]() | IQuoteItemAttributeValue | Represents selected value of the attribute of referenced product in Quote Item |
![]() | IQuoteItemCollection | Quote item collection |
![]() | IQuoteItemContainer | Represents container attribute of quote item |
![]() | IQuoteItemContainerColumn | Represents column of container attribute referenced in quote item's product |
![]() | IQuoteItemContainerColumnCollection | Collection of container columns |
![]() | IQuoteItemContainerProperty | Represent property of quote item's container attribute |
![]() | IQuoteItemContainerPropertyCollection | Represents collection of container properties of quote item's container attribute |
![]() | IQuoteItemContainerRow | Represent row of quote item's container attribute |
![]() | IQuoteItemContainerRowCollection | Represents collection of rows of quote item's container attribute |
![]() ![]() | IQuoteItemCustomField |
Quote item custom fields are basically additional quote columns that can store values of different types (number, currency, date or text).
![]() Setting value for specified quote itemPython Quote.GetItemByUniqueIdentifier("4dbc4075-67a3-43ab-b121-9792f0abc18b")["textfield"].Value = "some text" Quote.GetItemByUniqueIdentifier("4dbc4075-67a3-43ab-b121-9792f0abc18b")["numberfield"].Value = 123 |
![]() ![]() | IQuoteOrderStatus |
Quote Order Status
![]() Getting Quote Order Status translated name in currently selected languagePython if Quote.OrderStatus is not None: if Quote.OrderStatus.NameTranslated == "Waiting for Approval": Quote.ChangeQuoteStatus("Approved") |
![]() ![]() | IQuoteTotal |
Quote Total
![]() Setting Total Shipping Cost according to Total List Price in currently selected marketPython if Quote.Total.TotalListPriceInMarket > 15000: Quote.Total.ShippingCost = Quote.Total.TotalListPrice - Quote.Total.Cost Setting Quote Total Tax PercentIf Quote Total column is not editable on the quote, set Quote Total Tax Percent as State tax percentPython if ((Quote.Total.IsFieldEditable("TaxPercent") is False) and (Quote.Total.IsFieldEditable("TaxAmount") is False)): taxPercent = 0.0 if Quote.ShipToCustomer is not None and len(Quote.ShipToCustomer.StateAbbreviation) > 0: taxPercent = SqlHelper.GetFirst("select SALES_TAX_RATE from STATE_TAX where STATE_SHORT_NAME='" + \ Quote.ShipToCustomer.StateAbbreviation + "'") Quote.Total.TaxPercent = taxPercent Setting Quote Total AmountIf Tax should be included in Total Price, set Quote Total Amount as sum of Total Shipping Cost, Total Tax Amount and Total Vat AmountPython result += Quote.Total.ShippingCost
if Quote.IncludeTaxInTotalPrice:
result += Quote.Total.TaxAmount
result += Quote.Total.VatAmount
Quote.Total.TotalAmount = result Setting Monthly Recurring (MRC) Total AmountSetting Monthly Recurring Amount as sum of MRC Subototal Amount, MRC Vat Amount and MRC Tax AmountPython Quote.Total.MrcTotalAmount = Quote.Total.MrcSubtotalAmount + Quote.Total.MrcVatAmount + Quote.Total.MrcTaxAmount |
![]() ![]() | IQuoteTotalCustomField |
Total on quote or product type level for quote item custom field.
![]() Setting value for specified quote itemPython Quote.GetCustomField("Test").Content = str(Quote.Total["mycustomfield"].MaximumCV) for productTypeItem in Quote.ProductTypes: if productTypeItem.ProductTypeName == "Hardware": Quote.GetCustomField("Test").Content = str(productTypeItem["mycustomfield"].MaximumCV + 3) |
![]() | IRandom | The Random object is used to generate random numbers through scripting. |
![]() | IReadOnlyProductMessages | Product configuration template messages. Messages are shown in the responder part of the configurator. |
![]() ![]() | IRequest | Represent class for manipulation with user request. |
![]() | IRequestContext | RequestContext represents a CPQ helper class that can be used to store additional information and entities that would be shared across one HTTP request Items set in one script have the validity equal to one HTTP request |
![]() | IRequestItems | Represents the key value collection that has a life cycle of one HTTP request |
![]() ![]() | IRestClient |
Client for communication with RESTful services
![]() Call current weather data for one locationCall service with providing city name and country/region code. API responds with a list of results that match a searching word.API call: http://api.openweathermap.org/data/2.5/weather?q={city name},{country/region code} Parameters: q city name and country/region code divided by comma, use ISO 3166 country/region codes Python #response is in JSON form of: #{"main":{"temp":291.05,"pressure":1016,"humidity":88,"temp_min":288.15,"temp_max":296.15}, #"weather":[{"id":701,"main":"Mist","description":"mist","icon":"50n"}], #"id":5391959,"name":"San Francisco","cod":200,"base":"stations"} response = RestClient.Get('http://api.openweathermap.org/data/2.5/weather?q=SanFrancisco,usa') Quote.GetCustomField('City').Content = response.name Quote.GetCustomField('Weather Today').Content = str(response.weather[0].main) Quote.GetCustomField('Weather Today Details').Content = str(response.weather[0].description) Quote.GetCustomField('Weather Temperature MIX').Content = str(response.main.temp_max) Quote.GetCustomField('Weather Temperature MAX').Content = str(response.main.temp_min) Submit an HTTPS POST request with authorization and JSON input data to the serverSubmits JSON data to be processed to a specified resource and returns JSON response.Response is deserialized, in order to be used as object in scripting. Python #example of url service url = 'https://testcallidus.com/CallidusPortal/services/some-example-service' #example of user autorization header headers = { 'authorization': RestClient.GetBasicAuthenticationHeader('SAPUsername', 'SAPPassword') } #example of input JSON data data = '[{"name": "SaaS Net New Revenue", "periodType": "month", "type": "Measurement", "value": { "amount": 100, "unitType": "USD" }}]' #make HTTPS POST and receive response in form of dynamic entity response = RestClient.Post(url, data, headers) #Populate Quote custom fields Quote.GetCustomField('Bonus type').Content = response.name Quote.GetCustomField('Bonus amount').Content = str(response.value.amount) Quote.GetCustomField('Bonus unit type').Content = response.value.unitType |
![]() | IRestServiceHelper | Represent abstract class which expose common interface for supporting Litmos integration with CPQ. See 'How To Integrate With Litmos' for details of how to support integration. |
![]() ![]() | ISalesArea |
Class which allow us to fetch sales area data.
Class represents the combination of Sales Organization, Distribution Channel and Division
![]() Get the distribution channelReturn parameter is of type String,Python distributionChannel = SalesArea.DistributionChannel Get the sales area divisionReturn parameter is of type String,Python division = SalesArea.Division Get the sales organizationReturn parameter is of type String,Python salesOrganization = SalesArea.SalesOrganization |
![]() | ISamlAssertionProvider | SamlAssertionProvider serves us to generate saml assertion. |
![]() | ISapPassport | Represent interface for creating SAP Passport headers. Visit following link for more information: https://help.sap.com/doc/f53c64b93e5140918d676b927a3cd65b/Cloud/en-US/docs-en/guides/features/tracing/android/passport.html |
![]() ![]() | IScriptExecutor |
API that gives you ability to run script from another script. Script that's executed needs to be active.
![]() To execute script from the current code, use the following call:Python ScriptExecutor.Execute("My_Script") If the script you're executing returns a value, use the following code:Python result = ScriptExecutor.Execute("My_Script") # **** SCRIPT WHICH RETURNS SOME VALUE MUST SET THAT VALUE TO VARIABLE NAMED 'Result' **** # example: My_Script # .... logic here... x = "some return value..." Result = x In case the script name is not valid or script is not active, Execute() method will return 'None' value.You can also provide input parameters that are required in called script. All input parameters should be put in dictionary:Python result = ScriptExecutor.Execute("My_Script", {'ID':5, 'Name': 'John', 'Company': 'ABC Inc'}) # In script "My_Script", you can use these input parameters by consuming variable 'Param' like follows: #...logic here... name = Param.Name id = Param.ID company = Param.Company # note that Param properties must be named exactly the same as input parameters in Execute() method Product.Attributes.GetByName("Name").AssignValue(name) Product.Attributes.GetByName("Id").AssignValue(id) Product.Attributes.GetByName("Company").SelectValue(company) #...... ![]() To execute global script from the current code, use the following call:Python ScriptExecutor.ExecuteGlobal("My_Global_Script") If the global script you're executing returns a value, use the following code:Python result = ScriptExecutor.ExecuteGlobal("My_Global_Script") # **** GLOBAL SCRIPT WHICH RETURNS SOME VALUE MUST SET THAT VALUE TO VARIABLE NAMED 'Result' **** # example: My_Global_Script # .... logic here... x = "some return value..." Result = x In case the global script name is not valid or global script is not active, ExecuteGlobal() method will return 'None' value.You can also provide input parameters that are required in called global script. All input parameters should be put in dictionary:Python result = ScriptExecutor.ExecuteGlobal("My_Global_Script", {'ID':6, 'Name': 'Jack', 'Company': 'DEF Inc'}) # In script "My_Global_Script", you can use these input parameters by consuming variable 'Param' like follows: #...logic here... name = Param.Name id = Param.ID company = Param.Company # note that Param properties must be named exactly the same as input parameters in ExecuteGlobal() method Product.Attributes.GetByName("Name").AssignValue(name) Product.Attributes.GetByName("Id").AssignValue(id) Product.Attributes.GetByName("Company").SelectValue(company) #...... |
![]() | IScriptingMarket | Market |
![]() | IScriptingMarketCollection | |
![]() | ISelectedDictionary | Represents the selected dictionary. |
![]() ![]() | ISession |
Represents class for keeping an object within the session. These objects can be shared among scripts. Lifetime of these objects ends when the user signs out. |
![]() ![]() | IShipping |
Shipping
![]() Assign selected Shipping Name to custom fieldPython if Quote.SelectedShipping is not None: Quote.GetCustomField("Custom Field 1").Content = Quote.SelectedShipping.ShippingName Set Total Shipping CostIf Shipping is loaded for all items and Shipping column is not editable, set Total Shipping CostPython if Quote.IsShippingLoadedForAllItems and item.IsMainItem and (Quote.SelectedShipping is not None) and \ (Quote.SelectedShipping.Editable is False): Quote.Total.ShippingCost += item.AsMainItem.ShippingCost * item.AsMainItem.Quantity |
![]() | ISmtpClient | The SmtpClient object is used to send emails through scripting. |
![]() | ISoapHttpClientProtocol | SoapHttpClientProtocol |
![]() ![]() | ISqlHelper |
Helper class which allows us to pull data from database using SQL select statements.
![]() Insert/Update examplePython #insert tableInfo = SqlHelper.GetTable("ITEMMASTERFROMNS") tablerow = { "item_internal_id" : itemInternalId, "item_sku" : sku } tableInfo.AddRow(tablerow) upsertResult = SqlHelper.Upsert(tableInfo) #update tablerow = { "CpqTableEntryId" : currentQuoteCpqTableEntryId, "OpportunityId" : oppId, "QuoteNumber" : Quote.CompositeNumber, "IsPrimary" : 1 } tableInfo.AddRow(tablerow) SqlHelper.Upsert(tableInfo) Delete examplePython primaryQueryItems = SqlHelper.GetList("select CpqTableEntryId, OpportunityId, QuoteNumber, ItemGuid, OpportunityProductID from OpportunityQuoteItems where OpportunityId = '{0}' and QuoteNumber={1}".format(oppId, primaryQuoteNumber)) tableInfo = SqlHelper.GetTable("OpportunityQuoteItems") for primaryItem in primaryQueryItems: tableInfo.AddRow(primaryItem) SqlHelper.Delete(tableInfo) |
![]() ![]() | ISqlHelperInfo |
Sql Helper Info
![]() Provide result info for SqlHelper methodsPython sqlInfo = SqlHelper.Upsert(tableInfoData, tableName) |
![]() | ISqlParameter | Represents a parameter of a SQL statement, which is used for creation of parameterized SQL queries. |
![]() | IStreamReader | Wrapper of System.IO.StreamReader for IronPython Scripting with limited set of features |
![]() ![]() | ITableColumnInfo |
TableColumnInfo
![]() Provide description of a table column including name, type, size and if it can be nullPython |
![]() ![]() | ITableDataRow |
TableDataRow
![]() Data in a row that will be used to insert, update or delete a row in custom table.Python |
![]() ![]() | ITableInfo |
Table Info
![]() Table definition including name, list of columns, data rows that will be used for upsert or delete and IsNew flag to indicate if table doesn't exist and new table will be createdPython |
![]() ![]() | ITagParserProduct |
Tag parser product
![]() Parsing product tab expressionPython if float(TagParserProduct.ParseString("<* TotalPrice *>")) > 3000: Quote.Total.Cost = 300 |
![]() ![]() | ITagParserQuote |
Tag parser quote
![]() Parsing quote tab expressionPython if TagParserQuote.ParseString("<* CustomerCompany *>") == "SAP": Quote.GetCustomField("Customer company") = "SAP company" |
![]() | ITechnicalDocumentation | Technical Documentation Helper |
![]() ![]() | ITerritory |
Territory
![]() Getting Territory name as Custom Field value through ScriptingPython if User.Territory is not None: Quote.GetCustomField("Territory").Content = User.Territory.Name |
![]() | ITrace |
ITrace write messages to trace. Use this class for debugging scripts. |
![]() ![]() | ITranslation |
Dictionary key/value translation
![]() Set translated value from the specified dictionary to Free Form attributeIn this example it is assumed that dictionary id for German dictionary is 2. Dictionary key is - CustomDictionary.CurrentlyLoggedUser.Python Product.Attributes.GetByName('Translation attribute').AssignValue(Translation.Get(2, 'CustomDictionary.CurrentlyLoggedUser')) Set formatted translated value from currently set dictionary to Free Form attributeDictionary key is - CustomDictionary.CurrentlyLoggedUser.Value for dictionary key is - Currently logged user: {{user}}. Python Product.Attributes.GetByName('Translation attribute').AssignValue(Translation.GetFormatted('CustomDictionary.CurrentlyLoggedUser', 'user', User.Name)) Set multiple values' formatted translated value from currently set dictionary to Free Form attributeDictionary key is - CustomDictionary.CurrentlyLoggedUser.Value for dictionary key is - Currently logged user: {{user}}, username {{userName}}. Data for currently logged user (user's name and username) will be retrieved based on User.Name and User.UserName. Python Product.Attributes.GetByName('Translation attribute').AssignValue(Translation.GetFormatted('CustomDictionary.CurrentlyLoggedUser', 'user', User.Name, 'userName', User.UserName)) |
![]() ![]() | IUser |
User
![]() Setting user's custom field content if user is Flo adminPython if User.IsFloAdmin: User.GetUserCustomFieldByName("FloAdmin").Content = "User is Flo admin" |
![]() ![]() | IUserCustomField |
User custom field
![]() Setting the content of User Custom FieldPython if User.GetUserCustomFieldByName("User Company Name") is not None: User.GetUserCustomFieldByName("User Company Name").Content = "SAP company" |
![]() | IUserCustomFieldAttributeValue | User custom field attribute value |
![]() | IUserCustomFieldAttributeValueCollection | User custom field attribute values |
![]() | IUserCustomFieldCollection | User custom field collection |
![]() | IUserPersonalizationHelper | Some IronPython built-in functions used in scripts return values in a format that's different from user's selected format (for example, the function str() returns a string in the format 1234.56 which may cause issues if the user format is 1.234,56). To avoid any issues, instead of Iron Python built-in functions, use the IUserPersonalizationHelper methods which will always return values in the user's format. |
![]() ![]() | IUserType |
User type
![]() Setting user's custom field according to user typePython if User.UserType is not None and User.UserType.Name == "Sales Manager": User.GetUserCustomFieldByName("User Type").Content = "Sales Manager at SAP" |
![]() | IVCCondition | Pricing Condition result |
![]() | IVCConditionsWithPurpose | Conditions with purpose |
![]() | IVCPricingResponse | VC pricing response |
![]() | IVCResponseItem | Pricing item result |
![]() | IVCSubtotal | Subtotal |
![]() | IWebServiceHelper | Web service helper class |
![]() ![]() | IWorkbook | Excel workbook of the file loaded in the product configurator. |
![]() | IWorkbookCells | Cells object of current excel worksheet. |
![]() | IWorkbookSheet | Excel worksheet. |
![]() | IWorkflowContext | This class is shared within pre and post actions. |
![]() | IXmlHelper | Xml helper |
Enumeration | Description | |
---|---|---|
![]() | AssetStatus | Asset Statuses |
![]() | AttributeAccess | Product attribute access restriction enum |
![]() | Encodings | Represents mostly used Encoding types for creating StringContent. |
![]() | GenDocFormat | Represents output document format, used in Generate Document quote action. |
![]() | SqlDbType | Specifies SQL Server-specific data type of a field, property, for use in a ISqlParameter |