Integrations and APIs for Service

Get Involved. Join the Conversation.


    Baljeet Singh
    Failed To Run Cron/Custom Scripts on Production Site
    Topic posted April 15, 2019 by Baljeet SinghRed Ribbon: 250+ Points, tagged Connect PHP, REST, SOAP 
    158 Views, 5 Comments
    Failed To Run Cron/Custom Scripts on Production Site
    Failed to run custom PHP scripts for schedule report


    We have business requirement to run cron job which will fetch records from third party software and save records in OSvC. As we know cost is associated if we set up cron job on Oracle server. We have work around this problem to use Custom Scripts (Under level tab in custom report) and schedule report for specific internal of time. 

    I was able to achieve objective by creating custom PHP script and included in custom scripts in initialization tab. Please find attached the screenshot. I implemented the PHP script on test instance and got expected result but I could not able to replicate the same scenario on production site. 

    In Production Site, It works only when I manually run the custom report and got expected result. It seems that Custom Scripts is failed to call custom PHP file (included in Initialization tab) when run automatically (via Scheduling)  I have already given report permissions. Both instances has Reportgen utility enabled and working good.

    On test instance, it is working fine but failed to run on production site. Both instances are of same version (Aug 2017).  I have included my code in code snippet. Any idea

    Am I missing any config settings ?


    Baljeet Singh


    Oracle Service Cloud August 2017
    Code Snippet:



    • Sebastiaan Draaisma

      Hi Baljeet.

      Try using an extra line in your Initialization

      require_once(get_cfg_var('doc_root') . '/include/ConnectPHP/Connect_init.phph' );

      When scheduling a report containing custom script I always use this extra line.
      See also the user doc for this

      Note: If the report is to be scheduled (see Scheduling Reports), add putenv('TEMPORARY_RNW_CONF_DIRECTORY'); to the Initialization pane to ensure the custom script runs correctly when recipients open the report.

    • Sebastiaan Draaisma

      Ah, I now see you already have that (still very early here and I just woke up) :-D

    • Vlad

      Custom scripts in reports are not intended to be used to run PHP scripts on a report schedule - you should not expect this to work. I would recommend you create a standalone custom script (upload it through the console file manager to custom scripts) and call this script externally on a schedule.

    • Baljeet Singh

      Thanks Sebastiaan & Vlad for your reply.

      I had tired using these lines in Initialization tab but no luck

      require_once(get_cfg_var('doc_root') . '/include/ConnectPHP/Connect_init.phph' );

      @Vlad - Do you want me to define PHP code in Process tab instead of creating PHP file and saved in custom scripts folder. Currently I am doing this


      Created one PHP file and saved in custom directory. From Initialization tab, I am including PHP file and trying to get result but no luck.



    • Sebastiaan Draaisma

      Does your schedule work when disabling certain parts or all custom script? That way you know if the problem lays with the schedule itself and if not, which section prevents it from working.