...
There are two Pulsar Settings used to enable custom buttons. The format of each is below:
- Define the labels and identifiers for each custom button action.
Name:
...
Here is a great example of how to set up custom buttons:
...
- Object Name - custom button
Key: pulsar.<Object API Name>[.<Record Type Friendly Name or "default">].buttons
Value: Newline separated list of "button_Id:Label" pairs. Labels can contain spaces, button id's cannot contain spaces. See the example below.
EXAMPLE:
Name: Event custom buttons
Key: pulsar.event.default.buttons
Value:
...
- Start_Visit:Start Visit
End_Visit:End Visit
Display_Contact:Display Contact
Create_Call_Record:Create Call Record
View_Call_Record:View Call
...
- Record
- Now define each individual button action using PSL:
Name: Object Name - Button_Id - Action
Key: pulsar.buttonActions.<Object API Name>.button_id
Value: PSL. See examples below.
EXAMPLES:
Name: Event - Start_Visit
...
- Action
Key: pulsar.buttonActions.Event.Start_Visit
Value: See code below. The code checks if the visit Is_Started flag is set, and if not, saves the current location and sets the flag, informing the user that the visit has started.Code Block DEFAULT{
...
Action=SetVar;
...
VarName=Is_Started;
...
VarValue=Is_Started__c;
...
| Action=SqlQuery;
...
QueryString=SELECT CASE WHEN '%%Is_Started%%' = 'TRUE' THEN 1 ELSE 0 END AS IsEventStarted;
...
QueryReturnFields=IsEventStarted;
...
QueryTest=%%IsEventStarted%%=1;
...
QueryTestTrue=EVENT_ALREADY_STARTED;
...
| Action=SetField;
...
FieldType=TimeStamp;
...
FieldName=StartDateTime;
...
| Action=SetField;
...
FieldType=General;
...
FieldName=Is_Started__c;
...
FieldValue=TRUE;
...
| Action=SetLocation;
...
LocationType=DeviceLocation;
...
FieldName=Event_Location__c;
...
|
...
Action=Alert;
...
Message=Visit Has Been Started;
...
} EVENT_ALREADY_STARTED{
...
Action=Alert;
...
Message=Visit has already started. You can only start the visit once;
...
}
...
- Name:
...
Key: pulsar.buttonActions.Event.End_Visit
Value:
...
- Event - Create_Call_Record - ActionKey: pulsar.buttonActions.Event.
...
- Create_Call_
...
- RecordValue:
...
DEFAULT{
Action=Display;
ObjectType=Contact;
ObjectIdField=WhoId;
}
Name: Display Related Contact Button
Key: pulsar.buttonActions.Event.Display_Contact
Value:
DEFAULT{
Action=Display;
ObjectType=Contact;
ObjectIdField=WhoId;
}
...
- See code below. The code checks if a Call Record has already been recorded for the current Event, and if not, creates the new Call Record by mapping field values from the current Event.
Code Block DEFAULT{ Action=SetVar; VarName=Event_Id;
...
VarValue=Id;
...
| Action=SqlQuery;
...
QueryString=Select COUNT () AS Count_Call_Records FROM Call_Record__c WHERE Related_Event__c = '%%Event_Id%%';
...
QueryReturnFields=Count_Call_Records;
...
QueryTest=%%Count_Call_Records%%>0;
...
QueryTestTrue=DISPLAY_MESSAGE;
...
| Action=CreateAndMapFields;
...
ActionShouldComplete=TRUE;
...
ObjectType=Call_Record__c;
...
Related_Event__c=Id;
...
WhatId__c=WhatId;
...
WhoId__c=WhoId;
...
Subject__c=Subject;
...
Description__c=Description;
...
Start_Date_Time__c=StartDateTime;
...
End_Date_Time__c=EndDateTime;
...
} DISPLAY_MESSAGE{
...
Action=Alert;
...
Message=You have already created a call record for this Event;
...
...
}
See the screenshots below to see the logic in action: