Outbound REST calls via mid server not working from Scripts, script background and returns null responseDescription <!-- div.margin{ padding: 10px 40px 40px 30px; } table.tocTable{ border: 1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); padding-top: .6em; padding-bottom: .6em; padding-left: .9em; padding-right: .6em; } table.noteTable{ border:1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); width: 100%; border-spacing:2; } table.internalTable{ border:1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); width: 100%; border-spacing:0; } .sp td{ border-bottom: 1px solid; border-right: 1px solid; border-color:#E0E0E0; background-color: #ffffff; height: 20px; padding-top: .5em; padding-bottom: .5em; padding-left: .5em; padding-right: .5em; } .sphr td{ border-right: 1px solid; border-bottom: 1px solid; border-color:#E0E0E0; background-color: rgb(245, 245, 245); padding-top: .5em; padding-bottom: .5em; padding-left: .5em; padding-right: .5em; height: 20px; } .title { color: #D1232B; font-weight:; font-size:25px; } .hd1{ color: #D1232B; font-weight:; font-size:18px; } .hd2{ color: #646464; font-weight:bold; font-size:16px; } .hd3{ color: #7a7a7a; font-weight:; font-size:16 px; text-decoration:; } .hd4{ color: #000000; font-weight:bold; font-size:14 px; text-decoration:; } --> Outbound REST calls via mid server not working from scripts, script background and returns null response ProblemOutbound REST calls through the Mid Server are not working from scripts, script background and returns null response. SymptomsFor example: Here is a REST call script with a GET function executed thought the MID Server:var r = new RESTMessage('XYZ Organization', 'get');r.setStringParameter('XYZ_host', '123.123.123.123');r.setStringParameter('org_id', '4');var response = r.execute(); These are the symptoms: The Test (Related Link) always works successfully. The previewed script, pasted into a Background Script never works – the response value is always null. In addition, the previewed script pasted into a script include and used by a scheduled job never works – the response value is always null. CauseWhen using the Mid Server, the script executed from background or business rule/script does not wait for an response, hence the response is null. ResolutionThe REST call has to be modified like below to wait and get the response when executed from scripts, background scripts, or business rules. var r = new RESTMessage('XYZ Organization', 'get');r.setStringParameter('XYZ_host', '123.123.123.123');r.setStringParameter('org_id', '4');var response = r.execute();var k = 1; while ( response == null ) { gs.print( "waiting ... " + k + " seconds" ); response = r.getResponse( 1000 ); k++; if ( k > 30 ) { gs.print( 'service time-out' ); break; // service did not respond after 30 tries } } gs.print( "RESPONSE: " + response ); if ( response != null ) { gs.print( 'body=' + response.getBody() ); }