Symptom
Running the API endpoint /api/v1/quotes?$filter=quotenumber eq 'QuoteNumber' returns the following result:
Error: "code": "116000", "message": "Internal server error."
Message: Incorrect syntax near the keyword 'for'.\r\nInvalid usage of the option NEXT in the FETCH statement.\r\nIncorrect syntax near the keyword 'for'.
Environment
SAP SALES CLOUD CPQ
Reproducing the Issue
Follow this path in Postman:
- Create a new request;
- Use Get method and run below API endpoint to get the bearer token with the body specified below:
Endpoint: /basic/api/token ;
Body: grant_type=password&username=Username&password=Password ; - Use Access Token as Bearer in this call with get method to run below API endpoint:
Endpoint: /api/v1/quotes?$filter=quotenumber eq 'QuoteNumber' .
Cause
Visibility rule created via script or API to contain quote status name, what leads the database to have quote status names instead of IDs. This causes an exception when evaluating quote visibility.
Resolution
Update the advanced condition of the visibility rule with the correct quote status IDs instead of names. If issue still persist, delete the visibility rule and create a new one with correct quote status IDs.
Keywords
visibility, update, internal, server, error, CPQ, rule, incorrect, syntax, 116000, code, API , KBA , CEC-SAL-CPQ , Sales Cloud CPQ , Known Error