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
var jsforce = require('jsforce'); | |
var conn = new jsforce.Connection({ | |
loginUrl: 'https://test.salesforce.com' | |
}); | |
conn.login('YOURACCOUNT', 'YOURASSWORD', function(err, res) { | |
if (err) { | |
return console.error(err); | |
} |
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
var jsforce = require('jsforce'); | |
var conn = new jsforce.Connection({ | |
loginUrl: 'https://test.salesforce.com', //'https://login.salesforce.com', | |
version: '36.0' | |
}); | |
conn.login('youSFDC@Account', 'YourPassword', function(err, res) { | |
if (err) { | |
return console.error(err); |
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
Log__c log= new Log__c( name='log!'); | |
insert log; | |
Blob b = Blob.valueOf(body); | |
Attachment attach1= new Attachment(); | |
attach1.ParentId = log.id; | |
attach1.Name = 'log.txt'; | |
attach1.Body = b; | |
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
ID userid = UserInfo.getUserId(); | |
User currentUser = [SELECT Id, Email FROM User WHERE Id =:userid]; | |
List <String> ToAddresses = new List <String>(); | |
ToAddresses.add('renchk@foxmail.com'); | |
String subject = 'Issue Log Notification Email'; | |
String body = 'Test' + '\n'; |
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
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); | |
string body = 'Hi '; | |
String[] toAddresses = new String[] {'sksworld10@gmail.com'}; | |
mail.setToAddresses(toAddresses); | |
mail.setSubject('Test Subject'); | |
mail.setSaveAsActivity(false); | |
for(OrgWideEmailAddress owa : [select id, Address, DisplayName from OrgWideEmailAddress]) | |
{ | |
if(owa.Address.contains('testuser')) | |
mail.setOrgWideEmailAddressId(owa.id); |
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
Rectypeid = Schema.SObjectType.Your_Object_API_Name.getRecordTypeInfosByName().get('Record Type').getRecordTypeId(); | |
List<Your_Object_API_Name> terms= [select ownerId,Email__c from Your_Object_API_Name where id in: SID]; // SID :set ID | |
List <String> ToAddresses = new List <String>(); | |
ID ownerid; // Get Owner ID | |
boolean Emailexist=false; | |
for(Your_Object_API_Name poi:terms){ | |
if(poi.Email__c!=null){ | |
ToAddresses.add(poi.Email__c); // Get Email address of Supplier | |
ownerid=poi.ownerId; | |
Emailexist=true; |
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
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/items/016EQYPSSQZ3I757WQYVALBAADZKWLQDTI/children/Ren.txt/content'); //me/drive/root/children' | |
req.setheader('accept','application/json'); | |
req.setHeader('Authorization', 'Bearer {!$Credential.OAuthToken}'); | |
req.setHeader('Content-Type', 'text/plain'); | |
String temp= 'data:text/plain;base64,QXBleCBDbGFzc2VzDQoJVW5wYWNrYWdlZA0KCQlBU0lfQ1JNX0NO…FTSV9DUk1fSlBfUmVkaXJlY3RfVGVzdA0KCQlBU0lfQ1JNX0pQX1Rlc3RDbGFzc0hlbHBlcg=='; |
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
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'); |
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
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; |
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
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_ |