// This is the updated code to be used for the Salesforce plugin: https://appexchange.salesforce.com/appxListingDetail?listingId=a0N300000016YDZEA2
// Install the plubin.
// Changout all of the Apex installed in the unsubscribe class with updated code below.
// Add the custom field hasOptedOutOfEmail__c (without the __c, salesforce will add that) to your Lead and Contact object.
// Create an email in Setup > Custom Code > Email Services (and make it active)
// Then just append ?subject=Unsubscribe to the end of the email and insert that link into any mailings.
// This allows a user to unsubscribe via email.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void method(){ | |
try { | |
// do stuff | |
return redirectUser(true); | |
} catch (Exception e) { | |
return redirectUser(false); | |
} | |
} | |
public PageReference redirectUser(Boolean success){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JSON DESERIALIZATION (API RESPONSE OR OTHER) | |
// -------------------- | |
// Deserialize and cast JSON string into single object | |
Map<String,Object> jsonObjectMap = (Map<String,Object>)JSON.deserializeUntyped('{"id":"001","email":"email@email.com"}'); | |
String externalId = String.valueOf(jsonObjectMap.get('id')); | |
// -------------------- |
Run through this list to setup your EC2 instance and host your rails app. This list makes a few assumptions (make changes as necessary)
- You have github repo with a rails app pushed to it that we'll just pull down to the new server
- You're using Rails 5.1
- Use the basic Linux AMI distro: Amazon Linux AMI 2017.09.0 (HVM), SSD Volume Type - ami-8c1be5f6
- Select a size: t2.micro is fine for this, unless you need larger for a production app