on 2021 Sep 28 11:13 AM
Hello,
CPQ provides various rest apis but I cound find any to update a product attribute value. Am I missing something?
Best regards.
Request clarification before answering.
Hello,
You can find documentation here: https://help.sap.com/viewer/7fc27540a0f14bd1a10b639117a9d4d7/2108/en-US/5b43a32ab3d34ba8bb9340a7d5f1...
Calling a script from the API is perfect.
In your script you will need to find the best way to get the right quote item. If you already know the line item number you can use x = Quote.GetItemByQuoteItem('lineItemNumber') or you can also loop in the mainItems as the example below and find the right mainItem data to use to get the product you look for. For sure if you have the same product twice in your quotation that will be tricky!!
Thanks
Here's the SAP help solution:
How to inline update configuration of existing quote item?
If configuration of existing main item in the quote needs to be updated, this can be executed inline - without leaving current quote.
Script for changing configuration can be exposed as custom action.
All quote calculations will be executed in the same way as item is manually updated from the configurator.
Script example for updating Maintenance product:
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('Added 5-years contract')
if Product.Attributes.GetByName('1 Year Support').SelectedValue is not None:
Product.Attributes.GetByName('1 Year Support').SelectedValue.IsSelected = False
Product.UpdateQuote()
break
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mehmet,
Here: https://webcomcpq.com/webapihelp/index#!/Attribute/Attribute_Update (visit this link)
Rest API Endpoint: [PUT]: {CPQ Url}/api/products/v1/attributes/{id}
By using above endpoint you can also update attribute values.
####Values section is highlighted in below payload.
Payload:
{ "Id": 0, "Name": "string", "SystemId": "string", "ExternalId": "string", "Type": "None", "TypeLabel": "string", "ModifiedBy": "string", "ModifiedOn": "string", "ContainsPersonallyIdentifiableInformation": true, "SensitiveData": true, "NumberOfValues": 0, "Autocomplete": { "TableId": 0, "PreselectionFilter": "string", "ShowOnlyDistinctValues": true, "TableColumns": [ { "TableColumnId": 0, "ColumnName": "string", "DisplayLabel": "string", "Rank": 0 } ], "SearchableColumns": [ { "TableColumnId": 0, "ColumnName": "string", "DisplayLabel": "string", "Rank": 0 } ], "DisplayedColumns": [ { "TableColumnId": 0, "ColumnName": "string", "DisplayLabel": "string", "Rank": 0 } ], "IsAutocompleteUsedAsProductAttribute": true }, "Measurement": { "MeasurementId": 0 }, "Container": { "PresentResultsOfProductSearch": true, "MaxContainerRows": "string", "MinContainerRows": "string", "EnablePaging": true, "DefaultNumberOfRows": 0, "Actions": { "AddNewRow": true, "OpenNewConfigurator": true, "DeleteRow": true, "CopyRow": true, "AllowMultipleCopy": true, "ReorderRows": true, "EditRow": true }, "Properties": [ { "Id": 0, "Name": "string", "Formula": "string", "DataType": 0, "DecimalPlaces": 0, "CalculationRank": 0, "IncludeInJSON": true } ], "Validations": [ { "Id": 0, "Name": "string", "Message": "string", "ValidationFormula": "string" } ], "Products": [ { "Id": 0, "SystemId": "string", "Version": "string", "Name": "string", "MinRows": "string", "MaxRows": "string" } ], "Columns": [ { "Id": 0, "Name": "string", "HeaderLabel": "string", "FooterLabel": "string", "Width": 0, "Height": 0, "Total": 0, "Formula": "string", "DisplayRank": 0, "CalculationRank": 0, "DataType": 0, "DecimalPlaces": 0, "ColumnType": 0, "DisplayType": 0, "SelectedAttributeId": 0, "SelectedAttributeValues": [ { "Id": 0, "ValueCode": "string", "Value": "string" } ], "IsSelectedAttributeAutocomplete": true, "IsSelectedAttributeQuoteTableAutocomplete": true, "CalculationFormula": "string", "AlwaysIncludeInKOContext": true, "ContainsPersonallyIdentifiableInformation": true, "SensitiveData": true, "Permissions": [ { "ColumnId": 0, "UserTypeId": 0, "Value": "Hidden" } ], "SelectedPermissions": { "Editable": { "Id": 0, "Permissions": [ 0 ] }, "ReadOnly": { "Id": 0, "Permissions": [ 0 ] }, "Required": { "Id": 0, "Permissions": [ 0 ] }, "Hidden": { "Id": 0, "Permissions": [ 0 ] } }, "DefaultUserTypePermission": "Hidden" } ] }, "Values": [ { "Id": 0, "ProductId": 0, "RefProductDisplayName": "string", "ValueCode": "string", "Value": "string", "SystemId": "string", "Rank": 0, "Unit": 1, "BillingPeriod": 1 } ] }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
13 | |
12 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.