SAP Knowledge Base Article - Public

3686605 - Cannot read a Custom Field after Quote creation event

Symptom

It is not possible to read the value of a Custom Field when executing a script to run on a Quote Creation Script event.

Environment

SAP CPQ.

Reproducing the Issue

  1. Create a Global Script with the following code:
    1. Log.Info("Custom Field: {}".format(context.Quote.GetCustomField("Custom Field Name").Value)) -> this will log the value to the log.
  2. Set script event to on quote creation.
  3. Make a POST request to - https://{{Tenant_URL}}/api/v1/quotes.
  4. Check the log and see that the log message appears after the quote was created successfully.
  5. You will see a blank value for the Custom field value.

Cause

Expected Behavior.

Resolution

  • When creating a quote via REST API one is basically creating empty quote (same as in case when quote is created via UI or Iron Python scripting)  and then populating it with additional data (custom fields, customers/involved parties, items, quote table data, etc.).
  • On quote creation event is fired upon creation of empty quote (basically at that time only essential fields for quote creation are populated i.e.  market, status, effective date, owner id, origin, etc.).
  • Custom fields are populated after on quote created event has been raised so that is the reason why it is not possible to access them at that time. 

Keywords

Custom, Field, API, Scripting, Global, Scripts, Quotes, Event, Creation , KBA , CEC-SAL-CPQ , Sales Cloud CPQ , Bug Filed

Product

SAP CPQ all versions