cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to change item custom field with script on CPQ?

sbslmhmt
Participant
2,803

Hello,

Anyone knows how to change item custom field with global script on CPQ?

Best regards.

Accepted Solutions (1)

Accepted Solutions (1)

MaxGag
Participant

Hello,

Quote item are a bit different. There's no getCustomField on them... you just need to put the custom field name in ["xxxx"].

When you got your variable that is the quote item you have do do this:

yourQuoteItemVariable["yourFieldName"].Value = yourData

There's many way to get the quote item so if you also need help on this just ask.

Thanks

sbslmhmt
Participant
0 Likes

Hello maxgag2,

Thank you very much Maxime, working great.

Best regards.

sbslmhmt
Participant
0 Likes

Hello maxgag2,

Is there any chance that there is a similar way of changing attibute values. I am trying to change attribute values of an item from erp using global script as a web service. I am passing attr name and attr value to script but I cound't figure it out how to access attribute after loading Quote.

Best regards.

MaxGag
Participant
0 Likes

Hello sbslmhmt ,

Are you using Quote 1.0 or 2.0 and are you integrated with CPS?

Thanks

sbslmhmt
Participant
0 Likes

Hello maxgag2 ,

We are using Quote 1.0 and we are not integrated with CPS.

Best regards.

MaxGag
Participant

Hello sbslmhmt,

Can you pleas open another question regarding this? So other will be able to see it too?

Thanks

sbslmhmt
Participant
0 Likes

Hello maxgag2 ,

How to update product attribute value from a web service on Sap CPQ?

Thank you very much. Best regards.

pritam_kaur26
Explorer
0 Likes

Hi Mehmet

you got solution to this as I am also facing same challenge.

Regards,

Pritam

sbslmhmt
Participant

Hello Pritam,

I've used below code to update item custom field.

Best regards

Quote.GetItemByQuoteItem('1')['yourcustomfieldname'].Value = yourData
pritam_kaur26
Explorer
0 Likes

Thanks for the revert.

I am trying to loop over all the quotes based on some condition for example created within 2 days and then one by one make an API call for each one of them to get order status and update data from API response to custom field.

In this case when I use above code it throws an error "'NoneType' object has no attribute 'GetItemByQuoteItem'

its not able to refer to particular Quote because I am not calling it from inside the quote.

Hope I am able to explain. You know how can I make this work

Thanks & Regards,

Pritam

Answers (1)

Answers (1)

MaxGag
Participant

Hello,

For text field:
Quote.GetCustomField("yourFieldName").Content = yourData

For attribute type field:
Quote.CustomFields.SelectValueByValueCode(yourFieldName, 'yourSelection')

Thanks

sbslmhmt
Participant
0 Likes

Hello maxgag2,

Thank you for your answer. Actualy I am trying to change quote item custom field not a custom field.

Best regards.

MaxGag
Participant
0 Likes

Hello,

Quote item are a bit different. There's no getCustomField on them... you just need to put the custom field name in ["xxxx"].

When you got your variable that is the quote item you have do do this:

yourQuoteItemVariable["yourFieldName"].Value = yourData

There's many way to get the quote item so if you also need help on this just ask.

Thanks