Skip to content

Instantly share code, notes, and snippets.

View TonyRenHK's full-sized avatar
:octocat:
Salesforce

CK Ren TonyRenHK

:octocat:
Salesforce
View GitHub Profile
@TonyRenHK
TonyRenHK / 0_reuse_code.js
Created October 15, 2015 01:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
function myFunction() {
showURL("http://www.google.com");
}
//
function showURL(href){
var app = UiApp.createApplication().setHeight(50).setWidth(200);
app.setTitle("Show URL");
var link = app.createAnchor('open ', href).setId("link");
@TonyRenHK
TonyRenHK / gist:a4f0843c8743ebc2f85f3024ee01c4f7
Created May 31, 2016 10:00
Update KR CRM OBIEE Port ID
List<user> selectList=[SELECT ID ,ASI_OBIEE_Domain__c FROM USER WHERE CompanyName = 'Pernod Ricard Korea'];
for(user u: selectList){
u.ASI_OBIEE_Domain__c='8622';
}
update selectList;
List<ASI_MFM_PO__c> List_View = [select id,ownerid from ASI_MFM_PO__c where ownerid = '005D00000023lLv' and id!='a9AD00000001Z8xMAE'
and id !='a9AD00000001Z3nMAE' and id!='a9AD00000001Z92MAE'
and id !='a9AD00000001Z3TMAU' and id!='a9AD00000001Z8sMAE'
and id !='a9AD00000001Z68MAE' and id !='a9AD0000000XaJDMA0' and id !='a9AD00000001Z97MAE' and id !='a9AD00000001Z63MAE' and id !='a9AD00000001Z3iMAE'
and id !='a9AD0000000XaItMAK' and id !='a9AD00000001iXzMAI' and id !='a9AD00000001fT6MAI'];
for (ASI_MFM_PO__c ListA : List_View) {
ListA.ownerid = '005D000000259Yq';
}
SELECT ID,NAME,ASI_MFM_PO_Balance__c,CreatedDate FROM ASI_MFM_PO__c WHERE RecordType.DeveloperName LIKE 'ASI_MFM_SG%' and ASI_MFM_PO_Balance__c<0 order by CreatedDate
@TonyRenHK
TonyRenHK / JQuery-Input-only-input-one-field.html
Created August 28, 2016 15:06
JQuery-Input-only-input-one-field.html
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script>
$(document).ready(function(){
$("#id1").keyup(function(){
if(($('#id1').val().length > 0)){
<!DOCTYPE html>
<html lang="en">
<head>
<title>Generate Blog Post Name quickly</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
List<ASI_MFM_Role_Prefix_Relationship__c> insertList= new List<ASI_MFM_Role_Prefix_Relationship__c>();
ASI_MFM_Role_Prefix_Relationship__c temp = new ASI_MFM_Role_Prefix_Relationship__c (ASI_MFM_Prefix__c='a9FD0000000HPKs',ASI_MFM_Role_Name__c='ASI_JP_CW_L_Brand_Director');
insertList.add(temp);
ASI_MFM_Role_Prefix_Relationship__c temp1= new ASI_MFM_Role_Prefix_Relationship__c (ASI_MFM_Prefix__c='a9FD0000000HPKs',ASI_MFM_Role_Name__c='ASI_JP_Marketing_Analyst_Manager'); insertList.add(temp1);
ASI_MFM_Role_Prefix_Relationship__c temp2= new ASI_MFM_Role_Prefix_Relationship__c (ASI_MFM_Prefix__c='a9FD0000000HPKs',ASI_MFM_Role_Name__c='ASI_JP_Marketing_Assistant'); insertList.add(temp2);
ASI_MFM_Role_Prefix_Relationship__c temp3= new ASI_MFM_Role_Prefix_Relationship__c (ASI_MFM_Prefix__c='a9FD0000000HPKs',ASI_MFM_Role_Name__c='ASI_JP_Trade_Marketing_Manager'); insertList.add(temp3);
ASI_MFM_Role_Prefix_Relationship__c temp4= new ASI_MFM_Role_Prefix_Relationship__c (ASI_MFM_Prefix__c='a9FD0000000HPKs',ASI_MFM_
List<user> updateUserList = new List<user>();
for(User u: [select id, name, ASI_OBIEE_Domain__c, CompanyName from User where CompanyName like '%Singapore%' and isActive = true]){
u.ASI_OBIEE_Domain__c = '8624';
updateUserList.add(u);
}
update updateUserList;
@TonyRenHK
TonyRenHK / gist:1a05ff9711412b30c929b4f9c59e9923
Created September 30, 2016 03:11
HttpRequest Class Office 365
HttpRequest req = new HttpRequest();
Http http = new Http();
//req.setheader('accept','application/json');
//https://tonyren-my.sharepoint.com/_api/v1.0/me/files/016EQYPSSQZ3I757WQYVALBAADZKWLQDTI/children?expand=thumbnails
req.setEndpoint('callout:Office365NamedCredential2/drive/root'); //me/drive/root/children'
req.setheader('accept','application/json');
req.setHeader('Authorization', 'Bearer {!$Credential.OAuthToken}');
//req.setHeader('Content-Type', 'application/json');
req.setMethod('GET');