Why do I see "'Invalid ID: No MessageBase record found with LookupName = " or an Unknown message slot error in Customer Portal Staging?
Customer Portal (CP)
Oracle B2C Service, all versions
Here are a few things to check if you are seeing either of these errors.
- Does the message base exist?
- Is your code calling it the way CP allows?
- Did you delete the message base and re-add it by the same name? If so, you need to stage and deploy any page referencing that message base.
While the Connect for PHP API (CPHP) documentation talks about message base usage, that is not how CP handles it. What the CPHP documentation is referencing is strictly the managed API (MAPI) layer.
CP uses MAPI but does optimization of the data and the functions.
There are many different ways you can try to call and use message bases in CP. All of the different ways will work in Development mode but some of them will not work in Staging or Production mode due to the optimization of the code.
When the CP code is optimized, we convert a string value into a lookup of the value present in the database. We add this value into the optimized code and from there we use that in the function call. Within the optimized code, this is the integer ID of the message base object. That value will change if the message base is deleted and re-added, which is why pages need to be redeployed in that particular scenario.
You cannot supply a string literal. The reference keys are defined as constants in the CP framework when in development mode, so they should not be quoted.
What you can use instead of a string literal in a fetch statement like
RNCPHP\MessageBase::fetch( "CUSTOM_MSG_xxxxx" ); is
For other examples: