• JaredPH
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 18
    Replies
Hi everyone,

I'm terrible at coding, but was hoping someone would be feeling kind enough to help me with a simple trigger that maps the value of a custom lead field to the standard opportunity "type" field on conversion. The name of the field is lead_type__c

Any help that anyone could give would really be appreciated. Thanks so much!


I would like to be able to have a button that creates a new task of one record type and another button that creates a task of another record type. I'm using it as a sort of clone of the standard "log a call" button. I would like users two buttons they can click rather than one button and then selecting the record type.

 

I founc the button hack using a URL reference, but for some reason this is really much slower than loading a VF page. Is there any way to pass the record type through a button without this URL button override?

 

Thanks for any help!

I'm a real newbie with VisualForce. Is there an easy way to create a VF page that is exactly the same as an existing page layout except that the column count is 3 instead of the default 2? How would I call that page layout into the 3-column VF page?

 

Thanks for any help you can give!

How difficult would it be to develop something (apex?) that would make it so that when a user clicks on an MS word document in files in chatter, it would take them to microsoft skydrive to edit/view the document using the web app without having the desktop application on their machine? difficult? impossible? simple?

If it's possible, how could it be done? How many hours of development would that take? Anyone interested?

 

Thanks for any advice.

  • September 28, 2012
  • Like
  • 0

I have a lookup custom field "referrer" on the lead object. When a lead refers someone, we enter a new lead and enter the referrer lead into the lookup field of the new lead. (So, lead-to-lead lookup relationship). We have another custom lead field that is a date-time, called "discount". When a lead has 4 new lead records that list the lead in the "referrer" lookup field, I want to insert the current date and time into the discount field.

 

I'm useless with code. Do we need a number field and add 1 with each lead or is there a way to just do a lookup to see if there are 4 each time a new lead is entered? Is this a simple trigger that anyone would be able to help me out with?

 

Thanks in advance.

I'm trying to do a report that I know there must be a way to do but I can't figure out how to do it. I'm hoping there is a way to do it without creating a complex apex class--hopefully just in the report builder, but....

Three date/time fields on lead object. Consultation, Interview, Wrap-up. Each has the date the item was completed. I want to do a report that will list the count of the numer of all consultations, interviews, and wrap-ups done each week. So that I would have a table listing on one axis: Interview, consultation, wrap-up and then on the other axis, the dates of each week. Then the data is the count of the records each week where the date for the item falls into that week period.

I realize this is kind of complex. Isn't something like this possible? there's got to be some sort of workaround. Any of you experienced salesforce gurus have any ideas?

Thanks so much if you can solve this.

I am brand spanking new at VF development.

 

I have created a lookup relationship on the standard lead object that will relate to other leads. I have the related list for this relationship showing up on the lead page with a "new" button. I would like to customize the page that comes up when I click "new" (or a custom button that I create--"new friend") so that rather than the standard new lead page with all the lead fields, it only comes up with 4 or 5 designated lead fields such as first name, last name, email, and phone. Is this something simple enough to do?

 

I can create the new button and attach a custom VF page to it, but not sure (1) what to put in the VF code of the custom page so that the 4 or 5 fields entered will be relate the new lead record to the related (parent/lookup) lead and (2)how to put the 4 or 5 fields into the code. Sorry, that's not much that I can do--just getting started. Thanks for any help you can give.

Probably a silly question, but after watching the videos for flows, they talk a lot about how you can take a flow and put it onto a website for use by customers (not for users, but on a public website). How is that done (is there a help page that someone can direct me to or a how-to page?) Or is that only for sites that are accessed through a portal? How would that be done? Also, does the workflow have to go into a force.com site or can it go onto any site just with html? That is what I am looking to do--if that is possible, is there a page or link somewhere with a how-to about that?

 

Thanks in advance for any help anyone can give.

Probably a silly question, but after watching the videos for flows, they talk a lot about how you can take a flow and put it onto a website for use by customers (not for users, but on a public website). How is that done (is there a help page that someone can direct me to or a how-to page?) Or is that only for sites that are accessed through a portal? How would that be done? Also, does the workflow have to go into a force.com site or can it go onto any site just with html? That is what I am looking to do--if that is possible, is there a page or link somewhere with a how-to about that?

 

Thanks in advance for any help anyone can give.

I've gotten some help and worked out a trigger. It does what I want with updating a field based on a comparison of a date ("accepted__c") and datetime field ("payment_ref__c"). I just realized that it gives an error if one of the comparison date or date/time fields is blank. Is there an easy way to insert a line so it skips everything if either of those fields are blank? Also, am I going to run into trouble if I use an opportunity record type that doesn't include one of the fields referenced in the trigger?

 

Thanks for any help you can give!!

 

Here is the trigger:

 

Trigger LateApp on opportunity(before update)
{
datetime accdt;
date payref;
list<opportunity> opp=new list<opportunity>();
for(opportunity o : trigger.new)
{
accdt=trigger.new[0].Accepted__c.date();
payref=trigger.new[0].Payment_ref__c.adddays(45);
if(payref.daysBetween(accdt.date()) >= 0 && payref.daysBetween(accdt.date()) < 30)
{
o.Late_App__c ='Late1';
}
if(payref.daysBetween(accdt.date()) >= 30 && payref.daysBetween(accdt.date()) < 60)
{
o.Late_App__c ='Late2';
}
if(payref.daysBetween(accdt.date()) >=60)
{
o.Late_App__c ='Late3';
}
if(payref.daysbetween(accdt.date()) <-15)
{
o.Late_App__c='';
}
opp.add(o);
}
}

I've got a trigger that needs to specify a picklist value based on the number of days between two fields, but one is a date and one is a datetime. I'm trying to use the date method to convert the datetime before using daysbetween, but can't figure out how to get it to work. I'm VERY new at triggers, so hopefully this should be straightforward....I just can't get it.

 

Trigger LateApp on opportunity(after update)
{
datetime dt1;
date dt2;
list<opportunity> opp=new list<opportunity>();
for(opportunity o : trigger.new)
{
dt1=trigger.new[0].Accepted__c;  *****do I add a .date here somewhere??****
dt2=trigger.new[0].Payment_ref__c;
if(dt1.daysBetween(dt2)+45 >= 45 || dt1.daysBetween(dt2)+45 < 75)
{
o.Payment_Plan__c ='Late1';
}
if(dt1.daysBetween(dt2)+45 >= 75 || dt1.daysBetween(dt2)+45 < 105)
{
o.Payment_Plan__c ='Late2';
}
if(dt1.daysBetween(dt2)+45 >= 105)
{
o.Payment_Plan__c ='Late3';
}
opp.add(o);
}
update opp;
}

I'm trying to create a trigger that will update a picklist (picklist__c) based on the number of days a date/time field (field1__c) is later than another date field (field2__c) on the opportunity object. Here are the parameters:

 

if field1-field2 + 45

   <0 do nothing

   45 to 74 update picklist to "late1"

   75 to 104 update picklist to "late2"

   105 or greater update picklist to "late3"

 

Thanks for any help. I look at this and think it should be simple, but I'm not coming up with it.

 

 

We change the owner of our opportunities when the owner changes from one certain stage to another, but need to have the previous owner for a report. I want to put the name of the previous owner in a custom lookup field that I created when the stage changes from "App In" to something else. I'm really a beginner with triggers, can anyone help? I've tried doing it with workflows and it doesn't allow me to do it. I'm thinking I need an apex trigger.

 

Any ideas?

We have a workflow based on opportunity record that changes the owner of the opportunity. We would like to also have the account owner change automatically to the new opportunity owner when the opp owner is changed. After looking, there seems to be no way to do this with workflows. What about a trigger? Pretty much no experience with triggers, here...Can anyone help?

Brand new brand new with apex triggers here. I am wanting to create a trigger with lead convert that creates a new contact role when a lead is converted using the newly created contact as the primary contact and making the role "other". I've modified some code provided by Jeff Douglas. I think it will work, but the simplest part--making the role to "other" is giving me trouble. Realized I can't just put quotes around it. Can anyone help with the second to last line of code??

 

Also, if there is anything that makes it look like this won't work, could you give me a hand and let me know?

 

trigger LeadConvert on Lead (after update) {
 
  // no bulk processing; will only run from the UI
  if (Trigger.new.size() == 1) {
 
    if (Trigger.old[0].isConverted == false && Trigger.new[0].isConverted == true) {
 
      // if a new opportunity was created
      if (Trigger.new[0].ConvertedOpportunityId != null && Trigger.new[0].ConvertedContactId != null) {
            Opportunity opp = [Select o.Id from Opportunity o Where o.Id = :Trigger.new[0].ConvertedOpportunityId];
            Contact c = [Select c.Id From Contact c Where c.Id = :Trigger.new[0].ConvertedContactId];           
        
            // add an opportunity contact role
            OpportunityContactRole ocr = new OpportunityContactRole();
            ocr.OpportunityId = opp.Id;
            ocr.ContactId = c.Id;
            ocr.IsPrimary = True;
//This next line doesn't work. It's a picklist value, what syntax do I use?
//ocr.Role = "Other"
            insert ocr;
         
      }         
 
    }
 
  }     
 
}



I'm looking for a way to do the following report.

 

5 custom date/time fields on opportunity object. The dates represent the date/time different benchmarks in our sales funnel (e.g. application submitted, deposit paid, interview complete, etc.) I need to know how many applications were submitted, deposits paid, etc. each calendar week.) I would like a report that where each column is a calendar week, and each row shows the benchmark from the 5 different fields, with the count in the grid. I can do this with a single field but can't figure out how to do it with multiple fields in one report.

 

Second, once I get this report and a similar report that I've figured out, I would like to add it as a component on a dashboard page or since it will be pretty wide, I'm wondering if there is a way to include it across 3 columns in the top 3rd of a vfpage that we use as a dashboard page that would have another similar report and possibly some other standard dashboard components.

 

Any ideas?

 

  • September 13, 2011
  • Like
  • 0

I have a lookup custom field "referrer" on the lead object. When a lead refers someone, we enter a new lead and enter the referrer lead into the lookup field of the new lead. (So, lead-to-lead lookup relationship). We have another custom lead field that is a date-time, called "discount". When a lead has 4 new lead records that list the lead in the "referrer" lookup field, I want to insert the current date and time into the discount field.

 

I'm useless with code. Do we need a number field and add 1 with each lead or is there a way to just do a lookup to see if there are 4 each time a new lead is entered? Is this a simple trigger that anyone would be able to help me out with?

 

Thanks in advance.

I am brand spanking new at VF development.

 

I have created a lookup relationship on the standard lead object that will relate to other leads. I have the related list for this relationship showing up on the lead page with a "new" button. I would like to customize the page that comes up when I click "new" (or a custom button that I create--"new friend") so that rather than the standard new lead page with all the lead fields, it only comes up with 4 or 5 designated lead fields such as first name, last name, email, and phone. Is this something simple enough to do?

 

I can create the new button and attach a custom VF page to it, but not sure (1) what to put in the VF code of the custom page so that the 4 or 5 fields entered will be relate the new lead record to the related (parent/lookup) lead and (2)how to put the 4 or 5 fields into the code. Sorry, that's not much that I can do--just getting started. Thanks for any help you can give.

I've gotten some help and worked out a trigger. It does what I want with updating a field based on a comparison of a date ("accepted__c") and datetime field ("payment_ref__c"). I just realized that it gives an error if one of the comparison date or date/time fields is blank. Is there an easy way to insert a line so it skips everything if either of those fields are blank? Also, am I going to run into trouble if I use an opportunity record type that doesn't include one of the fields referenced in the trigger?

 

Thanks for any help you can give!!

 

Here is the trigger:

 

Trigger LateApp on opportunity(before update)
{
datetime accdt;
date payref;
list<opportunity> opp=new list<opportunity>();
for(opportunity o : trigger.new)
{
accdt=trigger.new[0].Accepted__c.date();
payref=trigger.new[0].Payment_ref__c.adddays(45);
if(payref.daysBetween(accdt.date()) >= 0 && payref.daysBetween(accdt.date()) < 30)
{
o.Late_App__c ='Late1';
}
if(payref.daysBetween(accdt.date()) >= 30 && payref.daysBetween(accdt.date()) < 60)
{
o.Late_App__c ='Late2';
}
if(payref.daysBetween(accdt.date()) >=60)
{
o.Late_App__c ='Late3';
}
if(payref.daysbetween(accdt.date()) <-15)
{
o.Late_App__c='';
}
opp.add(o);
}
}

I'm trying to create a trigger that will update a picklist (picklist__c) based on the number of days a date/time field (field1__c) is later than another date field (field2__c) on the opportunity object. Here are the parameters:

 

if field1-field2 + 45

   <0 do nothing

   45 to 74 update picklist to "late1"

   75 to 104 update picklist to "late2"

   105 or greater update picklist to "late3"

 

Thanks for any help. I look at this and think it should be simple, but I'm not coming up with it.

 

 

We change the owner of our opportunities when the owner changes from one certain stage to another, but need to have the previous owner for a report. I want to put the name of the previous owner in a custom lookup field that I created when the stage changes from "App In" to something else. I'm really a beginner with triggers, can anyone help? I've tried doing it with workflows and it doesn't allow me to do it. I'm thinking I need an apex trigger.

 

Any ideas?

Is it possible to pass lead ID and context into the flow as it starts, like passing command line parameters?