Skip to main content

Case Comment in Salesforce1

Here comes the post on adding case comments in salesforce1. Have you tried? If yes then you would have landed up in saying that you cant add case comments in salesforce1. Yes currently Salesforce1 doesn’t support adding case comments from Salesforce1. Hope in upcoming release we might get as native functionality (#SafeHarbor). So how can we achieve that ? Lets  see what are the ways available for us . So as we do always, lets think of any declarative methods for this one.So creating publisher action is one that is available in this case. Lets try that.

Creating Object specific publisher Action – We can easily create object specific publisher action in Salesforce and bring that into salesforce1.OOPS !!!! Sad smile Unfortunately Case Comment object is not supported in the publisher action
So other option is to go for custom visualforce page

Custom Visualforce page – Yes this way we can achieve what we wanted. Before jumping in, First we will see where I can show my Visualforce page in salesforce1

1. Navigation Menu - Create a custom visualforce page then include that in a custom tabs, then access your visualforce tab in the S1 navigation menu 
2. Mobile cards  - This is kind of inline visualforce page, where you can able to access it only in the Salesforce1. The VF page must use standard controller, since we are displaying in the record detail sections.
3. Visualforce page in Publisher Action – We can include the visualforce page in the publisher action of S1. We can include both object specific and record specific actions.

Since I want to add case comment quickly for a case record,lets go with the Visualforce page in publisher action. We also have one advantage when we run VF page in publisher action, we can invoke the publisher action buttons from our VF page to submit actions.

CaseComment
             CommentPAge

Let’s take look into import code snippets
1.  Refer the Publisher java script file in Visualforce page

2. When the user click the ‘Submit’ publisher action we are invoking our java script method to create case comment

3. In the ‘caseComment()’ java script method we are calling the our apex controller method with parameters comments, record id, publish(this is to identify whether we gonna submit public or private comment). We have used Java script remoting to invoke controller class. If the event is success we will close the publisher window

Check this link for code sample https://gist.github.com/Karanraj/6bd1ffc13252b0a22ae0

For UI styling, I have used the salesforce1 ‘Mobile templates’ in the static resource which you can get in the Salesforce1 developer guide. To know more about the Salesforce1, please have look into the link.
Catch you all soon with the next post till then happy coding Smile

Comments

Popular posts from this blog

Avoid Duplicate Records Using Flow

In this blog post lets see how to avoid duplicate records in Salesforce using the powerful feature – Flow , As the word says, flow easily flows to fulfill the requirements with ease. ☺  Many think of appexchange solutions and source code to avoid the duplicate record in salesforce, But the method I'm going to explain here is completely different and very simple. It helps you to reduce your code and can easily rebuild for other objects with different field logic with simple clicks. Lets jump into the solution, we will use flow to check duplicate record logic and use apex trigger to initiate the Flow whenever a record is created or updated. Visual Work Flow : [Click] First we will create the Flow to check the duplicate records based on the name and store the result in the variable. In this example, we will use the Account object for the dupe check. Step 1  : Create a new visual flow with the Name ‘ DuplicateAccountCheck ' Step 2  : Click and drag the RecordLookup into t

Plan your Dreamforce with “Dreamforce Trail”

Salesforce has many good resources for anybody looking to begin Salesforce as beginner, Intermediate or Advanced. Trailhead is also one among the good resource to learn salesforce and my favorite too. I have also written blog post about Trailhead & my favorite module   This  blog post covers an interesting and helpful Trailhead module. Yes Its all about ' Dreamforce Trail ', if you are a Dreamforce Attendee, then I strongly recommend you to take a look into this Trailhead module. No Admin skill or No Developer skill is required for this module.Start winning Badges and is gamified so it motivates you to reach more badges and finally you end up gaining knowledge on Salesforce. Why do we have Dreamforce Trail module in Trailhead?  To help people who is coming to dreamforce for the first time and to plan well for the events. Dreamforce is a tech feast for anybody. Dreamforce is salesforce festival. If you don’t plan well, you will miss something highly helpful . This Dre

Export records from List view – ListView API

As part of the Winter’15 release salesforce introduced the List View API features which helps us to get details and records of list views for an object. I was started exploring more about the List view API and trying to build an use case using that. So I searched about List View in the IdeaExchange site then found that many users are looking for a solution to export records to excel directly from the list view. I built a solution for that Idea, which helps user to download all the records directly from the List view for both standard and custom object. You don’t have to make any change in the code to use this functionality for different objects. All you need is to create a custom button for that object as mentioned below. Lets take an example for Account object 1. Go to Setup –> Accounts –> Buttons, Links and Actions 2. Click ‘New Button or Link' 3. Enter  Label, Name and select display type as ‘List Button’ 4. Content source as “Onclick Javascript” and paste the