Uptime & Heartbeat Monitors
Integrations
Powered By GitBook
Salesforce Integration
Salesforce provides customer relationship management service and also provides a complementary suite of enterprise applications focused.

In iLert

    1.
    Go to the "Alert sources" tab and click "Create new alert source"
    1.
    Enter a name and select your desired escalation policy.
    Select "Salesforce" as the Integration Type and click Save.
    1.
    On the next page, an Salesforce URL is generated. You will need the URL and the API Keys for the configuration from Salesforce side.

In Salesforce

This Documentation is based on the new Salesforce Lightning, new UI from Salesforce
Navigate to Developer Console by clicking the Settings icon and then click the Developer Console.
In Developer Console page select File -> New -> Apex Class and copy the following and save it as ilertClass.apxc, then click Save.
1
global class ilertClass {
2
3
@future(callout=true)
4
WebService static void xRESTCall(String endpoint, String payload){
5
HttpRequest req = new HttpRequest();
6
req.setEndpoint(endpoint);
7
req.setMethod('POST');
8
req.setBody(payload);
9
req.setHeader( 'Content-Type', 'application/json' );
10
req.setHeader( 'Accept', 'application/json' );
11
Http http = new Http();
12
HTTPResponse res = http.send(req);
13
System.debug(' Response: ' + res.getBody());
14
}
15
16
global static string getPayloadStringByHandlingNull(String value){
17
return value==null?null:'"'+value.replaceAll('[^a-zA-Z0-9\\s]', '').replaceAll('\\s+', ' ')+'"';
18
}
19
20
global static string getPayloadStringByHandlingNull(DateTime value){
21
return value==null?null:'"'+value+'"';
22
}
23
24
global static string getPayloadStringByHandlingNull(Decimal value){
25
return value==null?null:'"'+value+'"';
26
}
27
28
global static string getPayloadStringByHandlingNull(Boolean value){
29
return value==null?null:'"'+value+'"';
30
}
31
}
Copied!
Create a trigger by clicking File -> New -> Apex Trigger and copy the following and save it as ilertTrigger.apxt. Please make sure that the API_KEY and the URL is replaced based on the relevant API_KEY and URL that were received from iLert side.
1
trigger ilertCaseTrigger on Case (after insert, after update) {
2
3
string endpoint = 'URL';
4
string apiKey = 'API_KEY';
5
Case obj = Trigger.new[0];
6
7
System.debug('ilertCaseTrigger Fired');
8
9
string caseNumber = obj.CaseNumber;
10
string subject = obj.Subject;
11
string description = obj.Description;
12
13
string eventType = 'ALERT';
14
15
if (obj.IsClosed) {
16
eventType = 'RESOLVE';
17
}
18
19
string payload= '{'+
20
'\"eventType\" :' + ilertClass.getPayloadStringByHandlingNull(eventType)+ ',' +
21
'\"apiKey\" :' + ilertClass.getPayloadStringByHandlingNull(apiKey)+ ',' +
22
'\"incidentKey\" :' + ilertClass.getPayloadStringByHandlingNull(caseNumber)+ ',' +
23
'\"summary\" :' + ilertClass.getPayloadStringByHandlingNull(subject)+ ',' +
24
'\"details\" :' + ilertClass.getPayloadStringByHandlingNull(description) +
25
'}';
26
27
System.debug('Payload: ' + payload);
28
29
ilertClass.xRESTCall(endpoint, payload);
30
}
Copied!
In order to send to iLert, the domain needs to be allowlisted, back to the Salesforce page and select Setup from settings and go to Setup -> Security -> Remote Site Settings page.
Add a new remote site name it "iLert" and then paste the URL copied https://api.ilert.com to the "Remote Site URL" field and Save.
To test this, simply create a Case in Salesforce.

FAQ

    1.
    How to Debug in case something is not working? In order to Debug this, you need to add System.debug() either on the trigger or the class. To view this just navigate to Gear Icon -> Setup -> Environment -> Logs -> Debug Logs
    2.
    I don't see my logs, why? Make sure that the Expiration Date settings in the Debug Logs settings are set in the future, just edit it if it was done in the past, and create Case again.
Last modified 12d ago
Copy link