Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

'Advanced' Tab Fields

Add the folowing following script and change the URL and Auth to your parameters

Code Block
(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	
	var requestBody;
	var responseBody;
	var status;
	var sm;
	try{
		sm = new sn_ws.RESTMessageV2();
		sm.setRequestHeader("Content-Type", "application/json");
		sm.setHttpMethod("post");
		sm.setEndpoint("https://testing.rixter.se_YOUR-JIRA-INSTANCE-URL_/rest/restfulintegrator/1.0/incoming?token=be388056-9f23-4eaf-9247-ae6219933d67");
		sm.setBasicAuth("theIntegrationUserusername","ABC1243password");
	
		
		var dataObject = {};
		gs.info("current: ", dataObject["id"] = current.tablesys_id.getDisplayValue();
		gs.info("pre:" , previousdataObject["subject"] = current.short_description.getDisplayValue();
		
		sm.setRequestBody(JSON.stringify(currentdataObject));
		
		sm.setHttpTimeout(10000); 
		response = sm.execute();
		
		responseBody = response.haveError() ? response.getErrorMessage() : response.getBody();
		status = response.getStatusCode();
		
	} catch(ex) {
		responseBody = ex.getMessage();
		status = '500';
	} finally {
		requestBody = sm ? sm.getRequestBody():null;
	}
	
	gs.info("Request Body: " + requestBody);
	gs.info("Response: " + responseBody);
	gs.info("HTTP Status: " + status);

})(current, previous);



References

...