• Edward Scott 17
  • NEWBIE
  • 20 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 6
    Replies
Hi All,

I am trying to create a rollup field from the opportunity to the account. I would like to be able to only roll up the amount of an opportunity if it has closed with in the last 30 days. I created a formula field on the opportunity but it will not allow me to use that in the rollup criteria. 

Is there any other way to accomplish this?

Thanks for your help,
Edward
Hi,

It is the beginning of the year and I am trying to rerun all of the leads in our database through the new assignment rule. Normally I would use a script or a trigger that I have set up to re-run people through the assignment rule when they go from a certain lead staus to another. I know though that both triggers and scripts have a limit to them. So I am trying to write an apex class that will rerun all the leads through the lead assignment and check a checkbox field that I created to see who has been changed.

Thanks for your help in advance,
Edward
Hi,

I have a question about campaign influence. 

So I know that if a contact is added to an opportunity that any campaign that was associated to the contact before the contact is associated with the opportunity will be added to the opportunity. My question is if that contact is added to another campaign before the opportunity closes will the newly added campaign be added to the opportunity. 

If the answer is no, is there a way to create a trigger that will do it for me?

Thanks,
Edward
Hi,

I am writing to ask if anyone knows a way to create a flow that will fire from campaign to the source campaign field on the contact object.

A little background I just wrote a trigger that sorts the names of the campaign in descending order based on date and fires the name of the most recent campaign to the source campaign field on the contact object. This will work moving forward but I am hoping there is something I can do to clean up the contacts that are already apart of campaigns.

I am thinking the only way is to create a flow and call that from a process builder on edit and do an upload but I am not sure how to create the flow.

Thanks in advance for your help,
Ed
Hi,

I am working on a DML statement that will first collect every opportunity where the close date equals 11/26/2018. Those opps will then be added to a second list and if they have a name of test then the opportunity will be updated. Most of it is working now. The problem I am having is updating the opportunity after it is found. I want to update the Primary Source Campaign (Campaign.name) which is a standard field on the opportunity with the value of the Primary Contact's (Primary_Contact__c a custom field on the opportunity that looks up to the Contact) Source Campaign (Source_Campaign__c another custom field on the contact page).

Long story short I am not sure how to write the apex code to look up the value of a custom field. I am pasting the code below.

Thanks in advance for your help,
Ed
 
//collect all opportunities
Date closeDate = Date.newInstance(2018, 11, 26);
List<Opportunity> oppList = [Select Id, Name, Description, Type, StageName, Primary_Contact__c, Campaign.name from Opportunity Where Closedate =:closeDate];

//Create a list to store the records that we need to update
List<Opportunity> updatedOppList = new List <Opportunity>();

for (Opportunity obj:oppList)
{
    if(obj.name =='test'){
        obj.campaign.name = Primary_Contact__c.Source_Campaign__c;
        updatedOppList.add(obj);
    }
}

//DML Statement to update the invoice status
update updatedOppList;

//Prints the value of updated invoices
System.debug('List has been updated and updated value of records are'+updatedOppList);

 
Hi,

I am trying to query the opportunity object to find all closed lost opportunities. After finding those ops I would like to write test op in the opportunity description field. I am getting an error and can't figure out what is wrong. I posted the code below. Any help would be greatly appreciated.
//Create a list to store the records that we need to update
List<Opportunity> updatedOppList = new List <Opportunity>();
  
for (Opportunity obj:oppList)
{
    if obj.StageName = 'Closed Lost'{
        obj.description = 'test opp';
		updatedOppList.add(obj);
    }
}

//DML Statement to update the invoice status
update updatedOppList;

//Prints the value of updated invoices
System.debug('List has been updated and updated value of records are'+updatedOppList);
Thanks,
Ed
Hi,

I have a question about campaign influence. 

So I know that if a contact is added to an opportunity that any campaign that was associated to the contact before the contact is associated with the opportunity will be added to the opportunity. My question is if that contact is added to another campaign before the opportunity closes will the newly added campaign be added to the opportunity. 

If the answer is no, is there a way to create a trigger that will do it for me?

Thanks,
Edward
Hi,

I am writing to ask if anyone knows a way to create a flow that will fire from campaign to the source campaign field on the contact object.

A little background I just wrote a trigger that sorts the names of the campaign in descending order based on date and fires the name of the most recent campaign to the source campaign field on the contact object. This will work moving forward but I am hoping there is something I can do to clean up the contacts that are already apart of campaigns.

I am thinking the only way is to create a flow and call that from a process builder on edit and do an upload but I am not sure how to create the flow.

Thanks in advance for your help,
Ed
Hi,

I am working on a DML statement that will first collect every opportunity where the close date equals 11/26/2018. Those opps will then be added to a second list and if they have a name of test then the opportunity will be updated. Most of it is working now. The problem I am having is updating the opportunity after it is found. I want to update the Primary Source Campaign (Campaign.name) which is a standard field on the opportunity with the value of the Primary Contact's (Primary_Contact__c a custom field on the opportunity that looks up to the Contact) Source Campaign (Source_Campaign__c another custom field on the contact page).

Long story short I am not sure how to write the apex code to look up the value of a custom field. I am pasting the code below.

Thanks in advance for your help,
Ed
 
//collect all opportunities
Date closeDate = Date.newInstance(2018, 11, 26);
List<Opportunity> oppList = [Select Id, Name, Description, Type, StageName, Primary_Contact__c, Campaign.name from Opportunity Where Closedate =:closeDate];

//Create a list to store the records that we need to update
List<Opportunity> updatedOppList = new List <Opportunity>();

for (Opportunity obj:oppList)
{
    if(obj.name =='test'){
        obj.campaign.name = Primary_Contact__c.Source_Campaign__c;
        updatedOppList.add(obj);
    }
}

//DML Statement to update the invoice status
update updatedOppList;

//Prints the value of updated invoices
System.debug('List has been updated and updated value of records are'+updatedOppList);

 
Hi,

I am trying to query the opportunity object to find all closed lost opportunities. After finding those ops I would like to write test op in the opportunity description field. I am getting an error and can't figure out what is wrong. I posted the code below. Any help would be greatly appreciated.
//Create a list to store the records that we need to update
List<Opportunity> updatedOppList = new List <Opportunity>();
  
for (Opportunity obj:oppList)
{
    if obj.StageName = 'Closed Lost'{
        obj.description = 'test opp';
		updatedOppList.add(obj);
    }
}

//DML Statement to update the invoice status
update updatedOppList;

//Prints the value of updated invoices
System.debug('List has been updated and updated value of records are'+updatedOppList);
Thanks,
Ed