4

Does anybody know, how to add a custom (action) button like this? I just can use the default edit, delete an clone actions. Following the Salesforce1 App Guidelines , it should be possible to add custom actions to this section.

enter image description here

3

Indeed, it is true that most custom buttons will not be visible in the Salesforce1 context.

Custom buttons that DO work are those linked to a visualforce page where the standardController is set to the object on which your button is made.

Visualforce pages that don't use this standardcontroller won't work either.

Also keep in mind that your visualforce pages need to be marked as "Available for mobile". You can set this by going on your visualforce page through the setup area.

But be mindfull with the use of this... If you could achieve the same functionality via a publisher action (ex. create child records) with point and click, I would definitly advise to just use publisher actions instead.

EDIT since question is related to approvals in specific:

Approval processes and Salesforce1 is something that isn't fully integrated yet. So indeed, the "submit for approval" that you would normally get isn't available.

You can read more about it here:

http://help.salesforce.com/apex/HTViewSolution?id=000187495&language=en_US

and here

http://help.salesforce.com/apex/HTViewSolution?id=000187389&language=en_US .

I do know that you could submit a record for approval via code.

You can read all about that here, http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_process_example.htm

So basically, you could create a visualforce page with a standard controller to your object where you put the code that submits your record for approval.

  • Ok, thanks! So in case of trigger an approval process with custom button, i just have the opinion to use publisher actions? – daniel-h Feb 17 '14 at 12:08
  • updated my answer since the question is more related to approval-specific logic. I'm not sure if there is a possibility to submit a record for approval through publisher actions though. – KoenVM Feb 17 '14 at 13:34
  • Yes,I know this sources, but i think, currently is the publisher action (post) related to the feeditem object the best way to trigger an approval process from Salesforce1 – daniel-h Feb 17 '14 at 13:57
  • Do you just need users to be able to approve? (like this: help.salesforce.com/…) Or do you also want to submit records for approval to other users? I'm not sure how you would be able to submit records for approval via that way. If you could post some screenshots on how you eventually solved your issue, that would be great! – KoenVM Feb 17 '14 at 15:56
1

So my solution is a combination of the post publisher action.

enter image description here

(post) publisher action

and an trigger on the the Feed_Item object like this:

trigger Feed_Item on FeedItem (after delete, after insert, after undelete, 

after update, before delete, before insert, before update) {

if(trigger.isBefore && Trigger.isInsert) {
      for (FeedItem f : trigger.new)
      {
         if (f.Body.startsWith('!')) {
           System.debug('-#-#-#-#-#-#-#-#-#-: ' + f.parentId);
           approval.ProcessSubmitRequest aprlPrcs = new Approval.ProcessSubmitRequest();      
           aprlPrcs .setComments('Submitting record for approval.');
           aprlPrcs.setObjectId(f.parentId);
           approval.ProcessResult result = Approval.process(aprlPrcs);

           f.Body='Submitting record for approval';
         }            
      }
}

}

=> i can submit my Custom Object for approval by typing ! into the post field...

  • that's pretty cool :). I'm wondering, what would be even nicer is to use a topic (for ex. "Request for Approval"). Then you could also easily see all records that were requested for approval. From spring14 you could even create a view showing all records of type X or Y that were submitted via approval this way. This is an interesting topic. Especially since there is for the moment no builtin way yet to submit records for approval from Salesforce1. – KoenVM Feb 21 '14 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.