- Naveen Ashok Sirivella
- NEWBIE
- 10 Points
- Member since 2018
-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
4Questions
-
10Replies
Populate campaign details on lead record
Hi All,
I want to update campaign name,primary product on Lead record .
Please find the below code
Public static void After_UpdateLeadCampaignDetails()
{
List<CampaignMember> camlist = (List<CampaignMember>)trigger.new;
System.debug('Values in the camlist:========================>'+camlist);
Set<Id> leadid = new Set<Id>();
List<Lead> leadlist = new List<Lead>();
for(CampaignMember cm:camlist)
{
Lead lea = new Lead();
if(lea.id == cm.LeadId)
{
lea.Campaign_Name__c = cm.Campaign.name;
leadlist.add(lea);
}
}
database.update(leadlist);
}
Please help any one
I want to update campaign name,primary product on Lead record .
Please find the below code
Public static void After_UpdateLeadCampaignDetails()
{
List<CampaignMember> camlist = (List<CampaignMember>)trigger.new;
System.debug('Values in the camlist:========================>'+camlist);
Set<Id> leadid = new Set<Id>();
List<Lead> leadlist = new List<Lead>();
for(CampaignMember cm:camlist)
{
Lead lea = new Lead();
if(lea.id == cm.LeadId)
{
lea.Campaign_Name__c = cm.Campaign.name;
leadlist.add(lea);
}
}
database.update(leadlist);
}
Please help any one
- Naveen Ashok Sirivella
- July 02, 2018
- Like
- 0
- Continue reading or reply
Creating rollup summary values for lookup by using triggers
Hi All,
I want to create rollup summary fields on Account object.
Scenario : calculate how many open opportunities (except closed won,closed lost) and populate on account record.
please find the below code
trigger CalculatingOpenOpportunity on Opportunity (After insert)
{
if(Trigger.isInsert && Trigger.isAfter)
{
Set<id> accountids = new Set<id>();
List<Account> acclist = new List<Account>();
for(Opportunity opp : trigger.new)
{
if(opp.StageName != 'Closed Won' && opp.StageName != 'Closed Lost')
{
accountids.add(opp.id);
system.debug('values in the accountids:========================================>'+accountids);
}
}
// get a map of the accounts
Map<id,Account> accountMap = new Map<id,Account>([select id,Open_opportunities_count__c from Account where id IN :accountids]);
System.debug('values in the accountMap :=============================================>'+accountMap);
//Quering related opportunities and accounts.
for(Account acc:[select id,name,Open_opportunities_count__c,(select id,name,StageName from opportunities) from Account where ID IN :accountids])
{
accountMap.get(acc.Id).Open_opportunities_count__c = acc.Opportunities.size();
System.debug('values in the accountMap.get(acc.Id).Open_opportunities_count__c:================================>'+accountMap.get(acc.Id).Open_opportunities_count__c);
//Adding count and opportunities to list
acclist.add(accountMap.get(acc.Id));
}
if(acclist.size() > 0)
{
System.debug('Size of the acclist :==============================>'+acclist.size());
database.update(acclist);
}
}
}
Please help on above scenario's
I want to create rollup summary fields on Account object.
Scenario : calculate how many open opportunities (except closed won,closed lost) and populate on account record.
please find the below code
trigger CalculatingOpenOpportunity on Opportunity (After insert)
{
if(Trigger.isInsert && Trigger.isAfter)
{
Set<id> accountids = new Set<id>();
List<Account> acclist = new List<Account>();
for(Opportunity opp : trigger.new)
{
if(opp.StageName != 'Closed Won' && opp.StageName != 'Closed Lost')
{
accountids.add(opp.id);
system.debug('values in the accountids:========================================>'+accountids);
}
}
// get a map of the accounts
Map<id,Account> accountMap = new Map<id,Account>([select id,Open_opportunities_count__c from Account where id IN :accountids]);
System.debug('values in the accountMap :=============================================>'+accountMap);
//Quering related opportunities and accounts.
for(Account acc:[select id,name,Open_opportunities_count__c,(select id,name,StageName from opportunities) from Account where ID IN :accountids])
{
accountMap.get(acc.Id).Open_opportunities_count__c = acc.Opportunities.size();
System.debug('values in the accountMap.get(acc.Id).Open_opportunities_count__c:================================>'+accountMap.get(acc.Id).Open_opportunities_count__c);
//Adding count and opportunities to list
acclist.add(accountMap.get(acc.Id));
}
if(acclist.size() > 0)
{
System.debug('Size of the acclist :==============================>'+acclist.size());
database.update(acclist);
}
}
}
Please help on above scenario's
- Naveen Ashok Sirivella
- July 02, 2018
- Like
- 0
- Continue reading or reply
I want help for sales force coding
Hi All,
I have 2 years of exp in salesforce development.Currently i am working on testing project.
I have forget my coding knowlege.
I am again started learning salesforce coding can any one please help me to increase my coding knowledge.
Thanks
Naveen Ashok S
I have 2 years of exp in salesforce development.Currently i am working on testing project.
I have forget my coding knowlege.
I am again started learning salesforce coding can any one please help me to increase my coding knowledge.
Thanks
Naveen Ashok S
- Naveen Ashok Sirivella
- March 23, 2018
- Like
- 0
- Continue reading or reply
How to display pageblock when click on button in visualforce page
Hi All,
I am new to salesforce.
I have on requirment.When i click on "Show All leads" button on that time only records need to display with new page block.
Below are my code:
-----------------------------------
VF page
----------------------
<apex:page standardController="Lead" Extensions="DisplayingListofrecords_Controller">
<apex:form >
<apex:pageBlock title="For buttons">
<apex:commandButton action="{!ShowLeads}" value="Show Leads" reRender="Details"/>
</apex:pageBlock>
</apex:form>
<apex:outputPanel id="Details">
<apex:actionStatus startText="Requesting............">
<apex:pageBlock title="Displaying List of accounts" id="Showlistofleads" rendered="false">
<apex:dataTable value="{!leadlist}" var="a" cellpadding="4" border="1">
<apex:column >
<apex:facet name="header">Name</apex:facet>
{!a.Name}
</apex:column>
<apex:column >
<apex:facet name="header">Company</apex:facet>
{!a.Company}
</apex:column>
<apex:column >
<apex:facet name="header">Status</apex:facet>
{!a.Status}
</apex:column>
<apex:column >
<apex:facet name="header">Industry</apex:facet>
{!a.Industry}
</apex:column>
<apex:column >
<apex:facet name="header">Email</apex:facet>
{!a.Email}
</apex:column>
<apex:column >
<apex:facet name="header">LeadSource</apex:facet>
{!a.LeadSource}
</apex:column>
<apex:column >
<apex:facet name="header">Lead Score</apex:facet>
{!a.Lead_Score__c}
</apex:column>
</apex:dataTable>
</apex:pageBlock>
</apex:actionStatus>
</apex:outputPanel>
</apex:page>
Controller
-------------------
public with sharing class DisplayingListofrecords_Controller {
Public List<Lead> leadlist {get;set;}
public DisplayingListofrecords_Controller(ApexPages.StandardController controller) {
}
public PageReference ShowLeads()
{
leadlist = [select Name,Company,Status,Industry,Email,LeadSource,Lead_Score__c from lead];
return null;
}
}
I am new to salesforce.
I have on requirment.When i click on "Show All leads" button on that time only records need to display with new page block.
Below are my code:
-----------------------------------
VF page
----------------------
<apex:page standardController="Lead" Extensions="DisplayingListofrecords_Controller">
<apex:form >
<apex:pageBlock title="For buttons">
<apex:commandButton action="{!ShowLeads}" value="Show Leads" reRender="Details"/>
</apex:pageBlock>
</apex:form>
<apex:outputPanel id="Details">
<apex:actionStatus startText="Requesting............">
<apex:pageBlock title="Displaying List of accounts" id="Showlistofleads" rendered="false">
<apex:dataTable value="{!leadlist}" var="a" cellpadding="4" border="1">
<apex:column >
<apex:facet name="header">Name</apex:facet>
{!a.Name}
</apex:column>
<apex:column >
<apex:facet name="header">Company</apex:facet>
{!a.Company}
</apex:column>
<apex:column >
<apex:facet name="header">Status</apex:facet>
{!a.Status}
</apex:column>
<apex:column >
<apex:facet name="header">Industry</apex:facet>
{!a.Industry}
</apex:column>
<apex:column >
<apex:facet name="header">Email</apex:facet>
{!a.Email}
</apex:column>
<apex:column >
<apex:facet name="header">LeadSource</apex:facet>
{!a.LeadSource}
</apex:column>
<apex:column >
<apex:facet name="header">Lead Score</apex:facet>
{!a.Lead_Score__c}
</apex:column>
</apex:dataTable>
</apex:pageBlock>
</apex:actionStatus>
</apex:outputPanel>
</apex:page>
Controller
-------------------
public with sharing class DisplayingListofrecords_Controller {
Public List<Lead> leadlist {get;set;}
public DisplayingListofrecords_Controller(ApexPages.StandardController controller) {
}
public PageReference ShowLeads()
{
leadlist = [select Name,Company,Status,Industry,Email,LeadSource,Lead_Score__c from lead];
return null;
}
}
- Naveen Ashok Sirivella
- March 14, 2018
- Like
- 0
- Continue reading or reply
Populate campaign details on lead record
Hi All,
I want to update campaign name,primary product on Lead record .
Please find the below code
Public static void After_UpdateLeadCampaignDetails()
{
List<CampaignMember> camlist = (List<CampaignMember>)trigger.new;
System.debug('Values in the camlist:========================>'+camlist);
Set<Id> leadid = new Set<Id>();
List<Lead> leadlist = new List<Lead>();
for(CampaignMember cm:camlist)
{
Lead lea = new Lead();
if(lea.id == cm.LeadId)
{
lea.Campaign_Name__c = cm.Campaign.name;
leadlist.add(lea);
}
}
database.update(leadlist);
}
Please help any one
I want to update campaign name,primary product on Lead record .
Please find the below code
Public static void After_UpdateLeadCampaignDetails()
{
List<CampaignMember> camlist = (List<CampaignMember>)trigger.new;
System.debug('Values in the camlist:========================>'+camlist);
Set<Id> leadid = new Set<Id>();
List<Lead> leadlist = new List<Lead>();
for(CampaignMember cm:camlist)
{
Lead lea = new Lead();
if(lea.id == cm.LeadId)
{
lea.Campaign_Name__c = cm.Campaign.name;
leadlist.add(lea);
}
}
database.update(leadlist);
}
Please help any one
- Naveen Ashok Sirivella
- July 02, 2018
- Like
- 0
- Continue reading or reply
I want help for sales force coding
Hi All,
I have 2 years of exp in salesforce development.Currently i am working on testing project.
I have forget my coding knowlege.
I am again started learning salesforce coding can any one please help me to increase my coding knowledge.
Thanks
Naveen Ashok S
I have 2 years of exp in salesforce development.Currently i am working on testing project.
I have forget my coding knowlege.
I am again started learning salesforce coding can any one please help me to increase my coding knowledge.
Thanks
Naveen Ashok S
- Naveen Ashok Sirivella
- March 23, 2018
- Like
- 0
- Continue reading or reply
How to display pageblock when click on button in visualforce page
Hi All,
I am new to salesforce.
I have on requirment.When i click on "Show All leads" button on that time only records need to display with new page block.
Below are my code:
-----------------------------------
VF page
----------------------
<apex:page standardController="Lead" Extensions="DisplayingListofrecords_Controller">
<apex:form >
<apex:pageBlock title="For buttons">
<apex:commandButton action="{!ShowLeads}" value="Show Leads" reRender="Details"/>
</apex:pageBlock>
</apex:form>
<apex:outputPanel id="Details">
<apex:actionStatus startText="Requesting............">
<apex:pageBlock title="Displaying List of accounts" id="Showlistofleads" rendered="false">
<apex:dataTable value="{!leadlist}" var="a" cellpadding="4" border="1">
<apex:column >
<apex:facet name="header">Name</apex:facet>
{!a.Name}
</apex:column>
<apex:column >
<apex:facet name="header">Company</apex:facet>
{!a.Company}
</apex:column>
<apex:column >
<apex:facet name="header">Status</apex:facet>
{!a.Status}
</apex:column>
<apex:column >
<apex:facet name="header">Industry</apex:facet>
{!a.Industry}
</apex:column>
<apex:column >
<apex:facet name="header">Email</apex:facet>
{!a.Email}
</apex:column>
<apex:column >
<apex:facet name="header">LeadSource</apex:facet>
{!a.LeadSource}
</apex:column>
<apex:column >
<apex:facet name="header">Lead Score</apex:facet>
{!a.Lead_Score__c}
</apex:column>
</apex:dataTable>
</apex:pageBlock>
</apex:actionStatus>
</apex:outputPanel>
</apex:page>
Controller
-------------------
public with sharing class DisplayingListofrecords_Controller {
Public List<Lead> leadlist {get;set;}
public DisplayingListofrecords_Controller(ApexPages.StandardController controller) {
}
public PageReference ShowLeads()
{
leadlist = [select Name,Company,Status,Industry,Email,LeadSource,Lead_Score__c from lead];
return null;
}
}
I am new to salesforce.
I have on requirment.When i click on "Show All leads" button on that time only records need to display with new page block.
Below are my code:
-----------------------------------
VF page
----------------------
<apex:page standardController="Lead" Extensions="DisplayingListofrecords_Controller">
<apex:form >
<apex:pageBlock title="For buttons">
<apex:commandButton action="{!ShowLeads}" value="Show Leads" reRender="Details"/>
</apex:pageBlock>
</apex:form>
<apex:outputPanel id="Details">
<apex:actionStatus startText="Requesting............">
<apex:pageBlock title="Displaying List of accounts" id="Showlistofleads" rendered="false">
<apex:dataTable value="{!leadlist}" var="a" cellpadding="4" border="1">
<apex:column >
<apex:facet name="header">Name</apex:facet>
{!a.Name}
</apex:column>
<apex:column >
<apex:facet name="header">Company</apex:facet>
{!a.Company}
</apex:column>
<apex:column >
<apex:facet name="header">Status</apex:facet>
{!a.Status}
</apex:column>
<apex:column >
<apex:facet name="header">Industry</apex:facet>
{!a.Industry}
</apex:column>
<apex:column >
<apex:facet name="header">Email</apex:facet>
{!a.Email}
</apex:column>
<apex:column >
<apex:facet name="header">LeadSource</apex:facet>
{!a.LeadSource}
</apex:column>
<apex:column >
<apex:facet name="header">Lead Score</apex:facet>
{!a.Lead_Score__c}
</apex:column>
</apex:dataTable>
</apex:pageBlock>
</apex:actionStatus>
</apex:outputPanel>
</apex:page>
Controller
-------------------
public with sharing class DisplayingListofrecords_Controller {
Public List<Lead> leadlist {get;set;}
public DisplayingListofrecords_Controller(ApexPages.StandardController controller) {
}
public PageReference ShowLeads()
{
leadlist = [select Name,Company,Status,Industry,Email,LeadSource,Lead_Score__c from lead];
return null;
}
}
- Naveen Ashok Sirivella
- March 14, 2018
- Like
- 0
- Continue reading or reply