function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
pvandepvande 

Custom Save Button - Synchronize Case with JIRA

Hi - I am trying to create a custom Save button for the CASE object.  I would like standard save functionality along with this code so that the case will synchronize with JIRA.  Could I please have help with the code?

https://jira-dev.int.helloworld.com/plugins/servlet/customware/connector/issue/7/Case/synchronize.action?id={!Case.Id}
 
Akhil ReddyAkhil Reddy
1. Create  Hierarchy type custom setting and assing value if the field with this URL.
2. Also assign API key for JIRA in another field, this would be easy for future use
3. write webservice class and embed it in custom buttin on the object 
To make things easier, we now need to create a button such that whenever it is clicked, the case should be created in JIRA. In developer language, what that means is an apex class is called when the button is clicked. Since we are relying on an external API, we write a web service class to call an apex class and perform the action in Salesforce. In this case, the web service class is written to call the JIRA service.
- create button in Case
- Upon clicking it, the below screen is what you get. As you can see, there is JSON Declaration that calls the web service apex class.
{!REQUIRESCRIPT( "/soap/ajax/35.0/connection.js" )} 
{!REQUIRESCRIPT( "/soap/ajax/35.0/apex.js" )} 
var cs = new sforce.SObject("Case");
cs.Name = '{!Case.Name}'
result = sforce.connection.create('cs');
if (result[0].success == true){
   var obj = { "caseId" :"{!cs.Id}", "CaseDesc" :"{!cs.Description}", }; 
   sforce.apex.execute( "callJIRA", "crateCaseMethod", obj ); 
   location.reload();
}


c. place this button in case page layout
pvandepvande
Thank you for responding, Akhil.  I will give this solution a try!