cancel
Showing results for 
Search instead for 
Did you mean: 

CPQ 2.0 why is the object Item not defined within custom calculations in context of CartItems?

Alexander_0001
Participant
0 Kudos
502

Hi SAP Community,
I try at the moment to create a custom calculation in SAP CPQ Quote 2.0. unfortunately all tests failed due to the fact that the CartItem context does not recognize the object "Item" what could cause this issue and how to solve this?

Accepted Solutions (1)

Accepted Solutions (1)

LukaPilipovic
Product and Topic Expert
Product and Topic Expert

Hi Alex,

Can you please try with similar to:

for item in context.AffectedItems:
item.Discount = 10

Source:

https://help.sap.com/docs/SAP_CPQ/884885f05e6b4c8082254d4d9d63f19b/16971740041243dab4a634dc28a008b1....


Alexander_0001
Participant

Hi Luka, thank you very much for your help!
It guided me to the right track. With a small adjustment of your code it works:

for item in context.AffectedItems:
    item.DiscountAmount = 10

Answers (0)