This is a public Forum  publicRSS

Topic

    John L
    Fetching Message Base Failing in Staging and ProductionAnswered
    Topic posted December 4, 2017 by John LApprentice, last edited December 4, 2017 
    25 Views, 2 Comments
    Title:
    Fetching Message Base Failing in Staging and Production
    Content:

    Hi all,

    I have the following code in a php file in views/pages. My issue is that this works fine in dev, however one (CUSTOM_MSG_DASHTEXT_STATUSCODE_14191) of the two message bases fails to display in staging and production and throws fatal error:

    Uncaught exception 'RightNow\Connect\v1_3\ConnectAPIError' with message 'Invalid ID: No MessageBase record found with LookupName = '(1000101)' ...

    I have read threads where other people were experiencing similar issues, but it looked they were trying to reference the message base on their page dynamically with a php variable containing the message base name (for example: MessageBase::fetch($messageBaseName)). I'm however referring to certain message bases by explicitly by name and don't understand why this would not work. Any ideas or insight would be appreciated!

    Version:
    CP Framework Aug 2015
    Code Block:

    Best Answer

    Bastiaan van der Kooij

    Hey John,

    the constant you are providing resolves to an ID of the message itself, so you should remove the apostrophes. You can also just use the shorthand;

    $message = getMessage(CUSTOM_MSG_DASHTEXT_STATUSCODE_14195);

    Bastiaan

    Answer

     

    • Bastiaan van der Kooij

      Hey John,

      the constant you are providing resolves to an ID of the message itself, so you should remove the apostrophes. You can also just use the shorthand;

      $message = getMessage(CUSTOM_MSG_DASHTEXT_STATUSCODE_14195);

      Bastiaan

    • John L

      Removing the quotes around the message base name and the shorthand you suggested both did the trick. Thanks, Bastiaan!