Macros in salesforce

Macros are very powerful and interesting component of salesforce. Macros are like set of computer instructions that executes to automate some task that task can be to assign value in a field, to automatically send an email, to update any field, selecting an email template and more. All instructions that we create using macros get execute on a single click. Macros are mostly use with case feed layout basically to update case and to send quick response to user about any update of case raised by that user.

You can easily find macros in salesforce standard objects.

There is limitation with macro which is macro can only be used with feed base layout and with case, account, leads and contact objects.

So before using and creating macros you need to enable feed base layout for the required object.

You also need to set your publisher actions of feed base layout according to your requirement and the instructions that you want to execute using macros.

If you want to use macros in your service console then you need to add macros in service console component.

Now we will see step by step in a very easy way how to create macros:

1- Enable feed base layout for the objects for which you want to create macros.For that create new page layout, select
any existing page layout and enable check box of Feed-Based layout option and assign the page layout to the
required profile.

2- Now you can see the feed base layout option in the object like this:

3- Now you can see the publisher actions in the feed based layout like post, file, New Task, New Contact, New Case
etc. you can also add new publisher action according to your requirement using buttons, links and actions.
4- Now we will create the macro for case feed base.

Steps for creating macros:

4.1 Select macro object. Click on new.

4.2 Give a name to macro. Fill the mandatory fields which is macro name only, you can give description for
macro according to requirement and you can see +Add Instruction that we will use to create instruction.

”We will create a macro that will send an attached article in email, set the email subject, and update the
case status, priority and subject”.

4.3 Now click on +Add Instruction and it will show you the list of objects in which feed base Layout is active select
the required object. Here active tab means that macro will run only for the object whose tab is open that means
active. So we will select the Active case tab because here we are going to create macro for case feed.

4.4 We will create the publisher action Update case in which we will have the status, priority field to update case
using macros. For creating publisher type case in quick search-> select buttons, links or actions-> create new
action.

Layout for this action will contain:

4.5 Now we will add instructions in macro which is what all action we need to take as an instruction. So we will select
the update case-> (select field) Set priority: high -> Set status: working ->Replace subject: Test case. Now we will
insert new action: select knowledge bar component: -> select most relevant article -> Attach to email as
pdf->Attach to case -> select email action -> Replace subject: Error login reply. I will share view of created macro.

So this is the way your macro will look like you just need to click on select +Add Instruction and add actions that you want to add. And click on save.

Now to run your macro. Go on service console check if you can see macros in console widget if its not visible in console widget-> edit app -> go on choose console components -> add macro browser.

Now open any case that you want to update.

Before running macro the case status and email subject is empty and there is no attached file.

Email subject before running macro there is no attachment and no subject:

Update case fields before running macros:

Click on arrow button which is use to run the macro .after successfully run of macro you will get a message and you can see article has attached as pdf to email. This is how the macro runs and now just have to click on submit. To save changes. macro also give you facility to submit the action and close the tab so if you want to do some editing before submitting the action skip submit action.

Change in update status publisher action that we set in macro instruction can be seen after running the macro: