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
@isTest | |
public class contactUpdateFromScheduleClassTest { | |
@isTest static void contactUpdateTest_Schedule() { | |
Contact cont = new Contact(FirstName ='First Name', LastName ='Last Name', Email='sakthi@theblogreaders.com'); | |
insert cont; | |
// Seconds Minutes Hours Day_of_month Month Day_of_week optional_year | |
String CRON_EXP = '0 6 * * * ?'; |
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
global class contactUpdateFromScheduleClass implements Schedulable { | |
/* | |
This is a ScheduleClass to run every hours after 6 mins to update contact records | |
*/ | |
// Execute below code in developer console | |
// It schedules this class to run every hour after 6 minutes (like 8:06, 9:06, 10:06, etc..) | |
// This is one minute after the exchange rates are fetched from Open Exchange Rates. | |
/* | |
contactUpdateFromScheduleClass contactUpdate = new contactUpdateFromScheduleClass(); | |
// Seconds Minutes Hours Day_of_month Month Day_of_week optional_year |
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
trigger OpportunityDeleteTrigger on Opportunity ( before delete ) { | |
String name = [SELECT Name FROM Profile WHERE Id =:UserInfo.getProfileId()].Name; | |
if( name != 'System Administrator' ) { | |
if( Trigger.isBefore ) { | |
if( Trigger.isDelete ) { | |
for( Opportunity objOpportunity : Trigger.old ) { | |
if( objOpportunity.IsClosed == true ) { | |
objOpportunity.addError( 'This opportunity cannot be deleted becase it has been closed. Please contact Sales Operations.' ); | |
} |
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
/** | |
* | |
* This Apex Test Class Created to cover the Opportunity Trigger | |
* - Created Test User with non system admin profile | |
* - Used Syste.runAs to execute the test user | |
* - Created Opportunity Record | |
* - Deleted Opporutnity | |
* - Check AddError validation as per the Trigger | |
* |
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
String yourFilesContent = 'TheBlogReaders.com File upload content'; | |
ContentVersion conVer = new ContentVersion(); | |
conVer.ContentLocation = 'S'; // to use S specify this document is in Salesforce, to use E for external files | |
conVer.PathOnClient = 'testing.txt'; // The files name, extension is very important here which will help the file in preview. | |
conVer.Title = 'Testing Files'; // Display name of the files | |
conVer.VersionData = EncodingUtil.base64Decode(yourFilesContent); // converting your binary string to Blog | |
insert conVer; //Insert ContentVersion | |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="helloWorld"> | |
<apiVersion>45.0</apiVersion> | |
<isExposed>false</isExposed> | |
<targets> | |
<target>lightning__AppPage</target> | |
<target>lightning__RecordPage</target> | |
<target>lightning__HomePage</target> | |
</targets> | |
</LightningComponentBundle> |
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
import { LightningElement, track } from 'lwc'; | |
export default class HelloWorld extends LightningElement { | |
@track greeting = 'World'; | |
changeHandler(event) { | |
this.greeting = event.target.value; | |
} | |
} |
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
<template> | |
<lightning-card title="HelloWorld" icon-name="custom:custom14"> | |
<div class="slds-m-around_medium"> | |
<p>Hello, {greeting}!</p> | |
<lightning-input label="Name" value={greeting} onchange={changeHandler}></lightning-input> | |
</div> | |
</lightning-card> | |
</template> |
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 with sharing class AccountController { | |
/* | |
Method: searchAccount | |
Para: Account Name | |
here passing the Account Name to Fetching all the releated Accounts | |
*/ | |
@AuraEnabled (cacheable = true) | |
public static List<Account> searchAccount(String accName) { | |
string strAccName = '%'+ accName + '%'; |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="lightningDataTable"> | |
<apiVersion>46.0</apiVersion> | |
<isExposed>true</isExposed> | |
<targets> | |
<target>lightning__AppPage</target> | |
<target>lightning__RecordPage</target> | |
<target>lightning__HomePage</target> | |
</targets> | |
</LightningComponentBundle> |
NewerOlder