-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
9Questions
-
14Replies
Set Default "Related To" field on activity to custom object
Hi,
I am trying to set the default value of "RelatedTo" field on activity to a custom object. In classic we can simply use URL hacking & custom button to set it. But in lightning i haven't figured out any solution.By default Related To has defaulted to Accounts...Also I know there is an Idea Pending with salesforce, But i was wondering what is current workaround.

So if anyone know ANY way to set "Related TO" field on Activity please let me know. Is visualforce page to replicate the whole Activity section ..the only option?
Thanks for your time:)
I am trying to set the default value of "RelatedTo" field on activity to a custom object. In classic we can simply use URL hacking & custom button to set it. But in lightning i haven't figured out any solution.By default Related To has defaulted to Accounts...Also I know there is an Idea Pending with salesforce, But i was wondering what is current workaround.
So if anyone know ANY way to set "Related TO" field on Activity please let me know. Is visualforce page to replicate the whole Activity section ..the only option?
Thanks for your time:)
-
- Dnyaneshwar
- August 03, 2018
- Like
- 0
- Continue reading or reply
View setup and configuration relation with static resource
Hello Guys,
I have a manages package (avaya cti ) installed with few "PRIVATE" static resources in it. So most of the users are not able to access the application properly.
But interesting thing is users with 'View setup and configuration' permission are able access application correctly. As per my knowledge this permission give view access to setup & configurations ....and nothing else. Is my understanding wrong?
So Is the 'View setup and configuration' permission provides access to private static resources? is it expected behavior?
I have a manages package (avaya cti ) installed with few "PRIVATE" static resources in it. So most of the users are not able to access the application properly.
But interesting thing is users with 'View setup and configuration' permission are able access application correctly. As per my knowledge this permission give view access to setup & configurations ....and nothing else. Is my understanding wrong?
So Is the 'View setup and configuration' permission provides access to private static resources? is it expected behavior?
-
- Dnyaneshwar
- February 24, 2017
- Like
- 0
- Continue reading or reply
Transfer Lead History tracking section from Lead to Account
I was wondering if there is any way i can transfer lead history tracking section data to account record when that lead gets converted to account.
eg. I have lead with lead History section. Now this lead gets converted to account then this new account record should show Lead histroy section.
Any suggestions?
eg. I have lead with lead History section. Now this lead gets converted to account then this new account record should show Lead histroy section.
Any suggestions?
-
- Dnyaneshwar
- February 15, 2017
- Like
- 0
- Continue reading or reply
How can i increase code coverage of my class
Hi,
In my class i have a method: (Bold-Italic lines are not covered)
In my class i have a method: (Bold-Italic lines are not covered)
public PageReference sendBulkSMSToLeads(){ //debug = leadStatus + ':' + intakeMonth + ':' + intakeYear + ':' + message; List<Lead> matchingLeadsList = [Select MobilePhone from Lead where Status =:leadStatus and Intake_Month__c =:intakeMonth and Intake_Year__c =:intakeYear]; Set<String> uniquePhoneNumberList = new Set<String>(); if(matchingLeadsList != null && matchingLeadsList.size() > 0){ String commaSeparatedMobileNumbers = ''; for(Lead lead : matchingLeadsList){ if(lead.MobilePhone != null && lead.MobilePhone != ''){ if(!uniquePhoneNumberList.contains(lead.MobilePhone)){ uniquePhoneNumberList.add(lead.MobilePhone); commaSeparatedMobileNumbers = commaSeparatedMobileNumbers + ',' + lead.MobilePhone; } } } if(commaSeparatedMobileNumbers.length() > 0){ commaSeparatedMobileNumbers = commaSeparatedMobileNumbers.substring(1, commaSeparatedMobileNumbers.length()); } //debug = commaSeparatedMobileNumbers; String payLoad = 'username=global&password=muzztech&mobile=' +commaSeparatedMobileNumbers + '&sendername=SPJAIN&message='+message; Http h = new Http(); HttpRequest req = new HttpRequest(); req.setEndpoint('http://priority.muzztech.in/sms_api/sendsms.php'); req.setMethod('POST'); req.setBody(payLoad); HttpResponse res = h.send(req); ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.INFO,'Bulk SMS initiated for ' + matchingLeadsList.size() + ' leads'); ApexPages.addMessage(myMsg); }else{ ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'No matching leads found to send SMS'); ApexPages.addMessage(myMsg); } return null; }For which i have written this test class method:
@isTest global class SMSControllerTest { global class MockHttpResponseGenerator implements HttpCalloutMock { global HTTPResponse respond(HTTPRequest req) { // Optionally, only send a mock response for a specific endpoint and method. System.assertEquals('http://priority.muzztech.in/sms_api/sendsms.php', req.getEndpoint()); System.assertEquals('POST', req.getMethod()); HttpResponse res = new HttpResponse(); res.setHeader('Content-Type', 'application/json'); res.setBody('{"username":"global","password":"muzztech","mobile":"7854945777","message":"test message"}');//add your fake JSON here res.setStatusCode(200); return res; } } static testMethod void sendBulkSMSToLeadsTest() { Test.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator()); Test.startTest(); SMSController ctrl = new SMSController(); ctrl.leadStatus = 'Hot'; ctrl.intakeMonth = 'January'; ctrl.intakeYear = '2017'; ctrl.sendBulkSMSToLeads(); //Assert the response here Test.stopTest(); } }How can i increase the code coverage of this method? Thanks a ton for suggestions!
-
- Dnyaneshwar
- January 03, 2017
- Like
- 0
- Continue reading or reply
I am getting System.LimitException: Too many SOQL queries: 101 error in trigger
Hi,
I have a trigger to do lots of actions before and after DML's. but in my test class i am getting erro: System.LimitException: Too many SOQL queries: 101. I have followed best practises for test classes such as not using query or DML in for loops but still i am getting this error. Can sombody locate cause of this error.
Code:
trigger LeadTrigger on Lead (before insert, before update, after insert) {
Group queue = [SELECT Id, name FROM Group WHERE type='Queue' and Name='TCC Counsellors' Limit 1];
List<GroupMember> queueMembers = [SELECT Group.Name, UserOrGroupId FROM GroupMember WHERE GroupId =: queue.Id ];
integer val = 0;
List<Lead> Exleads = [SELECT Id, name, email, MobilePhone, Program__c FROM Lead WHERE Id NOT IN : Trigger.new ];
List<Duplicate_Lead__c> DupLeads = new List <Duplicate_Lead__c>();
List<Lead> dupLeadsUpdate = new List<Lead>();
List<Lead> dupLeadsDelete = new List<Lead>();
List<Lead> LeadsToUpdate = new List<Lead>();
Set<Lead> myset = new Set<Lead>();
List<Lead> result = new List<Lead>();
for( Lead ld : Trigger.new ) {
if(Trigger.isBefore && (Trigger.isInsert || Trigger.isUpdate)){
/*Remove Company field value*/
if(ld.Company != null){
ld.Company = null;
}
/*Start - Set Assigned_to_Sales_Team value */
for( Group q : [SELECT Id, name FROM Group WHERE type='Queue' And name != 'TCC Counsellors']){
if(ld.OwnerId == q.Id && ld.Assigned_to_Sales_Team__c == false){
ld.Assigned_to_Sales_Team__c = true;
}
}
/*End*/
/*Start - FetchIntake */
for( Calender__c cal : [SELECT Id, Start_Date__c, End_Date__c, Program__c, Intake_Month__c, Intake_Year__c FROM Calender__c WHERE Start_Date__c <= :System.Today() and End_Date__c >= :System.Today() ]) {
if(Trigger.isInsert && ld.Program__c == cal.Program__c) {
ld.Intake__c = cal.id;
ld.Intake_Month__c = cal.Intake_Month__c;
ld.Intake_Year__c = cal.Intake_Year__c;
//matchLead.add(le);
}
}
/*End*/
/*Start - FetchTccValues*/
for (GroupMember qm :queueMembers ) {
if( ld.ownerid == queue.Id ) {
ld.TCC_Lead_Status__c = ld.Status;
ld.TCC_Lead_Owner__c = qm.Group.Name;
} else if( ld.ownerid == qm.UserOrGroupId ) {
User us = [SELECT Id,name FROM User where id =: qm.UserOrGroupId];
ld.TCC_Lead_Status__c = ld.Status;
ld.TCC_Lead_Owner__c = us.name;
}
}
/*End*/
/*Start - Lead Rating calculation*/
if( ld.Program__c == 'EMBA' ) {
if(ld.Work_Experience__c=='3 + years'){
val=val+1;
}if(ld.Qualification__c!='Undergraduate'){
val=val+1;
}if(ld.Lead_City__c=='Mumbai'){
val=val+1;
}if(ld.LeadSource=='Walk In'||ld.LeadSource=='Incomming Call'||ld.LeadSource=='Chat'){
val=val+1;
}if(ld.Comfortable_with_Fee__c=='Yes'){
val=val+1;
}if(ld.Info_session_Attended__c =='Yes'){
val=val+1;
}if(ld.Interested_in_this_Intake__c=='Yes'){
val=val+1;
}if(ld.Duplicacy__c==true){
val=val+1;
}if(ld.Interested_in_Program_For_Self__c=='Yes'){
val=val+1;
}if(ld.Interested_in_SPJAT__c=='Yes'){
val=val+1;
}
}else if(ld.Program__c == 'Cyber Security' || ld.Program__c == 'Machine Learning' || ld.Program__c == 'Virtual Reality') {
if(ld.Work_Experience__c=='3 + years'){
val=val+1;
}if(ld.Qualification__c!='Undergraduate'&&ld.Qualification__c!='Graduate'&&ld.Qualification__c!='Post Graduate Diploma'&&ld.Qualification__c!='Masters Degree'&&ld.Qualification__c!='Undergraduate or postgraduate degree in Engineering, Mathematics, Physics, Statistics, B.Sc, B.Pharma, BBA, Economics or Commerce'){
val=val+1;
}if(ld.Lead_City__c=='Mumbai'||ld.Lead_City__c=='Bengaluru' ||ld.Lead_City__c=='Pune'||ld.Lead_City__c=='Chennai'||ld.Lead_City__c=='Trivandrum'){
val=val+1;
}if(ld.LeadSource=='Walk In'||ld.LeadSource=='Incomming Call'||ld.LeadSource=='Chat'){
val=val+1;
}if(ld.Comfortable_with_Fee__c=='Yes'){
val=val+1;
}if(ld.Info_session_Attended__c =='Yes'){
val=val+1;
}if(ld.Interested_in_this_Intake__c=='Yes'){
val=val+1;
}if(ld.Duplicacy__c==true){
val=val+1;
}if(ld.Interested_in_Program_For_Self__c=='Yes'){
val=val+1;
}if(ld.Interested_in_SPJAT__c=='Yes'){
val=val+1;
}
}
system.debug('Value of value variable:' + val);
if( ld.Program__c == 'EMBA' ) {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}else if(ld.Program__c == 'DMM'&& ld.Program_Type__c=='PT') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}else if(ld.Program__c == 'DMM'&& ld.Program_Type__c=='FT') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/9;
}else if(ld.Program__c == 'BDAP'&& ld.Program_Type__c=='PT') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}else if(ld.Program__c == 'BDAP'&& ld.Program_Type__c=='FT') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/9;
}else if(ld.Program__c == 'MGB') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}else if(ld.Program__c == 'GMBA') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}else if(ld.Program__c == 'GFMB') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/9;
}else if(ld.Program__c == 'MgLuxM') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/9;
}else if(ld.Program__c == 'Cyber Security' || ld.Program__c == 'Machine Learning' || ld.Program__c == 'Virtual Reality') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/11;
}else if(ld.Program__c == 'BBA'|| ld.Program__c == 'BBC' || ld.Program__c == 'BEC') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}
/*End*/
/*Start Lead status update to Not Contacted when Lead goes from TCC to RM*/
if( Trigger.isBefore && Trigger.isUpdate ){
Lead OldLead = Trigger.oldMap.get(ld.Id);
for (GroupMember qm :queueMembers ) {
if( (OldLead.Ownerid == qm.UserOrGroupId) && ld.ownerid != queue.Id && string.valueOf(ld.OwnerId).startsWith('00G') ) {
ld.Status = 'Not Contacted';
}
}
}
/*End*/
/*Start - Updating custom fields for mapping with account*/
if(ld.Status != null){
ld.Hidden_Lead_Status__c = ld.Status;
}
if(ld.LeadSource != null){
ld.Hidden_Lead_Source__c = ld.LeadSource;
}
if(true){
ld.Hidden_Do_Not_Call__c = ld.DoNotCall;
ld.Hidden_Partial_Application__c = ld.Partial_Application__c;
}
/*End*/
} // End of Before trigger
/*Start - After trigger for Lead Duplication*/
if(trigger.isAfter && trigger.isInsert){
for(Lead Ele : Exleads){
if(( (ld.email != null && ld.email == Ele.email) && (ld.Program__c != null && ld.Program__c==Ele.Program__c) ) || ( (ld.MobilePhone != null && ld.MobilePhone == ELe.MobilePhone) && (ld.Program__c != null && ld.Program__c==Ele.Program__c) )){
Duplicate_Lead__c DPLead = new Duplicate_Lead__c();
DPLead.Name = 'Duplicate Of'+' '+ Ele.Name;
DPLead.Lead_Name__c = ld.FirstName+ ' '+ld.LastName ;
DPLead.Email__c = ld.Email;
DPLead.Mobile__c = ld.MobilePhone;
DPLead.Lead_Status__c = ld.Status;
DPLead.Lead_Source__c = ld.LeadSource;
DPLead.Work_Experience__c = ld.Work_Experience__c;
DPLead.program__c = ld.Program__c;
DPLead.Lead_City__c = ld.Lead_City__c;
DPLead.Lead_State__c = ld.Lead_State__c;
DPLead.Lead_Country__c = ld.Lead_Country__c;
Ele.Duplicacy__c = true;
LeadsToUpdate.add(Ele);
DupLeads.add(DPLead);
Lead leadDel = new Lead(Id=ld.Id);
dupLeadsDelete.add(leadDel);
}
}
}
/*End*/
}
if(!LeadsToUpdate.isEmpty()){
myset.addAll(LeadsToUpdate);
result.addAll(myset);
update result;
}
if(!dupLeadsUpdate.isEmpty()){
update dupLeadsUpdate;
}
if(!DupLeads.isEmpty()){
Insert DupLeads;
}
if(!dupLeadsDelete.isEmpty()){
Delete dupLeadsDelete;
}
}
Thanks in advance!
I have a trigger to do lots of actions before and after DML's. but in my test class i am getting erro: System.LimitException: Too many SOQL queries: 101. I have followed best practises for test classes such as not using query or DML in for loops but still i am getting this error. Can sombody locate cause of this error.
Code:
trigger LeadTrigger on Lead (before insert, before update, after insert) {
Group queue = [SELECT Id, name FROM Group WHERE type='Queue' and Name='TCC Counsellors' Limit 1];
List<GroupMember> queueMembers = [SELECT Group.Name, UserOrGroupId FROM GroupMember WHERE GroupId =: queue.Id ];
integer val = 0;
List<Lead> Exleads = [SELECT Id, name, email, MobilePhone, Program__c FROM Lead WHERE Id NOT IN : Trigger.new ];
List<Duplicate_Lead__c> DupLeads = new List <Duplicate_Lead__c>();
List<Lead> dupLeadsUpdate = new List<Lead>();
List<Lead> dupLeadsDelete = new List<Lead>();
List<Lead> LeadsToUpdate = new List<Lead>();
Set<Lead> myset = new Set<Lead>();
List<Lead> result = new List<Lead>();
for( Lead ld : Trigger.new ) {
if(Trigger.isBefore && (Trigger.isInsert || Trigger.isUpdate)){
/*Remove Company field value*/
if(ld.Company != null){
ld.Company = null;
}
/*Start - Set Assigned_to_Sales_Team value */
for( Group q : [SELECT Id, name FROM Group WHERE type='Queue' And name != 'TCC Counsellors']){
if(ld.OwnerId == q.Id && ld.Assigned_to_Sales_Team__c == false){
ld.Assigned_to_Sales_Team__c = true;
}
}
/*End*/
/*Start - FetchIntake */
for( Calender__c cal : [SELECT Id, Start_Date__c, End_Date__c, Program__c, Intake_Month__c, Intake_Year__c FROM Calender__c WHERE Start_Date__c <= :System.Today() and End_Date__c >= :System.Today() ]) {
if(Trigger.isInsert && ld.Program__c == cal.Program__c) {
ld.Intake__c = cal.id;
ld.Intake_Month__c = cal.Intake_Month__c;
ld.Intake_Year__c = cal.Intake_Year__c;
//matchLead.add(le);
}
}
/*End*/
/*Start - FetchTccValues*/
for (GroupMember qm :queueMembers ) {
if( ld.ownerid == queue.Id ) {
ld.TCC_Lead_Status__c = ld.Status;
ld.TCC_Lead_Owner__c = qm.Group.Name;
} else if( ld.ownerid == qm.UserOrGroupId ) {
User us = [SELECT Id,name FROM User where id =: qm.UserOrGroupId];
ld.TCC_Lead_Status__c = ld.Status;
ld.TCC_Lead_Owner__c = us.name;
}
}
/*End*/
/*Start - Lead Rating calculation*/
if( ld.Program__c == 'EMBA' ) {
if(ld.Work_Experience__c=='3 + years'){
val=val+1;
}if(ld.Qualification__c!='Undergraduate'){
val=val+1;
}if(ld.Lead_City__c=='Mumbai'){
val=val+1;
}if(ld.LeadSource=='Walk In'||ld.LeadSource=='Incomming Call'||ld.LeadSource=='Chat'){
val=val+1;
}if(ld.Comfortable_with_Fee__c=='Yes'){
val=val+1;
}if(ld.Info_session_Attended__c =='Yes'){
val=val+1;
}if(ld.Interested_in_this_Intake__c=='Yes'){
val=val+1;
}if(ld.Duplicacy__c==true){
val=val+1;
}if(ld.Interested_in_Program_For_Self__c=='Yes'){
val=val+1;
}if(ld.Interested_in_SPJAT__c=='Yes'){
val=val+1;
}
}else if(ld.Program__c == 'Cyber Security' || ld.Program__c == 'Machine Learning' || ld.Program__c == 'Virtual Reality') {
if(ld.Work_Experience__c=='3 + years'){
val=val+1;
}if(ld.Qualification__c!='Undergraduate'&&ld.Qualification__c!='Graduate'&&ld.Qualification__c!='Post Graduate Diploma'&&ld.Qualification__c!='Masters Degree'&&ld.Qualification__c!='Undergraduate or postgraduate degree in Engineering, Mathematics, Physics, Statistics, B.Sc, B.Pharma, BBA, Economics or Commerce'){
val=val+1;
}if(ld.Lead_City__c=='Mumbai'||ld.Lead_City__c=='Bengaluru' ||ld.Lead_City__c=='Pune'||ld.Lead_City__c=='Chennai'||ld.Lead_City__c=='Trivandrum'){
val=val+1;
}if(ld.LeadSource=='Walk In'||ld.LeadSource=='Incomming Call'||ld.LeadSource=='Chat'){
val=val+1;
}if(ld.Comfortable_with_Fee__c=='Yes'){
val=val+1;
}if(ld.Info_session_Attended__c =='Yes'){
val=val+1;
}if(ld.Interested_in_this_Intake__c=='Yes'){
val=val+1;
}if(ld.Duplicacy__c==true){
val=val+1;
}if(ld.Interested_in_Program_For_Self__c=='Yes'){
val=val+1;
}if(ld.Interested_in_SPJAT__c=='Yes'){
val=val+1;
}
}
system.debug('Value of value variable:' + val);
if( ld.Program__c == 'EMBA' ) {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}else if(ld.Program__c == 'DMM'&& ld.Program_Type__c=='PT') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}else if(ld.Program__c == 'DMM'&& ld.Program_Type__c=='FT') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/9;
}else if(ld.Program__c == 'BDAP'&& ld.Program_Type__c=='PT') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}else if(ld.Program__c == 'BDAP'&& ld.Program_Type__c=='FT') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/9;
}else if(ld.Program__c == 'MGB') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}else if(ld.Program__c == 'GMBA') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}else if(ld.Program__c == 'GFMB') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/9;
}else if(ld.Program__c == 'MgLuxM') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/9;
}else if(ld.Program__c == 'Cyber Security' || ld.Program__c == 'Machine Learning' || ld.Program__c == 'Virtual Reality') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/11;
}else if(ld.Program__c == 'BBA'|| ld.Program__c == 'BBC' || ld.Program__c == 'BEC') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}
/*End*/
/*Start Lead status update to Not Contacted when Lead goes from TCC to RM*/
if( Trigger.isBefore && Trigger.isUpdate ){
Lead OldLead = Trigger.oldMap.get(ld.Id);
for (GroupMember qm :queueMembers ) {
if( (OldLead.Ownerid == qm.UserOrGroupId) && ld.ownerid != queue.Id && string.valueOf(ld.OwnerId).startsWith('00G') ) {
ld.Status = 'Not Contacted';
}
}
}
/*End*/
/*Start - Updating custom fields for mapping with account*/
if(ld.Status != null){
ld.Hidden_Lead_Status__c = ld.Status;
}
if(ld.LeadSource != null){
ld.Hidden_Lead_Source__c = ld.LeadSource;
}
if(true){
ld.Hidden_Do_Not_Call__c = ld.DoNotCall;
ld.Hidden_Partial_Application__c = ld.Partial_Application__c;
}
/*End*/
} // End of Before trigger
/*Start - After trigger for Lead Duplication*/
if(trigger.isAfter && trigger.isInsert){
for(Lead Ele : Exleads){
if(( (ld.email != null && ld.email == Ele.email) && (ld.Program__c != null && ld.Program__c==Ele.Program__c) ) || ( (ld.MobilePhone != null && ld.MobilePhone == ELe.MobilePhone) && (ld.Program__c != null && ld.Program__c==Ele.Program__c) )){
Duplicate_Lead__c DPLead = new Duplicate_Lead__c();
DPLead.Name = 'Duplicate Of'+' '+ Ele.Name;
DPLead.Lead_Name__c = ld.FirstName+ ' '+ld.LastName ;
DPLead.Email__c = ld.Email;
DPLead.Mobile__c = ld.MobilePhone;
DPLead.Lead_Status__c = ld.Status;
DPLead.Lead_Source__c = ld.LeadSource;
DPLead.Work_Experience__c = ld.Work_Experience__c;
DPLead.program__c = ld.Program__c;
DPLead.Lead_City__c = ld.Lead_City__c;
DPLead.Lead_State__c = ld.Lead_State__c;
DPLead.Lead_Country__c = ld.Lead_Country__c;
Ele.Duplicacy__c = true;
LeadsToUpdate.add(Ele);
DupLeads.add(DPLead);
Lead leadDel = new Lead(Id=ld.Id);
dupLeadsDelete.add(leadDel);
}
}
}
/*End*/
}
if(!LeadsToUpdate.isEmpty()){
myset.addAll(LeadsToUpdate);
result.addAll(myset);
update result;
}
if(!dupLeadsUpdate.isEmpty()){
update dupLeadsUpdate;
}
if(!DupLeads.isEmpty()){
Insert DupLeads;
}
if(!dupLeadsDelete.isEmpty()){
Delete dupLeadsDelete;
}
}
Thanks in advance!
-
- Dnyaneshwar
- January 02, 2017
- Like
- 0
- Continue reading or reply
lead sharing rule not working
Hello All,
Here is my scenario: I have a queue (West-1-MGB) with 2 members in it. both of these users have same role (Regional Manager West 1 - MGB) .
I have a sharing rule in place which shares a record owned by member of (West-1-MGB) queue with users of role Regional Manager West 1 - MGB.

----------

But still one member of this queue can not see record owned by other memeber of this queue. Also i have recalculated the sharing rules...still doesn't work. Any suggestions why it's not working.?
Here is my scenario: I have a queue (West-1-MGB) with 2 members in it. both of these users have same role (Regional Manager West 1 - MGB) .
I have a sharing rule in place which shares a record owned by member of (West-1-MGB) queue with users of role Regional Manager West 1 - MGB.
----------
But still one member of this queue can not see record owned by other memeber of this queue. Also i have recalculated the sharing rules...still doesn't work. Any suggestions why it's not working.?
-
- Dnyaneshwar
- December 17, 2016
- Like
- 0
- Continue reading or reply
custom button not passing values
Hello Everybody,
I have a custom object Raw_Lead__c with 3 custom fields namely: First_Name__c, Last_Name__c and Email__c . I have created a custom button on Raw_Lead object with URL:
/00Q/e?retURL=/{!Lead.Id}&{!Lead.FirstName}={!Raw_Lead__c.First_Name__c} & {!Lead.LastName}={!Raw_Lead__c.Last_Name__c}&{!Lead.Email}={!Raw_Lead__c.Email__c}&cancelURL=/{!Raw_Lead__c.Id}
I am trying to pass these 3 custom fields into lead fields.But when i click on the button of any Raw_Lead obj record it redirect me to Create page of Lead with all 3 lead values blank.
that times URL is :https://cs31.salesforce.com/00Q/e?retURL=/&=Ramesh%20&=rameshkend%40gmail.com&%20=Kendre&cancelURL=/a09p0000003jP5B


Can anyOne have any clue what am i doning wrong!
I have a custom object Raw_Lead__c with 3 custom fields namely: First_Name__c, Last_Name__c and Email__c . I have created a custom button on Raw_Lead object with URL:
/00Q/e?retURL=/{!Lead.Id}&{!Lead.FirstName}={!Raw_Lead__c.First_Name__c} & {!Lead.LastName}={!Raw_Lead__c.Last_Name__c}&{!Lead.Email}={!Raw_Lead__c.Email__c}&cancelURL=/{!Raw_Lead__c.Id}
I am trying to pass these 3 custom fields into lead fields.But when i click on the button of any Raw_Lead obj record it redirect me to Create page of Lead with all 3 lead values blank.
that times URL is :https://cs31.salesforce.com/00Q/e?retURL=/&=Ramesh%20&=rameshkend%40gmail.com&%20=Kendre&cancelURL=/a09p0000003jP5B
Can anyOne have any clue what am i doning wrong!
-
- Dnyaneshwar
- December 15, 2016
- Like
- 0
- Continue reading or reply
lead record summary in visualforce page
Hi,
I was trying to get the number of Lead records with XYZ picklist values equals particular values i.e. a table with
coloumn 1 coloumn 2
row1 : ABC ABC (i.e. count of lead records where field XYZ = A or B or C)
row2 : ACD ACD (i.e. count of lead records where field XYZ = A or C or D)
row3 : BCD BCD (i.e. count of lead records where field XYZ = B or C or D)
I tried to acheive this using bucketing in report but couldn't because of salesforce some limitations on bucket fields. So i am trying to create a vf page table. Any suggestions?
Thanks a Ton! for any help.
I was trying to get the number of Lead records with XYZ picklist values equals particular values i.e. a table with
coloumn 1 coloumn 2
row1 : ABC ABC (i.e. count of lead records where field XYZ = A or B or C)
row2 : ACD ACD (i.e. count of lead records where field XYZ = A or C or D)
row3 : BCD BCD (i.e. count of lead records where field XYZ = B or C or D)
I tried to acheive this using bucketing in report but couldn't because of salesforce some limitations on bucket fields. So i am trying to create a vf page table. Any suggestions?
Thanks a Ton! for any help.
-
- Dnyaneshwar
- December 13, 2016
- Like
- 0
- Continue reading or reply
Handle lead duplication in after trigger
Hi All,
I am trying to check if Lead to insert is duplicate and if it is then store it in separate custom object(Duplicate_Lead__c). but in query it is returning the record i am inserting i.e. for every lead i insert this trigger is matching its fields with itself and creating duplicate record in custom object.
How to avoid this? Also i want to update a checkbox on duplicate Lead record, is it possible in same after trigger?
trigger LeadDuplicateTrigger on Lead(after insert) {
List Exleads = [Select id, name, email, MobilePhone, Program__c From Lead];
List DupLeads = new List ();
for(Lead l : Trigger.new){
for(Lead Ele : Exleads){
if(( (l.email == Ele.email) && (l.Program__c==Ele.Program__c) ) || ( (l.MobilePhone == ELe.MobilePhone) && (l.Program__c==Ele.Program__c) )){
Duplicate_Lead__c DPLead = new Duplicate_Lead__c();
DPLead.Name = ‘Duplicate Of’+’ ‘+ Ele.Name;
DPLead.Admission_Stage__c = l.Admission_Stage__c;
DPLead.Admission_Status__c = l.Admission_Status__c;
DPLead.Agency__c = l.Agency__c;
DPLead.Initial_Owner__c = l.Initial_Owner__c;
DPLead.Initial_program__c = l.Initial_program__c;
DPLead.Program__c = l.Program__c;
DPLead.Lead_State__c = l.Lead_State__c;
DPLead.Test_Score__c = l.Test_Score__c;
DupLeads.add(DPLead);
}
}
}
Insert DupLeads;
I am trying to check if Lead to insert is duplicate and if it is then store it in separate custom object(Duplicate_Lead__c). but in query it is returning the record i am inserting i.e. for every lead i insert this trigger is matching its fields with itself and creating duplicate record in custom object.
How to avoid this? Also i want to update a checkbox on duplicate Lead record, is it possible in same after trigger?
trigger LeadDuplicateTrigger on Lead(after insert) {
List Exleads = [Select id, name, email, MobilePhone, Program__c From Lead];
List DupLeads = new List ();
for(Lead l : Trigger.new){
for(Lead Ele : Exleads){
if(( (l.email == Ele.email) && (l.Program__c==Ele.Program__c) ) || ( (l.MobilePhone == ELe.MobilePhone) && (l.Program__c==Ele.Program__c) )){
Duplicate_Lead__c DPLead = new Duplicate_Lead__c();
DPLead.Name = ‘Duplicate Of’+’ ‘+ Ele.Name;
DPLead.Admission_Stage__c = l.Admission_Stage__c;
DPLead.Admission_Status__c = l.Admission_Status__c;
DPLead.Agency__c = l.Agency__c;
DPLead.Initial_Owner__c = l.Initial_Owner__c;
DPLead.Initial_program__c = l.Initial_program__c;
DPLead.Program__c = l.Program__c;
DPLead.Lead_State__c = l.Lead_State__c;
DPLead.Test_Score__c = l.Test_Score__c;
DupLeads.add(DPLead);
}
}
}
Insert DupLeads;
-
- Dnyaneshwar
- December 05, 2016
- Like
- 0
- Continue reading or reply
Set Default "Related To" field on activity to custom object
Hi,
I am trying to set the default value of "RelatedTo" field on activity to a custom object. In classic we can simply use URL hacking & custom button to set it. But in lightning i haven't figured out any solution.By default Related To has defaulted to Accounts...Also I know there is an Idea Pending with salesforce, But i was wondering what is current workaround.

So if anyone know ANY way to set "Related TO" field on Activity please let me know. Is visualforce page to replicate the whole Activity section ..the only option?
Thanks for your time:)
I am trying to set the default value of "RelatedTo" field on activity to a custom object. In classic we can simply use URL hacking & custom button to set it. But in lightning i haven't figured out any solution.By default Related To has defaulted to Accounts...Also I know there is an Idea Pending with salesforce, But i was wondering what is current workaround.
So if anyone know ANY way to set "Related TO" field on Activity please let me know. Is visualforce page to replicate the whole Activity section ..the only option?
Thanks for your time:)
- Dnyaneshwar
- August 03, 2018
- Like
- 0
- Continue reading or reply
How can i increase code coverage of my class
Hi,
In my class i have a method: (Bold-Italic lines are not covered)
In my class i have a method: (Bold-Italic lines are not covered)
public PageReference sendBulkSMSToLeads(){ //debug = leadStatus + ':' + intakeMonth + ':' + intakeYear + ':' + message; List<Lead> matchingLeadsList = [Select MobilePhone from Lead where Status =:leadStatus and Intake_Month__c =:intakeMonth and Intake_Year__c =:intakeYear]; Set<String> uniquePhoneNumberList = new Set<String>(); if(matchingLeadsList != null && matchingLeadsList.size() > 0){ String commaSeparatedMobileNumbers = ''; for(Lead lead : matchingLeadsList){ if(lead.MobilePhone != null && lead.MobilePhone != ''){ if(!uniquePhoneNumberList.contains(lead.MobilePhone)){ uniquePhoneNumberList.add(lead.MobilePhone); commaSeparatedMobileNumbers = commaSeparatedMobileNumbers + ',' + lead.MobilePhone; } } } if(commaSeparatedMobileNumbers.length() > 0){ commaSeparatedMobileNumbers = commaSeparatedMobileNumbers.substring(1, commaSeparatedMobileNumbers.length()); } //debug = commaSeparatedMobileNumbers; String payLoad = 'username=global&password=muzztech&mobile=' +commaSeparatedMobileNumbers + '&sendername=SPJAIN&message='+message; Http h = new Http(); HttpRequest req = new HttpRequest(); req.setEndpoint('http://priority.muzztech.in/sms_api/sendsms.php'); req.setMethod('POST'); req.setBody(payLoad); HttpResponse res = h.send(req); ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.INFO,'Bulk SMS initiated for ' + matchingLeadsList.size() + ' leads'); ApexPages.addMessage(myMsg); }else{ ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.ERROR,'No matching leads found to send SMS'); ApexPages.addMessage(myMsg); } return null; }For which i have written this test class method:
@isTest global class SMSControllerTest { global class MockHttpResponseGenerator implements HttpCalloutMock { global HTTPResponse respond(HTTPRequest req) { // Optionally, only send a mock response for a specific endpoint and method. System.assertEquals('http://priority.muzztech.in/sms_api/sendsms.php', req.getEndpoint()); System.assertEquals('POST', req.getMethod()); HttpResponse res = new HttpResponse(); res.setHeader('Content-Type', 'application/json'); res.setBody('{"username":"global","password":"muzztech","mobile":"7854945777","message":"test message"}');//add your fake JSON here res.setStatusCode(200); return res; } } static testMethod void sendBulkSMSToLeadsTest() { Test.setMock(HttpCalloutMock.class, new MockHttpResponseGenerator()); Test.startTest(); SMSController ctrl = new SMSController(); ctrl.leadStatus = 'Hot'; ctrl.intakeMonth = 'January'; ctrl.intakeYear = '2017'; ctrl.sendBulkSMSToLeads(); //Assert the response here Test.stopTest(); } }How can i increase the code coverage of this method? Thanks a ton for suggestions!
- Dnyaneshwar
- January 03, 2017
- Like
- 0
- Continue reading or reply
I am getting System.LimitException: Too many SOQL queries: 101 error in trigger
Hi,
I have a trigger to do lots of actions before and after DML's. but in my test class i am getting erro: System.LimitException: Too many SOQL queries: 101. I have followed best practises for test classes such as not using query or DML in for loops but still i am getting this error. Can sombody locate cause of this error.
Code:
trigger LeadTrigger on Lead (before insert, before update, after insert) {
Group queue = [SELECT Id, name FROM Group WHERE type='Queue' and Name='TCC Counsellors' Limit 1];
List<GroupMember> queueMembers = [SELECT Group.Name, UserOrGroupId FROM GroupMember WHERE GroupId =: queue.Id ];
integer val = 0;
List<Lead> Exleads = [SELECT Id, name, email, MobilePhone, Program__c FROM Lead WHERE Id NOT IN : Trigger.new ];
List<Duplicate_Lead__c> DupLeads = new List <Duplicate_Lead__c>();
List<Lead> dupLeadsUpdate = new List<Lead>();
List<Lead> dupLeadsDelete = new List<Lead>();
List<Lead> LeadsToUpdate = new List<Lead>();
Set<Lead> myset = new Set<Lead>();
List<Lead> result = new List<Lead>();
for( Lead ld : Trigger.new ) {
if(Trigger.isBefore && (Trigger.isInsert || Trigger.isUpdate)){
/*Remove Company field value*/
if(ld.Company != null){
ld.Company = null;
}
/*Start - Set Assigned_to_Sales_Team value */
for( Group q : [SELECT Id, name FROM Group WHERE type='Queue' And name != 'TCC Counsellors']){
if(ld.OwnerId == q.Id && ld.Assigned_to_Sales_Team__c == false){
ld.Assigned_to_Sales_Team__c = true;
}
}
/*End*/
/*Start - FetchIntake */
for( Calender__c cal : [SELECT Id, Start_Date__c, End_Date__c, Program__c, Intake_Month__c, Intake_Year__c FROM Calender__c WHERE Start_Date__c <= :System.Today() and End_Date__c >= :System.Today() ]) {
if(Trigger.isInsert && ld.Program__c == cal.Program__c) {
ld.Intake__c = cal.id;
ld.Intake_Month__c = cal.Intake_Month__c;
ld.Intake_Year__c = cal.Intake_Year__c;
//matchLead.add(le);
}
}
/*End*/
/*Start - FetchTccValues*/
for (GroupMember qm :queueMembers ) {
if( ld.ownerid == queue.Id ) {
ld.TCC_Lead_Status__c = ld.Status;
ld.TCC_Lead_Owner__c = qm.Group.Name;
} else if( ld.ownerid == qm.UserOrGroupId ) {
User us = [SELECT Id,name FROM User where id =: qm.UserOrGroupId];
ld.TCC_Lead_Status__c = ld.Status;
ld.TCC_Lead_Owner__c = us.name;
}
}
/*End*/
/*Start - Lead Rating calculation*/
if( ld.Program__c == 'EMBA' ) {
if(ld.Work_Experience__c=='3 + years'){
val=val+1;
}if(ld.Qualification__c!='Undergraduate'){
val=val+1;
}if(ld.Lead_City__c=='Mumbai'){
val=val+1;
}if(ld.LeadSource=='Walk In'||ld.LeadSource=='Incomming Call'||ld.LeadSource=='Chat'){
val=val+1;
}if(ld.Comfortable_with_Fee__c=='Yes'){
val=val+1;
}if(ld.Info_session_Attended__c =='Yes'){
val=val+1;
}if(ld.Interested_in_this_Intake__c=='Yes'){
val=val+1;
}if(ld.Duplicacy__c==true){
val=val+1;
}if(ld.Interested_in_Program_For_Self__c=='Yes'){
val=val+1;
}if(ld.Interested_in_SPJAT__c=='Yes'){
val=val+1;
}
}else if(ld.Program__c == 'Cyber Security' || ld.Program__c == 'Machine Learning' || ld.Program__c == 'Virtual Reality') {
if(ld.Work_Experience__c=='3 + years'){
val=val+1;
}if(ld.Qualification__c!='Undergraduate'&&ld.Qualification__c!='Graduate'&&ld.Qualification__c!='Post Graduate Diploma'&&ld.Qualification__c!='Masters Degree'&&ld.Qualification__c!='Undergraduate or postgraduate degree in Engineering, Mathematics, Physics, Statistics, B.Sc, B.Pharma, BBA, Economics or Commerce'){
val=val+1;
}if(ld.Lead_City__c=='Mumbai'||ld.Lead_City__c=='Bengaluru' ||ld.Lead_City__c=='Pune'||ld.Lead_City__c=='Chennai'||ld.Lead_City__c=='Trivandrum'){
val=val+1;
}if(ld.LeadSource=='Walk In'||ld.LeadSource=='Incomming Call'||ld.LeadSource=='Chat'){
val=val+1;
}if(ld.Comfortable_with_Fee__c=='Yes'){
val=val+1;
}if(ld.Info_session_Attended__c =='Yes'){
val=val+1;
}if(ld.Interested_in_this_Intake__c=='Yes'){
val=val+1;
}if(ld.Duplicacy__c==true){
val=val+1;
}if(ld.Interested_in_Program_For_Self__c=='Yes'){
val=val+1;
}if(ld.Interested_in_SPJAT__c=='Yes'){
val=val+1;
}
}
system.debug('Value of value variable:' + val);
if( ld.Program__c == 'EMBA' ) {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}else if(ld.Program__c == 'DMM'&& ld.Program_Type__c=='PT') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}else if(ld.Program__c == 'DMM'&& ld.Program_Type__c=='FT') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/9;
}else if(ld.Program__c == 'BDAP'&& ld.Program_Type__c=='PT') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}else if(ld.Program__c == 'BDAP'&& ld.Program_Type__c=='FT') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/9;
}else if(ld.Program__c == 'MGB') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}else if(ld.Program__c == 'GMBA') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}else if(ld.Program__c == 'GFMB') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/9;
}else if(ld.Program__c == 'MgLuxM') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/9;
}else if(ld.Program__c == 'Cyber Security' || ld.Program__c == 'Machine Learning' || ld.Program__c == 'Virtual Reality') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/11;
}else if(ld.Program__c == 'BBA'|| ld.Program__c == 'BBC' || ld.Program__c == 'BEC') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}
/*End*/
/*Start Lead status update to Not Contacted when Lead goes from TCC to RM*/
if( Trigger.isBefore && Trigger.isUpdate ){
Lead OldLead = Trigger.oldMap.get(ld.Id);
for (GroupMember qm :queueMembers ) {
if( (OldLead.Ownerid == qm.UserOrGroupId) && ld.ownerid != queue.Id && string.valueOf(ld.OwnerId).startsWith('00G') ) {
ld.Status = 'Not Contacted';
}
}
}
/*End*/
/*Start - Updating custom fields for mapping with account*/
if(ld.Status != null){
ld.Hidden_Lead_Status__c = ld.Status;
}
if(ld.LeadSource != null){
ld.Hidden_Lead_Source__c = ld.LeadSource;
}
if(true){
ld.Hidden_Do_Not_Call__c = ld.DoNotCall;
ld.Hidden_Partial_Application__c = ld.Partial_Application__c;
}
/*End*/
} // End of Before trigger
/*Start - After trigger for Lead Duplication*/
if(trigger.isAfter && trigger.isInsert){
for(Lead Ele : Exleads){
if(( (ld.email != null && ld.email == Ele.email) && (ld.Program__c != null && ld.Program__c==Ele.Program__c) ) || ( (ld.MobilePhone != null && ld.MobilePhone == ELe.MobilePhone) && (ld.Program__c != null && ld.Program__c==Ele.Program__c) )){
Duplicate_Lead__c DPLead = new Duplicate_Lead__c();
DPLead.Name = 'Duplicate Of'+' '+ Ele.Name;
DPLead.Lead_Name__c = ld.FirstName+ ' '+ld.LastName ;
DPLead.Email__c = ld.Email;
DPLead.Mobile__c = ld.MobilePhone;
DPLead.Lead_Status__c = ld.Status;
DPLead.Lead_Source__c = ld.LeadSource;
DPLead.Work_Experience__c = ld.Work_Experience__c;
DPLead.program__c = ld.Program__c;
DPLead.Lead_City__c = ld.Lead_City__c;
DPLead.Lead_State__c = ld.Lead_State__c;
DPLead.Lead_Country__c = ld.Lead_Country__c;
Ele.Duplicacy__c = true;
LeadsToUpdate.add(Ele);
DupLeads.add(DPLead);
Lead leadDel = new Lead(Id=ld.Id);
dupLeadsDelete.add(leadDel);
}
}
}
/*End*/
}
if(!LeadsToUpdate.isEmpty()){
myset.addAll(LeadsToUpdate);
result.addAll(myset);
update result;
}
if(!dupLeadsUpdate.isEmpty()){
update dupLeadsUpdate;
}
if(!DupLeads.isEmpty()){
Insert DupLeads;
}
if(!dupLeadsDelete.isEmpty()){
Delete dupLeadsDelete;
}
}
Thanks in advance!
I have a trigger to do lots of actions before and after DML's. but in my test class i am getting erro: System.LimitException: Too many SOQL queries: 101. I have followed best practises for test classes such as not using query or DML in for loops but still i am getting this error. Can sombody locate cause of this error.
Code:
trigger LeadTrigger on Lead (before insert, before update, after insert) {
Group queue = [SELECT Id, name FROM Group WHERE type='Queue' and Name='TCC Counsellors' Limit 1];
List<GroupMember> queueMembers = [SELECT Group.Name, UserOrGroupId FROM GroupMember WHERE GroupId =: queue.Id ];
integer val = 0;
List<Lead> Exleads = [SELECT Id, name, email, MobilePhone, Program__c FROM Lead WHERE Id NOT IN : Trigger.new ];
List<Duplicate_Lead__c> DupLeads = new List <Duplicate_Lead__c>();
List<Lead> dupLeadsUpdate = new List<Lead>();
List<Lead> dupLeadsDelete = new List<Lead>();
List<Lead> LeadsToUpdate = new List<Lead>();
Set<Lead> myset = new Set<Lead>();
List<Lead> result = new List<Lead>();
for( Lead ld : Trigger.new ) {
if(Trigger.isBefore && (Trigger.isInsert || Trigger.isUpdate)){
/*Remove Company field value*/
if(ld.Company != null){
ld.Company = null;
}
/*Start - Set Assigned_to_Sales_Team value */
for( Group q : [SELECT Id, name FROM Group WHERE type='Queue' And name != 'TCC Counsellors']){
if(ld.OwnerId == q.Id && ld.Assigned_to_Sales_Team__c == false){
ld.Assigned_to_Sales_Team__c = true;
}
}
/*End*/
/*Start - FetchIntake */
for( Calender__c cal : [SELECT Id, Start_Date__c, End_Date__c, Program__c, Intake_Month__c, Intake_Year__c FROM Calender__c WHERE Start_Date__c <= :System.Today() and End_Date__c >= :System.Today() ]) {
if(Trigger.isInsert && ld.Program__c == cal.Program__c) {
ld.Intake__c = cal.id;
ld.Intake_Month__c = cal.Intake_Month__c;
ld.Intake_Year__c = cal.Intake_Year__c;
//matchLead.add(le);
}
}
/*End*/
/*Start - FetchTccValues*/
for (GroupMember qm :queueMembers ) {
if( ld.ownerid == queue.Id ) {
ld.TCC_Lead_Status__c = ld.Status;
ld.TCC_Lead_Owner__c = qm.Group.Name;
} else if( ld.ownerid == qm.UserOrGroupId ) {
User us = [SELECT Id,name FROM User where id =: qm.UserOrGroupId];
ld.TCC_Lead_Status__c = ld.Status;
ld.TCC_Lead_Owner__c = us.name;
}
}
/*End*/
/*Start - Lead Rating calculation*/
if( ld.Program__c == 'EMBA' ) {
if(ld.Work_Experience__c=='3 + years'){
val=val+1;
}if(ld.Qualification__c!='Undergraduate'){
val=val+1;
}if(ld.Lead_City__c=='Mumbai'){
val=val+1;
}if(ld.LeadSource=='Walk In'||ld.LeadSource=='Incomming Call'||ld.LeadSource=='Chat'){
val=val+1;
}if(ld.Comfortable_with_Fee__c=='Yes'){
val=val+1;
}if(ld.Info_session_Attended__c =='Yes'){
val=val+1;
}if(ld.Interested_in_this_Intake__c=='Yes'){
val=val+1;
}if(ld.Duplicacy__c==true){
val=val+1;
}if(ld.Interested_in_Program_For_Self__c=='Yes'){
val=val+1;
}if(ld.Interested_in_SPJAT__c=='Yes'){
val=val+1;
}
}else if(ld.Program__c == 'Cyber Security' || ld.Program__c == 'Machine Learning' || ld.Program__c == 'Virtual Reality') {
if(ld.Work_Experience__c=='3 + years'){
val=val+1;
}if(ld.Qualification__c!='Undergraduate'&&ld.Qualification__c!='Graduate'&&ld.Qualification__c!='Post Graduate Diploma'&&ld.Qualification__c!='Masters Degree'&&ld.Qualification__c!='Undergraduate or postgraduate degree in Engineering, Mathematics, Physics, Statistics, B.Sc, B.Pharma, BBA, Economics or Commerce'){
val=val+1;
}if(ld.Lead_City__c=='Mumbai'||ld.Lead_City__c=='Bengaluru' ||ld.Lead_City__c=='Pune'||ld.Lead_City__c=='Chennai'||ld.Lead_City__c=='Trivandrum'){
val=val+1;
}if(ld.LeadSource=='Walk In'||ld.LeadSource=='Incomming Call'||ld.LeadSource=='Chat'){
val=val+1;
}if(ld.Comfortable_with_Fee__c=='Yes'){
val=val+1;
}if(ld.Info_session_Attended__c =='Yes'){
val=val+1;
}if(ld.Interested_in_this_Intake__c=='Yes'){
val=val+1;
}if(ld.Duplicacy__c==true){
val=val+1;
}if(ld.Interested_in_Program_For_Self__c=='Yes'){
val=val+1;
}if(ld.Interested_in_SPJAT__c=='Yes'){
val=val+1;
}
}
system.debug('Value of value variable:' + val);
if( ld.Program__c == 'EMBA' ) {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}else if(ld.Program__c == 'DMM'&& ld.Program_Type__c=='PT') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}else if(ld.Program__c == 'DMM'&& ld.Program_Type__c=='FT') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/9;
}else if(ld.Program__c == 'BDAP'&& ld.Program_Type__c=='PT') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}else if(ld.Program__c == 'BDAP'&& ld.Program_Type__c=='FT') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/9;
}else if(ld.Program__c == 'MGB') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}else if(ld.Program__c == 'GMBA') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}else if(ld.Program__c == 'GFMB') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/9;
}else if(ld.Program__c == 'MgLuxM') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/9;
}else if(ld.Program__c == 'Cyber Security' || ld.Program__c == 'Machine Learning' || ld.Program__c == 'Virtual Reality') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/11;
}else if(ld.Program__c == 'BBA'|| ld.Program__c == 'BBC' || ld.Program__c == 'BEC') {
ld.Lead_Rating_Percentile__c = (((Double)val)*100)/10;
}
/*End*/
/*Start Lead status update to Not Contacted when Lead goes from TCC to RM*/
if( Trigger.isBefore && Trigger.isUpdate ){
Lead OldLead = Trigger.oldMap.get(ld.Id);
for (GroupMember qm :queueMembers ) {
if( (OldLead.Ownerid == qm.UserOrGroupId) && ld.ownerid != queue.Id && string.valueOf(ld.OwnerId).startsWith('00G') ) {
ld.Status = 'Not Contacted';
}
}
}
/*End*/
/*Start - Updating custom fields for mapping with account*/
if(ld.Status != null){
ld.Hidden_Lead_Status__c = ld.Status;
}
if(ld.LeadSource != null){
ld.Hidden_Lead_Source__c = ld.LeadSource;
}
if(true){
ld.Hidden_Do_Not_Call__c = ld.DoNotCall;
ld.Hidden_Partial_Application__c = ld.Partial_Application__c;
}
/*End*/
} // End of Before trigger
/*Start - After trigger for Lead Duplication*/
if(trigger.isAfter && trigger.isInsert){
for(Lead Ele : Exleads){
if(( (ld.email != null && ld.email == Ele.email) && (ld.Program__c != null && ld.Program__c==Ele.Program__c) ) || ( (ld.MobilePhone != null && ld.MobilePhone == ELe.MobilePhone) && (ld.Program__c != null && ld.Program__c==Ele.Program__c) )){
Duplicate_Lead__c DPLead = new Duplicate_Lead__c();
DPLead.Name = 'Duplicate Of'+' '+ Ele.Name;
DPLead.Lead_Name__c = ld.FirstName+ ' '+ld.LastName ;
DPLead.Email__c = ld.Email;
DPLead.Mobile__c = ld.MobilePhone;
DPLead.Lead_Status__c = ld.Status;
DPLead.Lead_Source__c = ld.LeadSource;
DPLead.Work_Experience__c = ld.Work_Experience__c;
DPLead.program__c = ld.Program__c;
DPLead.Lead_City__c = ld.Lead_City__c;
DPLead.Lead_State__c = ld.Lead_State__c;
DPLead.Lead_Country__c = ld.Lead_Country__c;
Ele.Duplicacy__c = true;
LeadsToUpdate.add(Ele);
DupLeads.add(DPLead);
Lead leadDel = new Lead(Id=ld.Id);
dupLeadsDelete.add(leadDel);
}
}
}
/*End*/
}
if(!LeadsToUpdate.isEmpty()){
myset.addAll(LeadsToUpdate);
result.addAll(myset);
update result;
}
if(!dupLeadsUpdate.isEmpty()){
update dupLeadsUpdate;
}
if(!DupLeads.isEmpty()){
Insert DupLeads;
}
if(!dupLeadsDelete.isEmpty()){
Delete dupLeadsDelete;
}
}
Thanks in advance!
- Dnyaneshwar
- January 02, 2017
- Like
- 0
- Continue reading or reply
custom button not passing values
Hello Everybody,
I have a custom object Raw_Lead__c with 3 custom fields namely: First_Name__c, Last_Name__c and Email__c . I have created a custom button on Raw_Lead object with URL:
/00Q/e?retURL=/{!Lead.Id}&{!Lead.FirstName}={!Raw_Lead__c.First_Name__c} & {!Lead.LastName}={!Raw_Lead__c.Last_Name__c}&{!Lead.Email}={!Raw_Lead__c.Email__c}&cancelURL=/{!Raw_Lead__c.Id}
I am trying to pass these 3 custom fields into lead fields.But when i click on the button of any Raw_Lead obj record it redirect me to Create page of Lead with all 3 lead values blank.
that times URL is :https://cs31.salesforce.com/00Q/e?retURL=/&=Ramesh%20&=rameshkend%40gmail.com&%20=Kendre&cancelURL=/a09p0000003jP5B


Can anyOne have any clue what am i doning wrong!
I have a custom object Raw_Lead__c with 3 custom fields namely: First_Name__c, Last_Name__c and Email__c . I have created a custom button on Raw_Lead object with URL:
/00Q/e?retURL=/{!Lead.Id}&{!Lead.FirstName}={!Raw_Lead__c.First_Name__c} & {!Lead.LastName}={!Raw_Lead__c.Last_Name__c}&{!Lead.Email}={!Raw_Lead__c.Email__c}&cancelURL=/{!Raw_Lead__c.Id}
I am trying to pass these 3 custom fields into lead fields.But when i click on the button of any Raw_Lead obj record it redirect me to Create page of Lead with all 3 lead values blank.
that times URL is :https://cs31.salesforce.com/00Q/e?retURL=/&=Ramesh%20&=rameshkend%40gmail.com&%20=Kendre&cancelURL=/a09p0000003jP5B
Can anyOne have any clue what am i doning wrong!
- Dnyaneshwar
- December 15, 2016
- Like
- 0
- Continue reading or reply
lead record summary in visualforce page
Hi,
I was trying to get the number of Lead records with XYZ picklist values equals particular values i.e. a table with
coloumn 1 coloumn 2
row1 : ABC ABC (i.e. count of lead records where field XYZ = A or B or C)
row2 : ACD ACD (i.e. count of lead records where field XYZ = A or C or D)
row3 : BCD BCD (i.e. count of lead records where field XYZ = B or C or D)
I tried to acheive this using bucketing in report but couldn't because of salesforce some limitations on bucket fields. So i am trying to create a vf page table. Any suggestions?
Thanks a Ton! for any help.
I was trying to get the number of Lead records with XYZ picklist values equals particular values i.e. a table with
coloumn 1 coloumn 2
row1 : ABC ABC (i.e. count of lead records where field XYZ = A or B or C)
row2 : ACD ACD (i.e. count of lead records where field XYZ = A or C or D)
row3 : BCD BCD (i.e. count of lead records where field XYZ = B or C or D)
I tried to acheive this using bucketing in report but couldn't because of salesforce some limitations on bucket fields. So i am trying to create a vf page table. Any suggestions?
Thanks a Ton! for any help.
- Dnyaneshwar
- December 13, 2016
- Like
- 0
- Continue reading or reply
Handle lead duplication in after trigger
Hi All,
I am trying to check if Lead to insert is duplicate and if it is then store it in separate custom object(Duplicate_Lead__c). but in query it is returning the record i am inserting i.e. for every lead i insert this trigger is matching its fields with itself and creating duplicate record in custom object.
How to avoid this? Also i want to update a checkbox on duplicate Lead record, is it possible in same after trigger?
trigger LeadDuplicateTrigger on Lead(after insert) {
List Exleads = [Select id, name, email, MobilePhone, Program__c From Lead];
List DupLeads = new List ();
for(Lead l : Trigger.new){
for(Lead Ele : Exleads){
if(( (l.email == Ele.email) && (l.Program__c==Ele.Program__c) ) || ( (l.MobilePhone == ELe.MobilePhone) && (l.Program__c==Ele.Program__c) )){
Duplicate_Lead__c DPLead = new Duplicate_Lead__c();
DPLead.Name = ‘Duplicate Of’+’ ‘+ Ele.Name;
DPLead.Admission_Stage__c = l.Admission_Stage__c;
DPLead.Admission_Status__c = l.Admission_Status__c;
DPLead.Agency__c = l.Agency__c;
DPLead.Initial_Owner__c = l.Initial_Owner__c;
DPLead.Initial_program__c = l.Initial_program__c;
DPLead.Program__c = l.Program__c;
DPLead.Lead_State__c = l.Lead_State__c;
DPLead.Test_Score__c = l.Test_Score__c;
DupLeads.add(DPLead);
}
}
}
Insert DupLeads;
I am trying to check if Lead to insert is duplicate and if it is then store it in separate custom object(Duplicate_Lead__c). but in query it is returning the record i am inserting i.e. for every lead i insert this trigger is matching its fields with itself and creating duplicate record in custom object.
How to avoid this? Also i want to update a checkbox on duplicate Lead record, is it possible in same after trigger?
trigger LeadDuplicateTrigger on Lead(after insert) {
List Exleads = [Select id, name, email, MobilePhone, Program__c From Lead];
List DupLeads = new List ();
for(Lead l : Trigger.new){
for(Lead Ele : Exleads){
if(( (l.email == Ele.email) && (l.Program__c==Ele.Program__c) ) || ( (l.MobilePhone == ELe.MobilePhone) && (l.Program__c==Ele.Program__c) )){
Duplicate_Lead__c DPLead = new Duplicate_Lead__c();
DPLead.Name = ‘Duplicate Of’+’ ‘+ Ele.Name;
DPLead.Admission_Stage__c = l.Admission_Stage__c;
DPLead.Admission_Status__c = l.Admission_Status__c;
DPLead.Agency__c = l.Agency__c;
DPLead.Initial_Owner__c = l.Initial_Owner__c;
DPLead.Initial_program__c = l.Initial_program__c;
DPLead.Program__c = l.Program__c;
DPLead.Lead_State__c = l.Lead_State__c;
DPLead.Test_Score__c = l.Test_Score__c;
DupLeads.add(DPLead);
}
}
}
Insert DupLeads;
- Dnyaneshwar
- December 05, 2016
- Like
- 0
- Continue reading or reply
Static resources - not loading
Is anyone having problems using static resources with non-Firefox browsers, specifically IE7 and Safari? I'm finding that 9 times out of 10, URLs in a static resource refuse to load in these browsers. It results in missing stylesheets and images in my VF page.
Static resources are very convenient, but if they are not supported across browsers I'll have to go back to using Documents.
Static resources are very convenient, but if they are not supported across browsers I'll have to go back to using Documents.
- App_Dev1
- February 10, 2008
- Like
- 0
- Continue reading or reply