Skip to content

Instantly share code, notes, and snippets.

Ricky Ruhlen rruhlen

  • Salesforce.com
  • San Francisco, CA
Block or report user

Report or block rruhlen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rruhlen
rruhlen / article.css
Created Feb 21, 2019
hide extra fields in article of community, need to adjust the 4 in the 2nd line.
View article.css
.selfServiceArticleLayout .forcePageBlockSectionRow.full { display: none;}
.selfServiceArticleLayout .forcePageBlockSectionRow.full:nth-of-type(4) { display: block;}
.selfServiceArticleLayout.zoom .article-summary { display: none;}
.slds-form_stacked .slds-form-element .slds-form-element__label {display: none;}
@rruhlen
rruhlen / article-lang
Created Jan 24, 2019
detect language and display link if page loaded is the article page
View article-lang
{% case system.language %}
{% when 'en_au' %}
{% if page == 'page_article' %}
AU tag
{% endif %}
{% when 'en_nz' %}
{% if page == 'page_article' %}
NZ tag
{% endif %}
{% endcase %}
@rruhlen
rruhlen / lang-liquid
Created Jan 23, 2019
insert case language liquid into hard-coded url
View lang-liquid
https://service.1cover.com.au/customer/{{system.language}}/portal/articles/2926233-volcanic-eruptions-
@rruhlen
rruhlen / case_theme_liquid
Created Aug 1, 2018
capture a case custom field and display it when a specific value is saved in at least one of two case custom fields
View case_theme_liquid
{% capture feedback %}{{ custom_feedback }}{% endcapture %}
{% if case.custom_feedback == "A comment" or case.custom_feedback == "A question" %}
<div class="agent_ticket_section">
{{ feedback }}
</div>
{% endif %}
@rruhlen
rruhlen / liquid_article_body
Last active Jul 26, 2018
detect article and assign meta tag in header.
View liquid_article_body
{% if article.body contains 'id="unique-value-1' %}
<meta property="og:image" content="jpg"/>
{% elsif article.body contains 'id="unique-value-2' %}
<meta property="og:image" content="jpg"/>
{% endif %}
@rruhlen
rruhlen / gist:ee9954c6f26fbd10496d84e77d439994
Created Jul 11, 2018
Post JSON to /api/v2/customers to create a customer record in your Desk account
View gist:ee9954c6f26fbd10496d84e77d439994
{
"first_name": "Ricky",
"last_name": "Ruhlen",
"emails": [{
"type": "work",
"value": "ricky@gmail.com"
},
{
"type": "home",
"value": "ricky@aol.com"
@rruhlen
rruhlen / businesshours.js
Last active Jul 8, 2018
Show/hide chat based off business hours
View businesshours.js
<script>
(function(a){function E(a,b,c,d){var e=c.lang();return e[a].call?e[a](c,d):e[a][b]}function F(a,b){return function(c){return K(a.call(this,c),b)}}function G(a){return function(b){var c=a.call(this,b);return c+this.lang().ordinal(c)}}function H(a,b,c){this._d=a,this._isUTC=!!b,this._a=a._a||null,this._lang=c||!1}function I(a){var b=this._data={},c=a.years||a.y||0,d=a.months||a.M||0,e=a.weeks||a.w||0,f=a.days||a.d||0,g=a.hours||a.h||0,h=a.minutes||a.m||0,i=a.seconds||a.s||0,j=a.milliseconds||a.ms||0;this._milliseconds=j+i*1e3+h*6e4+g*36e5,this._days=f+e*7,this._months=d+c*12,b.milliseconds=j%1e3,i+=J(j/1e3),b.seconds=i%60,h+=J(i/60),b.minutes=h%60,g+=J(h/60),b.hours=g%24,f+=J(g/24),f+=e*7,b.days=f%30,d+=J(f/30),b.months=d%12,c+=J(d/12),b.years=c,this._lang=!1}function J(a){return a<0?Math.ceil(a):Math.floor(a)}function K(a,b){var c=a+"";while(c.length<b)c="0"+c;return c}function L(a,b,c){var d=b._milliseconds,e=b._days,f=b._months,g;d&&a._d.setTime(+a+d*c),e&&a.date(a.date()+e*c),f&&(g=a.date(),a.date(
@rruhlen
rruhlen / ExecuteDeletion.txt
Created May 17, 2018
To run this class click on Debug→Open Execute Anonymous Window
View ExecuteDeletion.txt
BatchDeleteArticles b = new BatchDeleteArticles(null);
database.executebatch(b,75);
@rruhlen
rruhlen / BatchDeleteArticles.cls
Created May 17, 2018
Batch delete articles and topics via dev console.
View BatchDeleteArticles.cls
public with sharing class BatchDeleteArticles implements Database.batchable<SObject>,Database.allowscallouts,Database.Stateful{
private String configId;
public BatchDeleteArticles (String configId) {
this.configId = configId;
}
public BatchDeleteArticles () {
}
@rruhlen
rruhlen / cases_reports.json
Created Apr 3, 2018
JSON to post to insights3/cases_reports endpoint.
View cases_reports.json
{
"fields": [
"channel_id",
"status_id",
"user_id",
"group_id",
"priority",
"created_at",
"time_to_first_response",
"avg_time_to_resolution",
You can’t perform that action at this time.