Skip to content

Instantly share code, notes, and snippets.

@CraigCav
Last active August 29, 2015 14:18
Show Gist options
  • Save CraigCav/fe4650c2635e71828735 to your computer and use it in GitHub Desktop.
Save CraigCav/fe4650c2635e71828735 to your computer and use it in GitHub Desktop.
trigger WellDepthNotification on FX5__Job__c (after update) {
for(FX5__Job__c job: Trigger.New)
{
if(job.Well_Depth__c > 50)
{
Messaging.PushNotification msg = new Messaging.PushNotification();
String userId = job.OwnerId;
Set<String> users = new Set<String>();
users.add(userId);
Map<String, Object> payload = new Map<String, Object>();
payload.put('message', 'Well depth set to ' + job.Well_Depth__c);
payload.put('url', URL.getSalesforceBaseUrl().toExternalForm() + '/' + job.Id);
msg.setPayload(payload);
msg.send('Android_Wear_Demo', users);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment