• Uday raj
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 8
    Replies
 When ever a case has ben created it should directly create an issue  in Jira(wrote a Trigger on case object whenever a case is identified it will fire by applying some condition) now its turn to attach a file or attachment into Jira from Salesforce, myself strucked ova here.



public SalesforcetoJira(){}
//Change values in this class according to you JIRA/Salesforce coordinates
public String baseUrl = '';   // Base URL of your JIRA instance
public String username = ''; // JIRA username
public String password = ''; // JIRA password // Constructs Basic Http Authentication header from provided credentials
public String authHeader(){ Blob headerValue = Blob.valueOf(username+':'+password); return 'Basic ' + EncodingUtil.base64Encode(headerValue);
}
public SalesforcetoJira(JiraUrl,String objectType,String projectKey,String issueType,string summary,string description)
{
HttpRequest req = new HttpRequest();
Http http = new Http();
req.setMethod('GET');
//Set HTTPRequest header properties
req.setHeader('Accept', 'application/json');
req.setHeader('Content-Type','application/json');
Blob headerValue = Blob.valueOf(username+':'+password);
req.setHeader('Authorization','Basic '+ EncodingUtil.base64Encode(headerValue));
req.setEndpoint(baseUrl);
String CreateIssueJsonJIra= '{"fields": {"project":{"key": " "},"summary":" ","description":" " ,"issuetype":{"name": "Bug"}}} ';
String JSONData = JSON.serializePretty(CreateIssueJsonJIra); r
eq.setBody(CreateIssueJsonJIra);
system.debug('after response....'+CreateIssueJsonJIra);
try{
//Execute web service call here
HTTPResponse res = http.send(req);
String ResponseJsonString = res.getBody();
map<string,string> attachment= (map<string,string>)JSON.deserializeUntyped(ResponseJsonStringJIra);
system.debug('after response...'+attachment);
system.debug('after response...'+attachment.get('id'));
System.debug('ResponseJsonStringJIra'+ResponseJsonStringJIra);
JSONParser parser = JSON.createParser(ResponseJsonStringJIra);
}
}
catch(System.CalloutException e)
{
System.debug('Callout error: '+ e);
}
}


I appreciate any help.

 
 When ever a case has ben created it should directly create an issue  in Jira(wrote a Trigger on case object whenever a case is identified it will fire by applying some condition) now its turn to attach a file or attachment into Jira from Salesforce, myself strucked ova here.



public SalesforcetoJira(){}
//Change values in this class according to you JIRA/Salesforce coordinates
public String baseUrl = '';   // Base URL of your JIRA instance
public String username = ''; // JIRA username
public String password = ''; // JIRA password // Constructs Basic Http Authentication header from provided credentials
public String authHeader(){ Blob headerValue = Blob.valueOf(username+':'+password); return 'Basic ' + EncodingUtil.base64Encode(headerValue);
}
public SalesforcetoJira(JiraUrl,String objectType,String projectKey,String issueType,string summary,string description)
{
HttpRequest req = new HttpRequest();
Http http = new Http();
req.setMethod('GET');
//Set HTTPRequest header properties
req.setHeader('Accept', 'application/json');
req.setHeader('Content-Type','application/json');
Blob headerValue = Blob.valueOf(username+':'+password);
req.setHeader('Authorization','Basic '+ EncodingUtil.base64Encode(headerValue));
req.setEndpoint(baseUrl);
String CreateIssueJsonJIra= '{"fields": {"project":{"key": " "},"summary":" ","description":" " ,"issuetype":{"name": "Bug"}}} ';
String JSONData = JSON.serializePretty(CreateIssueJsonJIra); r
eq.setBody(CreateIssueJsonJIra);
system.debug('after response....'+CreateIssueJsonJIra);
try{
//Execute web service call here
HTTPResponse res = http.send(req);
String ResponseJsonString = res.getBody();
map<string,string> attachment= (map<string,string>)JSON.deserializeUntyped(ResponseJsonStringJIra);
system.debug('after response...'+attachment);
system.debug('after response...'+attachment.get('id'));
System.debug('ResponseJsonStringJIra'+ResponseJsonStringJIra);
JSONParser parser = JSON.createParser(ResponseJsonStringJIra);
}
}
catch(System.CalloutException e)
{
System.debug('Callout error: '+ e);
}
}


I appreciate any help.

 
Hi,

Can send can send attachment(s) from Salesforce to and external system using WSDL or HTTP Callout? If yes, is there any limit of size of file can be sent?

From what I found out so far, it seems.. attachment (blob) can not be sent using WSDL call..

The following data types are only supported when used as call ins, that is, when an external Web service calls an Apex Web service method. These data types are not supported as callouts, that is, when an Apex Web service method calls an external Web service.
•             blob
•             decimal
•             enum

Can we use HTTPRequest method setBodyAsBlob (to an EndPoint URL) and set MIME type and send the file instead in case WSDL based callout does not support it?

Please suggest, would really appriciate any help/input, thanks in advance.

Regards,
Subhajit

Hi ,

 

Can anyone make recommendations of the tools available to connect Salesforce and JIRA?( This is to integrate Salesforce.com cases and JIRA issues)

 

Thanks in advance!!!