• JosephT
  • NEWBIE
  • 15 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 22
    Replies

I am receiving the error "Looks like something went wrong, please try again later." when checking my "Automate the creation of fulfillments" challenge within the Lightning Experience Specialist Super Badge.  Anyone have any ideas?

 

I would like to write a simple trigger to flag a checkbox on the lead record if the lead has any related CRM Content.  But, what object would I build the trigger off of?
I am trying to devise a way to show the average time frame between each opportunity that is created under any given account.  So, if I look at Account A and it has three opportunities associated to it, I would be able to see the average time (days) between the creation of each opportunity.

Any Ideas would be greatly appreciated.
I have a case trigger to count the number of related solutions but, I am receiving a SOQL number of quiries error on an import via data loader.  Therefore, I appear to have an issue with bulkifiying this trigger;

Here is my Trigger;

trigger NumberOfSolutions on case(before update) {
if(Trigger.isUpdate)
{
List<Case> objCase= new List<Case>();
for(Case c:Trigger.New)
{
Integer intNum = 0;
intNum =[select Count() from casesolution where caseID =:c.id];
c.Number_of_Solutions__c =intNum;
objCase.add(c);
}
}
}


Any help would be greatly appreciated.

Joseph
I am receiving the error "Error: Compile Error: Variable does not exist: Campaigns at line 15 column 21" for this line of code in my trigger;

LINE 15: for (Campaign c : Campaigns.values())

HERE IS MY FULL CODE:trigger TotalCampaignServicePackagesAmountforTitleServices on Opportunity (after insert, after update) {


  List<Campaign> campIds = new List<Campaign>();
  for (Opportunity o : trigger.new){
   if (o.CampaignID != null && (trigger.isInsert || o.Service_Packages_Amount__c != trigger.oldMap.get(o.id).Service_Packages_Amount__c))
   campIds.add(o.Campaign);
  }

  if (campIds.size() > 0) {

  Map<Id,Campaign> mapCampaigns = new Map<Id,Campaign>([select id from Campaign where Id in :campIds]);


  for (Campaign c : Campaigns.values())
  c.Total_Value_Services__c = 0;


  for (Opportunity o : [SELECT id, Service_Packages_Amount__c, CampaignId FROM Opportunity WHERE CampaignId =: campIds]){
   Campaign c = campaigns.get(o.CampaignId); c.Total_Value_Services__c += o.Service_Packages_Amount__c;
  }

  update campaigns.values();
  }
}
Any help would be greatly appreciated.




I created the following Trigger to update/associate a child record to an existing parent record.  These updates take place on an 'upsert' import.  The initial trigger worked on individual record updates but failed on the upsert due to 'too many SOQL quiries'.  So, I updated my trigger but now my test is passing but not relating to the trigger so I can't even test it yet as it looks like I have 0% code coverage.

TRIGGER:
trigger VAS_InsertProjectionIdsOnServices on VAS_Services__c (after update) {
List <VAS_Sales_Projections__c> sales_projections = [Select Id, Package_Name__c, Month__c FROM VAS_Sales_Projections__c];
for (VAS_Services__c S: Trigger.new)
{
for (VAS_Sales_Projections__c P: sales_projections)
{
if (P.Package_Name__c == S.Service_Name__c && P.Month__c.month() == S.Purchase_Date__c.month()&& P.Month__c.year() == S.Purchase_Date__c.year())
{

//Do logic here


S.VAS_Sales_Projections__c = P.Id;
S  = [SELECT Id From VAS_Services__c LIMIT 1];
    Update S;
}
}
}
}

TEST CLASS


@isTest(SeeAllData=true)

private class VAS_InsertProjectionIdsOnServicesTest{

  public static testmethod void test() {

    //Create VAS Sales Projection

    VAS_Sales_Projections__c P = new VAS_Sales_Projections__c (Package_Name__c = 'Complimentary Copies', Month__c=Date.today());
   
   
    //Create VAS Services

    VAS_Services__c S = new VAS_Services__c(Service_Name__c='Complimentary Copies', Purchase_Date__c= DateTime.Now());
   
    //Relate Records

    S.VAS_Sales_Projections__c = P.Id;
   
    S  = [SELECT Id From VAS_Services__c LIMIT 1];

}
}

So, the Test passes BUT, is not relating to the Trigger...  The trigger won;t even show up in the Develoepr Console when I open it????



I have a workflow that launches multiple field updates on the same field IF the matching criteria is met...

However, at the end of my If statement (IF(logical_test, value_if_true, value_if_false)), I have my 'value if false' set as "NULL".

Therefore, when ever the field update is launched, it inserts null values into the field.

How can I write an IF statement AND have the field not updated if the value if false?

I created a custon check box at the Activity level called "Survey Offered".

 

I need for this field to be flagged as true/checked IF an email contains certain characters/text.

 

Therefore, I started to create a trigger to update the task.Survey_Offered__c = true;

 

But, I keep tripping over the coding...

 

Here is what I have been able to save so far;

 

 

trigger SurveyOffered on EmailMessage (before insert) {

for(EmailMessage message : trigger.new){

if(message.TextBody == 'createspace.force.com/HMD') {

message.ActivityId= 'SFDC_Support';

} //end trigger

}

}

 

NOW, everytime I try to insert a line to update Survey_Offered__c I am receiving error messages...

 

Any ideas?

I created the following Trigger for Lead Based Activites but now, I would like to filter the trigger to only run/be applied to a specific Profile...  BUT, I am not exactly sure where I would add it? 

 

Here is my current APEX Trigger;

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
trigger taskTrigger on Task (after insert, after update, after delete) {
if ((Trigger.isInsert || Trigger.isUpdate || Trigger.isDelete) && Trigger.isAfter) {

set<Id> LeadIds = new set<Id>();

if(trigger.isInsert || trigger.isUpdate){
for(Task p : trigger.new){
LeadIds.add(p.WhoId);
}
}

if(trigger.isDelete){
for(Task p : trigger.old){
LeadIds.add(p.WhoId);
}
}
map<Id,Double> LeadMap = new map<Id,Double> ();

CRMfusionDBR101.DB_Globals.triggersDisabled = true;
for(AggregateResult q : [select WhoId,sum(Task_Name_Count__c)
from Task WHERE CreatedDate = TODAY
AND status = 'Completed'
AND
(Task_Type__c = 'Call'
OR Task_Type__c = 'Call: Reached'
OR Task_Type__c = 'Appointment Kept'
OR Task_Type__c = 'Appointment Scheduled'
OR Task_Type__c = 'VM'
OR Task_Type__c = 'Email')
AND WhoId IN :LeadIds group by WhoId]){
LeadMap.put((Id)q.get('WhoId'),(Double)q.get('expr0'));
}

List <Lead> LeadsToUpdate = new List <Lead> ();

for(lead l : [Select Id, Task_Counter__c from Lead where Id IN :LeadIds AND (Status = 'To Be Contacted' OR Status = 'Contact Made'OR Status = 'Contact Attempted')]){
Double Sum = LeadMap.get(l.Id);
l.Task_Counter__c = Sum;
LeadsToUpdate.add(l);
}

update LeadsToUpdate;
CRMfusionDBR101.DB_Globals.triggersDisabled = false;


}
}

I created a new 'Return to Case View" button on the Case Feed Publishers.  I am trying to allow users to return to the Last Case View they were looking.  However, when I click my button, the case view is displayed within an iframe...  How can I refresh the entire URL and bring them back to their 'last' case view?

I want to create a counter field at the lead level.  This field would count the total of all 'Outgoing' tasks for a lead prior to the lead reaching a 'Qualified' lead status.  Activities to be included are Call, Call: Attempted, Call: Reached, Appointment Kept, Appointment Scheduled, Voicemail left  AND Emails.  It appears that I would need to create a Trigger to do this BUT, I am not a coding man...  Any ideas?

I want to set up a Case assignment rule that grabs all emails that are sent to a specific email address.  Therefore, all emails sent to "my_company@abc.com" will be dropped into a specific queue.
  • September 21, 2007
  • Like
  • 0
I am trying to filter out the record count on a summed report so that only contacts with the number of activities greater than 5 are displayed? 

Basically, when I run a report that includes contacts and their associated activities, instead of showing all contacts with all activities, I would like to see only contacts whose "record count" or "rowcount" is greater than 5.  This would permit me to see my most active/high-touch contacts.

I have attempted a few fomula's to acheive this result to no avail?  Anyone ever tackled this before that may have some suggestions?
I am trying to filter out the record count on a summed report so that only contacts with the number of activities greater than 5 are displayed?  I have attempted a few fomula's to acheive this result to no avail...forlumas are not my strong suit?  Anyone ever tackled this before?

I am receiving the error "Looks like something went wrong, please try again later." when checking my "Automate the creation of fulfillments" challenge within the Lightning Experience Specialist Super Badge.  Anyone have any ideas?

 

I am receiving the error "Looks like something went wrong, please try again later." when checking my "Automate the creation of fulfillments" challenge within the Lightning Experience Specialist Super Badge.  Anyone have any ideas?

 

On Trailhead:

https://trailhead.salesforce.com/modules/service_basics/units/service_basics_intro

Check Challenge button does not complete and returns message:

'Looks like we're having issues, please try again. If this issue persists, please contact us using the submit feedback section on the sidebar.'

Please advise
I am trying to devise a way to show the average time frame between each opportunity that is created under any given account.  So, if I look at Account A and it has three opportunities associated to it, I would be able to see the average time (days) between the creation of each opportunity.

Any Ideas would be greatly appreciated.
I have a case trigger to count the number of related solutions but, I am receiving a SOQL number of quiries error on an import via data loader.  Therefore, I appear to have an issue with bulkifiying this trigger;

Here is my Trigger;

trigger NumberOfSolutions on case(before update) {
if(Trigger.isUpdate)
{
List<Case> objCase= new List<Case>();
for(Case c:Trigger.New)
{
Integer intNum = 0;
intNum =[select Count() from casesolution where caseID =:c.id];
c.Number_of_Solutions__c =intNum;
objCase.add(c);
}
}
}


Any help would be greatly appreciated.

Joseph
I am receiving the error "Error: Compile Error: Variable does not exist: Campaigns at line 15 column 21" for this line of code in my trigger;

LINE 15: for (Campaign c : Campaigns.values())

HERE IS MY FULL CODE:trigger TotalCampaignServicePackagesAmountforTitleServices on Opportunity (after insert, after update) {


  List<Campaign> campIds = new List<Campaign>();
  for (Opportunity o : trigger.new){
   if (o.CampaignID != null && (trigger.isInsert || o.Service_Packages_Amount__c != trigger.oldMap.get(o.id).Service_Packages_Amount__c))
   campIds.add(o.Campaign);
  }

  if (campIds.size() > 0) {

  Map<Id,Campaign> mapCampaigns = new Map<Id,Campaign>([select id from Campaign where Id in :campIds]);


  for (Campaign c : Campaigns.values())
  c.Total_Value_Services__c = 0;


  for (Opportunity o : [SELECT id, Service_Packages_Amount__c, CampaignId FROM Opportunity WHERE CampaignId =: campIds]){
   Campaign c = campaigns.get(o.CampaignId); c.Total_Value_Services__c += o.Service_Packages_Amount__c;
  }

  update campaigns.values();
  }
}
Any help would be greatly appreciated.




I have a workflow that launches multiple field updates on the same field IF the matching criteria is met...

However, at the end of my If statement (IF(logical_test, value_if_true, value_if_false)), I have my 'value if false' set as "NULL".

Therefore, when ever the field update is launched, it inserts null values into the field.

How can I write an IF statement AND have the field not updated if the value if false?

I created a custon check box at the Activity level called "Survey Offered".

 

I need for this field to be flagged as true/checked IF an email contains certain characters/text.

 

Therefore, I started to create a trigger to update the task.Survey_Offered__c = true;

 

But, I keep tripping over the coding...

 

Here is what I have been able to save so far;

 

 

trigger SurveyOffered on EmailMessage (before insert) {

for(EmailMessage message : trigger.new){

if(message.TextBody == 'createspace.force.com/HMD') {

message.ActivityId= 'SFDC_Support';

} //end trigger

}

}

 

NOW, everytime I try to insert a line to update Survey_Offered__c I am receiving error messages...

 

Any ideas?

I created the following Trigger for Lead Based Activites but now, I would like to filter the trigger to only run/be applied to a specific Profile...  BUT, I am not exactly sure where I would add it? 

 

Here is my current APEX Trigger;

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
trigger taskTrigger on Task (after insert, after update, after delete) {
if ((Trigger.isInsert || Trigger.isUpdate || Trigger.isDelete) && Trigger.isAfter) {

set<Id> LeadIds = new set<Id>();

if(trigger.isInsert || trigger.isUpdate){
for(Task p : trigger.new){
LeadIds.add(p.WhoId);
}
}

if(trigger.isDelete){
for(Task p : trigger.old){
LeadIds.add(p.WhoId);
}
}
map<Id,Double> LeadMap = new map<Id,Double> ();

CRMfusionDBR101.DB_Globals.triggersDisabled = true;
for(AggregateResult q : [select WhoId,sum(Task_Name_Count__c)
from Task WHERE CreatedDate = TODAY
AND status = 'Completed'
AND
(Task_Type__c = 'Call'
OR Task_Type__c = 'Call: Reached'
OR Task_Type__c = 'Appointment Kept'
OR Task_Type__c = 'Appointment Scheduled'
OR Task_Type__c = 'VM'
OR Task_Type__c = 'Email')
AND WhoId IN :LeadIds group by WhoId]){
LeadMap.put((Id)q.get('WhoId'),(Double)q.get('expr0'));
}

List <Lead> LeadsToUpdate = new List <Lead> ();

for(lead l : [Select Id, Task_Counter__c from Lead where Id IN :LeadIds AND (Status = 'To Be Contacted' OR Status = 'Contact Made'OR Status = 'Contact Attempted')]){
Double Sum = LeadMap.get(l.Id);
l.Task_Counter__c = Sum;
LeadsToUpdate.add(l);
}

update LeadsToUpdate;
CRMfusionDBR101.DB_Globals.triggersDisabled = false;


}
}

I created a new 'Return to Case View" button on the Case Feed Publishers.  I am trying to allow users to return to the Last Case View they were looking.  However, when I click my button, the case view is displayed within an iframe...  How can I refresh the entire URL and bring them back to their 'last' case view?

I want to create a counter field at the lead level.  This field would count the total of all 'Outgoing' tasks for a lead prior to the lead reaching a 'Qualified' lead status.  Activities to be included are Call, Call: Attempted, Call: Reached, Appointment Kept, Appointment Scheduled, Voicemail left  AND Emails.  It appears that I would need to create a Trigger to do this BUT, I am not a coding man...  Any ideas?