cancel
Showing results for 
Search instead for 
Did you mean: 

Event on changing item custom field in cpq

tdhirendra3221
Explorer
0 Kudos

I have a requirement of creating item custom field let say X of [type drop down ] which will have some options so user can select one value of given options .as mentioned this item custom field should be appear for all added line item .

So for each line item [product ] we will have some specific valid option so if user select invalid option then i need to generate a error saying "item number {1,2,3...} having wrong value"

Custom table:

This will store Product ID and all the valid option .

this validation has to happened on every line item so to validate what event i should use to get old and new value of item custom field.

So every change in the line item custom field i need to validate above mentioned scenari.

Please help me approach also ..

Thanks

DT

Accepted Solutions (1)

Accepted Solutions (1)

smccarth
Explorer
0 Kudos

Not sure if it would work, but you could try setting this up as a Custom Calculation. Then in the Cart Fields administration, set a group making the custom item field editable and have the custom calculation run for that group.

Otherwise, you might just set the script to run as part of a quote action such as Save Quote. Or setup a custom action 'Validate [item custom field name]' and users would need to click on this to validate as part of their business process.

Wouldn't it be better to limit selections to only the valid selections in the first place?

Another idea would be to make this an product attribute with logic in the configurator that is then passed to the item custom field and is read-only in the cart.

tdhirendra3221
Explorer
0 Kudos

Hi smccarth

I understood your first point... I went with this approach so created one custom calculation script ...now when user will edit any line item custom field then inside new custom calculation script I will be able to read new value selected by user for that item.. and validate it.. but there is one problem here...my intention is to validate only that item which user has manipulated..but quote calculation script logic will run for all cart item automatically.. Some sort of loop I would say internally ...which will create performance issue if quote is having large number of item...

Your second idea is nice ...and we proposed your third point as good solution business they dint agree

Thanks

Manku ,👍

Answers (1)

Answers (1)

mpr1023
Participant
0 Kudos

Hi Dhirendra

In this case you can write a python script. So firstly in the script you need to define the conditions when it should be a error(like in your case if it is not valid) and under that condition(like under 'if' & 'elif' conditions) you can give this piece of code - Quote.Messages.Add('your message')

Hope this help you !

tdhirendra3221
Explorer
0 Kudos

Hi Prithvi

Thanks for acknowledging....

My doubt is when user change drop-down value how I would know old value and new value there would be one event..

Thanks

Dhiren