William
IndividualForum Replies Created
-
William
MemberJuly 24, 2018 at 6:54 am in reply to: I am new to salesforce. i want to send email with attachmentHere is the method, You can send the document/email with an attachment:
public with sharing class EmailDocumentSend {
public list<ID> documentId {get;set;}
public String email {get;set;}
public list<selectoption> getfindDocument(){
list<selectoption> documentlist = new list<selectoption>();
for(Document docs:[select id, name, type from Document order by name]){
documentlist.add(new SelectOption(docs.id, docs.name+' – '+docs.type));
}
return documentlist;
}
public PageReference emailDocSend() {
list<Document> docmnt= [select id, name, body, contenttype, developername, type from Document where id = :documentId];
for(Document doc:docmnt){
Messaging.EmailFileAttachment attach = new Messaging.EmailFileAttachment();
attach.setContentType(doc.contentType);
attach.setFileName(doc.developerName+'.'+doc.type);
attach.setInline(false);
attach.Body = doc.Body;Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setUseSignature(false);
mail.setToAddresses(new String[] { email });
mail.setSubject('Email from Salesforce');
mail.setHtmlBody('Salesforce Doc is: '+doc.name);
mail.setFileAttachments(new Messaging.EmailFileAttachment[] { attach });
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'Document '+doc.name+email));
}
return null;
}
}
Visualforce Page
<apex:page controller="EmailDocumentSend" showHeader="false" sidebar="false">
<apex:sectionHeader title="Email Document " subtitle="Email a Document"/>
<apex:form >
<apex:pageMessages />
<apex:pageBlock title="Enter Email Address">
<apex:pageBlockButtons >
<apex:commandButton action="{!emailDocSend}" value="Send Document"/>
</apex:pageBlockButtons><apex:pageBlockSection>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Email to send to" for="email"/>
<apex:inputText value="{!email}" id="email"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel value="Document" for="document"/>
<apex:selectList multiselect="true" value="{!documentId}" id="document" size="4">
<apex:selectOptions value="{!findDocument}"/>
</apex:selectList>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
-
Here is the code, you can use
Apex Class
public class paginationStandard {
public ApexPages.StandardSetController setCon {
get {
if(setCon == null) {
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
[select name,closedate ,type,leadsource,stageName, amount from Opportunity]));
}
return setCon;
}
set;
}
public List<Opportunity> getOpportunities() {
setCon.setpagesize(10);
return (List<Opportunity>) setCon.getRecords();
}
}
Visualforce Page
<apex:page controller="paginationStandard">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!Opportunities}" var="o">
<apex:column value="{!o.name}"/>
<apex:column value="{!o.closedate}"/>
<apex:column value="{!o.stageName}"/>
<apex:column value="{!o.Amount}"/>
<apex:column value="{!o.Type}"/>
<apex:column value="{!o.LeadSource}"/>
</apex:pageBlockTable>
<apex:commandButton rendered="{!setCon.hasPrevious}" value="Previous" action="{!setCon.previous}"/>
<apex:commandButton rendered="{!setCon.hasNext}" value="Next" action="{!setCon.next}"/>
<apex:commandButton rendered="{!setCon.hasPrevious}" value="first" action="{!setCon.first}"/>
<apex:commandButton rendered="{!setCon.hasNext}" value="Last" action="{!setCon.last}"/>
<apex:outputText rendered="{!(setCon.pageNumber * setCon.pageSize) < setCon.ResultSize}" value="{!setCon.pageNumber * setCon.pageSize} Of {!setCon.ResultSize}"></apex:outputText>
<apex:outputText rendered="{!(setCon.pageNumber * setCon.pageSize) >= setCon.ResultSize}" value="{!setCon.ResultSize} Of {!setCon.ResultSize}"></apex:outputText>....
</apex:pageBlock>
</apex:form>
</apex:page>
-
William
MemberJuly 9, 2018 at 12:25 pm in reply to: Salesforce Lightning migration from classic to lightningSalesforce Lightning has included several new features designed for optimization of sales along with enhanced UI to provide an efficient and problem-solving environment. Migration from Salesforce classic to Salesforce Lightning is very easy while inheriting all permissions and sharing settings that were already defined in Salesforce Classic. All the existing Salesforce Classic users are encouraged to migrate to Salesforce Lightning because of several benefits which are as follows:
Efficient navigation and flexibility to switch between custom apps
Easy and quick access to tools like notes and recent items for productivity
New layout facility based on better filters and sort options along with a turbocharged view to have a better glance at the data
Interactive and user-friendly dashboards
Access to several reports that may be required by top management for strategic decisions.Customizable page
Real-time analysis of data using tools like performance charts to monitor the current scenario
Avoid coding for building custom application
Easy identification of key area which needs attention and focusing on it
Customization in sales process, creation of records and quick closure of deals
Visually appealing dashboards
Creation of list views by using Lightning Experience’s intuitive filter panel.
Quick visualization of data with list view charts and inclusion of filters to grab the detailing.
With Kanban view, you can manage and organize a set of records to track your work at a glance. It also enables you to generate alerts to notify you incase of action required.- This reply was modified 6 years, 4 months ago by William.
-
JIRA is a software that is used for project management, bug tracking and issue tracking. Integrating JIRA with Salesforce can be a turnkey factor for your business. You can either hire a good Salesforce integration partner to do that for you or try one of the following means given below. However, it is suggested that you hire a professional Salesforce Developer for this as this is a technical procedure and requires technical expertise.
· Use Salesforce JIRA connector· Using Salesforce Apex to connect an external source with its own API
· Use any middleware connector
· Go to Salesforce AppExchange and look for an integration app
-
Try this.
<aura:component implements="force:appHostable" controller="LightingDmlOperation">
<div class="container-fluid">
<div class="slds-form-element">
<div class="slds-form-element__control" style=" margin-left: 60px;width:25%">
<ui:inputText aura:id="AccountName" label=" Name" class="slds-input" labelClass="slds-form-element__label" value="{!v.newAccount.Name}"
placeholder="Enter Name" required="true" onError="{!c.handleError}" onClearErrors="{!c.handleClearError}" />
</div>
</div>
<div class="form-group" style=" margin-left: 60px;width:25%">
<ui:inputText aura:id="Accounttype" label="Type" class="slds-input" labelClass="slds-form-element__label"
value="{!v.newAccount.Type}" placeholder="Enter type value" onClearErrors="{!c.handleClearError}"/>
</div>
<div class="form-group" style=" margin-left: 60px;width:25%">
<ui:inputText aura:id="AccountPhone" label=" Phone" class="slds-input" labelClass="slds-form-element__label"
value="{!v.newAccount.Phone}" onError="{!c.handleError}" onClearErrors="{!c.handleClearError}" />
</div>
<div class="col-md-4 text-center" style=" margin-left: 120px;width:25%" algin="center">
<ui:button label="Submit" class="slds-button slds-button--neutral" labelClass="label" press="{!c.createAccount}" />
</div>
</div>
</aura:component>
Controller
({
createAccount : function(component, event, helper) {
var nameField = component.find("AccountName");
var nameValue = nameField.get("v.value");
var PhoneField = component.find("AccountPhone");
var nameValue1 = PhoneField.get("v.value");
var newAcc = component.get("v.newAccount");
var action = component.get("c.saveAccount");
action.setParams({ "acc": newAcc});
action.setCallback(this, function(a) {
var state = a.getState();
if (state === "SUCCESS") {
var name = a.getReturnValue();
}
});
$A.enqueueAction(action);
if(nameValue.length <0 ||nameValue.length==0 ) {
nameField.set("v.errors", [{message:"Name value can not blank"}]);
}
else if (($A.util.isEmpty(nameValue1) || $A.util.isUndefined(nameValue1))){
PhoneField.set("v.errors",[{message:"phone can not null"}]);
}
else {
nameField.set("v.errors",null);
PhoneField.set("v.errors",null);
}
},
handleError:function(cmp,event,helper){
var comp = event.getSource();
$A.util.addClass(cmp, "error");
},
handleClearError:function(cmp,event,helper){
var comp = event.getSource();
$A.util.removeClass(cmp, "error");
},
})
-
Here is the difference between SOQL and SOSL
SOQL -
Only one object at a time can be searched(Search in Single object)
Query all type of field
It can be used in classes n triggers
DML Operation can be performed on query results
SOQL use when we know in Which objects or fields the data resides.
We can retrieve data from single object or multiple objects that are related to each other.SOSL -
Many object can be searched at a time(Search in entire organization or Database)
Query on only email, text or phone
It can use in classes but not in trigger
DML Operation cannot be performed on search results
SOSL use when we don’t know in which object or field the data resides.
We can retrieve multiple objects and field values where the objects may or may not be related to each other.- This reply was modified 6 years, 4 months ago by William.
-
Salesforce has acquired the status of best cloud computing services all over the world. The wonders that a good Salesforce implementation can do are phenomenal. Salesforce cloud computing gives you the opportunity to integrate your entire infrastructure including the servers, databases, software, hardware everything over cloud which makes everything a seamless endeavor for you. It provides the following benefits to you-
· Increased Business productivity· 360-degree view of a customer’s information
· Enhanced customer satisfaction
· Effective time management
· Automation of several everyday tasks that saves time and labour
· Better sales opportunities
· Data Integration
· Improved internal organization
· Greater efficiency for multiple teams
· Improved Analytical Data Reporting
-
William
MemberJuly 4, 2018 at 3:36 am in reply to: What is the difference between Force.com and Salesforce.com?Salesforce has stood the test of time and has proved to be the best cloud-based CRM. Force.com and Salesforce.com are an important part of Salesforce Application Development. Most of the companies today are using Salesforce.com and force.com platforms for building cloud-based custom apps for their business needs.
Salesforce.com helps the companies using Salesforce in providing the essential CRM functionalities such as sales, services, apps etc with software as service functionality. Force.com, on the other hand, is the platform that provides the base for all these services such as UI, the database etc, and is the flag bearer part of the platform as a service side of the Salesforce setup.
-
William
MemberMay 29, 2018 at 5:47 am in reply to: How i can delete selected list value on button click in Salesforce?We can delete record in two ways
1. By using custom button
2. Visualforce page
By using custom button:
Go to account setup->Account -> Buttons, Links, and Actions->New Button or link
Choose display type list view
Behavior type execute java script
Content Source onclick Java script
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
var isdelete = {!GETRECORDIDS( $ObjectType.Account)};
var deleteRecord= 'Are you sure to delete ' +isdelete.length+ ' Records?';
if(isdelete.length&& (window.confirm(deleteRecord)))
{
sforce.connection.deleteIds(isdelete,function()
{navigateToUrl(window.location.href);
});
}
else if (isdelete.length == 0)
{
alert("Please select Account record to delete");
}
Then go to search layout add button to list view
3. Visualforce page
To fulfill this requirement you need a wrapper class, main class and visualforce page
Class
public class AccountDelete {
public list<Account> Acclist{get;set;}
public ID currentPageID;
public list<DeleteExample> accWrap {get;set;}
public AccountDelete(ApexPages.StandardController controller) {
accWrap = new list<DeleteExample>();
//Querying the Student records
Acclist = [select id,name,industry from account];
//Iterating through all the records of the student object
for(integer i =0;i<Acclist.size();i++){
//Creating a new Object of InnerClass
DeleteExample conObj = new DeleteExample(false,Acclist[i]);
accWrap.add(conObj);
}
}
//Method to delete the selected records
public pagereference deletecheckedRecs (){
//Iterating through the list
for(integer i=0;i<accWrap.size();i++){
//Fetching data of the selected records
if(accWrap[i].checkbox == true){
//deleting student records based on lists index
delete accWrap[i].accObj;
}
}
// create visualforce page with name deleteWrapperExample
pagereference ref = new pagereference('/apex/deleteWrapperExample');
ref.setredirect(true);
return ref;
}
//Inner Class
public class DeleteExample{
public boolean checkbox{get;set;}
public account accObj{get;set;}
public DeleteExample(boolean checkbox,account acc)
{
checkbox = checkbox;
accObj = acc;
}
}
}
Visualforce page
<apex:page standardController="Account" extensions="AccountDelete">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!accWrap}" var="acc">
<apex:column headerValue="select">
<apex:inputCheckbox value="{!acc.checkbox}"/>
</apex:column>
<apex:column headerValue="id">
<apex:outputField value="{!acc.accObj.id}"/>
</apex:column>
<apex:column headerValue="Name">
<apex:outputField value="{!acc.accObj.name}"/>
</apex:column>
<apex:column headerValue="Industry">
<apex:outputField value="{!acc.accObj.Industry}"/>
</apex:column>
</apex:pageBlockTable>
<apex:pageBlockButtons >
<apex:commandButton value="delete" action="{! deletecheckedRecs}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
-
William
MemberMay 29, 2018 at 5:45 am in reply to: How can I manipulate records with DML in Salesforce?DML operations allow you to modify records one at a time or in batches. DML are the actions which are performed in order to perform insert, update, delete, upsert, delete & undelete. You can perform DML operations either on a single sObject, or in bulk on a list of sObjects.
Followings are DML actions
• insert: Use this statement to create the records of sObject.
• update: Use this statement to update the existing records of sObject.
• upsert: Use this statement to create the new record or update the existing records on the basis of Id or external field.
• delete : Use this statement to delete the existing record
• undelete : Use this statement to restore the records from Organization recycle bin.
• merge : Use this statement to merge the records of same sObject type by deleting other and re-parenting the related records. You can use up to 3 records to merge.
Sample Code
Account[] acctsList = [SELECT Id, Name, BillingCity
FROM Account WHERE BillingCity = 'Bombay'];
for (Account a : acctsList) {
a.BillingCity = 'Mumbai';
}
Account newAcct = new Account(Name = 'Acme', BillingCity = 'San Francisco');
acctsList.add(newAcct);
try {
upsert acctsList;
} catch (DmlException e) {
System.debug(e.ErrorMessage());
// Process exception here
}