Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

There are two Pulsar Settings used to enable custom buttons. The format of each is below:

  1. Define the labels and identifiers for each custom button action.

    Name
    : 

...

 

 

Here is a great example of how to set up custom buttons:

...

  1. 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:

...

  1. Start_Visit:Start Visit 
                End_Visit:End Visit 
                Display_Contact:Display Contact
                Create_Call_Record:Create Call Record 
                View_Call_Record:View Call

...

  1. Record

     
  2. Now define each individual button action using PSL:

    NameObject Name - Button_Id - Action
    Keypulsar.buttonActions.<Object API Name>.button_id
    Value: PSL. See examples below.

    EXAMPLES:

    NameEvent - Start_Visit

...

  1. - Action
    Keypulsar.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{

...

  1.  
    Action=SetVar;

...

  1.  
    VarName=Is_Started;

...

  1.  
    VarValue=Is_Started__c;

...

  1.  
    | 
    Action=SqlQuery;

...

  1.  
    QueryString=SELECT CASE WHEN '%%Is_Started%%' = 'TRUE' THEN 1 ELSE 0 END AS IsEventStarted;

...

  1.  
    QueryReturnFields=IsEventStarted;

...

  1.  
    QueryTest=%%IsEventStarted%%=1;

...

  1.  
    QueryTestTrue=EVENT_ALREADY_STARTED;

...

  1.  
    | 
    Action=SetField;

...

  1.  
    FieldType=TimeStamp;

...

  1.  
    FieldName=StartDateTime;

...

  1.  
    | 
    Action=SetField;

...

  1.  
    FieldType=General;

...

  1.  
    FieldName=Is_Started__c;

...

  1.  
    FieldValue=TRUE;

...

 

  1.  
    |
    Action=SetLocation;

...

  1.  
    LocationType=DeviceLocation;

...

  1.  
    FieldName=Event_Location__c;

...

  1. 
    |

...

  1. 
    Action=Alert;

...

  1.  
    Message=Visit Has Been Started;

...

  1.  
    } 
    
    EVENT_ALREADY_STARTED{

...

  1.  
    Action=Alert;

...

  1.  
    Message=Visit has already started. You can only start the visit once;

...

  1.  
    }

...



  1. Name:

...

Keypulsar.buttonActions.Event.End_Visit

Value:

...

  1.  Event - Create_Call_Record - Action
    Key: pulsar.buttonActions.Event.

...

  1. Create_Call_

...

  1. Record
    Value:

...

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;
}

 

Name: Event - Create Call Record And Map Fields Button
Key: pulsar.buttonActions.Event.Create_Call_Record

...

  1.  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;

...

  1.  
    VarValue=Id;

...

  1.  
    | 
    Action=SqlQuery;

...

  1.  
    QueryString=Select COUNT () AS Count_Call_Records FROM Call_Record__c WHERE Related_Event__c = '%%Event_Id%%';

...

  1.  
    QueryReturnFields=Count_Call_Records;

...

  1.  
    QueryTest=%%Count_Call_Records%%>0;

...

  1.  
    QueryTestTrue=DISPLAY_MESSAGE;

...

  1.  
    | 
    Action=CreateAndMapFields;

...

  1.  
    ActionShouldComplete=TRUE;

...

  1.  
    ObjectType=Call_Record__c;

...

  1.  
    Related_Event__c=Id;

...

  1.  
    WhatId__c=WhatId;

...

  1.  
    WhoId__c=WhoId;

...

  1.  
    Subject__c=Subject;

...

  1.  
    Description__c=Description;

...

  1.  
    Start_Date_Time__c=StartDateTime;

...

  1.  
    End_Date_Time__c=EndDateTime;

...

  1.  
    } 
    
    DISPLAY_MESSAGE{

...

  1.  
    Action=Alert;

...

  1.  
    Message=You have already created a call record for this Event;

...

Name: Event - View Call Record Button
Key: pulsar.buttonActions.Event.View_Call_Record
Value: 
DEFAULT{ 

...

  1.  
    }

See the screenshots below to see the logic in action:

 

 

Image RemovedImage Added

 

Image Removed

Image Removed