Skip to content

Instantly share code, notes, and snippets.

@amandachiuchiu
amandachiuchiu / FeedbackOnAgent.html
Created February 6, 2018 19:14
Feedback on Agent Formula Field for Service Cloud CSAT
IF(ISBLANK(TEXT(Agent_Feedback_Score__c)),'',
IMAGE(CASE( Text(Agent_Feedback_Score__c) ,
'4','/resource/CSAT/4.png',
'3','/resource/CSAT/3.png',
'2','/resource/CSAT/2.png',
'1','/resource/CSAT/1.png',''),'',22,22)
)
@amandachiuchiu
amandachiuchiu / CreateContactfromEmailWeb2Case.txt
Created July 11, 2017 21:49
Apex Trigger: Creating a new contact from Email-to-Case or Web-to-Case
rigger CreateContactfromEmailWeb2Case on Case (before insert) {
List<String> UseremailAddresses = new List<String>();
for (Case c:Trigger.new) {
if (c.ContactId==null &&
c.SuppliedEmail!=''|| c.SuppliedEmail==null)
{
UseremailAddresses.add(c.SuppliedEmail);
}
}
@amandachiuchiu
amandachiuchiu / CreateContactfromEmailWeb2CaseTest.txt
Last active May 11, 2023 20:32
Apex Test Class: Creating a new contact from Email-to-Case or Web-to-Case
public class CreateContactfromEmailWeb2CaseTest {
public static testMethod void testBulkContactsGetCreated() {
List<Case> newCases = new List<Case>();
for (Integer i = 0; i<100; i++) {
Case c = new Case(SuppliedEmail='jdoe_test_test@doe.com' + i,
SuppliedName='John Doe' + i,
Subject='Feedback - Something' + i);
newCases.add(c);
}
@amandachiuchiu
amandachiuchiu / subjectfield.txt
Created April 11, 2017 19:58
Code for Subject Field in the Email (New) Contact Form
<div class="form-group">
<label for="email_subject" class="control-label">{{system.snippets.subject}} ({{system.snippets.required}}):</label>
<input id='email_subject' class="form-control" maxlength='100' name='email[subject]' type='text' value='{% if search_term and search_term != '' %}{{search_term}}{% else %}{{email.subject}}{%endif%}' required/>
</div>
@amandachiuchiu
amandachiuchiu / .txt
Created March 23, 2017 18:02
Hide KB Article Vote Option in Support Center
#rate_article_container {
display: none !important;
}
{% assign emails = case.emails_for_reply_theme %}
{% assign threadlength = emails.size|minus:1 %}
{% for email in emails reversed %}
{% if forloop.first %}
{{email.new_html}}
{% if email.agent %}
<!--- custom agent signature goes here and replaces the following few lines -->
@amandachiuchiu
amandachiuchiu / custom_field.txt
Last active October 4, 2016 23:53
Desk.com Custom Field API JSON Script
{"active":true,
"data":
{"type":"list",
"choices":
["ABS",
"Analyst",
"CMPO",
"Convertible",
"Debt",
"Early Look",
@amandachiuchiu
amandachiuchiu / contactformfield.html
Last active September 21, 2016 23:49
Example of a custom list field added to a contact form
<div class="form-group div-category">
<label for="ticket_custom_INSERTYOURCUSTOMFIELDKEYHERE" class="control-label">
Is your inquiry regarding bagels or cupcakes?({{system.snippets.required}})
</label>
{{ ticket_custom_INSERTYOURCUSTOMFIELDKEYHERE }}
</div>