• tjm_pacstrats
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 7
    Replies
I am testing out the Email-to-Case functionality (using On Demand Email-to-Case) and notice that when I send an email to the designated address a new case is created as expected but only the Subject line of the email appears within the case.  I don't see the attachments or the actualy body of the original email.  Any ideas?  Is this a set-up issue or something else?

I have no idea what I'm doing wrong here.  I've created a custom button to change the record type and update a few fields.  It works perfectly for me (I'm the Admin) but it won't work for any other Profile.  

 

Please help!

 

{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}

 

var newdemo = new sforce.SObject("Demo_Request__c");

newdemo.Id = '{!Demo_Request__c.Id}';

newdemo.Demo_Request_Sent_on__c="{!TEXT(TODAY())}";

newdemo.RecordTypeId="01280000000FEAe";

newdemo.Reject_Reason__c=null;

var result = sforce.connection.update([newdemo]);

 

if (result[0].success=='false')

{ alert(result[0].errors.message); }

else { location.reload(true); }

 

 

 

Message Edited by tjm_pacstrats on 04-20-2009 11:22 AM

Does anyone know if it's possible to associate an existing Opportunity with a converted Lead?  We are trying to track the value of the Opportunities associated with a specific set of Leads over time and unless the Opportunity is created during the conversion process, all tracking seems to be lost.

 

Any help would be appreciated.


I just started using Eclipse to write and promote Triggers/Classes and for some reason the following Trigger and Test Class both work in the Sandbox (with 100% coverage) but fail in Eclipse.  

 

In short, the Trigger updates the X1st_Campaign__c field with the Id of the most recent Campaign that the Lead responded to.

 

Trigger

 

trigger Set1stCampaign on Lead (before update)

{

for (Lead l : System.Trigger.new)

{

List<CampaignMember> campaign = new List<CampaignMember>();

campaign = [select CampaignId from CampaignMember where LeadId = :l.Id AND HasResponded = True order by FirstRespondedDate Desc limit 1];

if(campaign.size()>0)

{

l.X1st_Campaign__c = campaign[0].CampaignId;

}

}

}

 

Test Class

 

public class Lead1stCampaignTestClass {

static testMethod void OppOwnerRoleTest ()

{

Lead l = new Lead (FirstName='Test', LastName='Leadxx11xx11', Company='Testing Company', Industry='BioPharma', Sub_Industry__c='Big Pharma', LeadSource='Web', Status='Open');

insert l;

 

Campaign c1 = new Campaign (Name='Test Campaign 1', CurrencyIsoCode='USD', IsActive=True, Status='In Progress');

insert c1;

 

Campaign c2 = new Campaign (Name='Test Campaign 2', CurrencyIsoCode='USD', IsActive=True, Status='In Progress');

insert c2;

 

CampaignMember cm1 = new CampaignMember (CampaignId=c1.id, LeadId=l.id, Status='Responded');

insert cm1;

 

CampaignMember cm2 = new CampaignMember (CampaignId=c2.id, LeadId=l.id, Status='Responded');

insert cm2;

 

update l;

System.assertEquals(c1.id, [select X1st_Campaign__c from Lead where LastName='Leadxx11xx11'].X1st_Campaign__c);

 

}

}

 

Here are the errors from Eclipse:

System.Exception: Assertion failed: Expected: [id is listed], Actual null

Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required

 

I would appear that the Campaigns aren't being associated with the Lead so maybe I'm missing something there.

 

 

Any help or suggestions would be appreciated.

 

Message Edited by tjm_pacstrats on 02-21-2009 07:04 PM
Message Edited by tjm_pacstrats on 02-21-2009 07:05 PM
Message Edited by tjm_pacstrats on 02-21-2009 07:06 PM

I'm trying to write a Trigger that copies the Name of the first contact in the Contact Role into a custom field within the Opportunity in order to automatically name the Opp using a standard naming convention.  The problem occurs when there isn't a Contact listed.  This is the error message that I receive:

 

Error: Invalid Data. 
Review all error messages below to correct your data.

Apex trigger SetPrimaryContact caused an unexpected exception, contact your administrator: SetPrimaryContact: execution of BeforeUpdate caused by: System.QueryException: List has no rows for assignment to SObject: Trigger.SetPrimaryContact: line 4, column 20

 

Here is a copy of my Trigger.  

 

trigger SetPrimaryContact on Opportunity (before update) { for (Opportunity o : Trigger.new) { OpportunityContactRole contactRole; contactRole = [select Contact.Name from OpportunityContactRole where OpportunityId = :o.id order by IsPrimary Desc limit 1]; if(contactRole != null){ o.Primary_Contact__c = contactRole.Contact.Name; } }}

 

 

I would want to skip the Trigger if there aren't any Contacts associated with the Account.

 

Any help would be appreciated.

I am testing out the Email-to-Case functionality (using On Demand Email-to-Case) and notice that when I send an email to the designated address a new case is created as expected but only the Subject line of the email appears within the case.  I don't see the attachments or the actualy body of the original email.  Any ideas?  Is this a set-up issue or something else?

I have no idea what I'm doing wrong here.  I've created a custom button to change the record type and update a few fields.  It works perfectly for me (I'm the Admin) but it won't work for any other Profile.  

 

Please help!

 

{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}

 

var newdemo = new sforce.SObject("Demo_Request__c");

newdemo.Id = '{!Demo_Request__c.Id}';

newdemo.Demo_Request_Sent_on__c="{!TEXT(TODAY())}";

newdemo.RecordTypeId="01280000000FEAe";

newdemo.Reject_Reason__c=null;

var result = sforce.connection.update([newdemo]);

 

if (result[0].success=='false')

{ alert(result[0].errors.message); }

else { location.reload(true); }

 

 

 

Message Edited by tjm_pacstrats on 04-20-2009 11:22 AM

About a year ago, I created a custom button on Leads for Convert with a purpose of having 'Do not create a new opportunity upon conversion' checked by default instead of unchecked.  As of a few days ago, it no longer works and I'm receiving the URL No Longer Exists message.  I've included the script below.  Your help would be greatly appreciated in resolving this.

  

 

"/lead/leadconvert.jsp?retURL=%2F{!Lead.Id}&id={!Lead.Id}&nooppti=1"

  • March 25, 2009
  • Like
  • 0

I just started using Eclipse to write and promote Triggers/Classes and for some reason the following Trigger and Test Class both work in the Sandbox (with 100% coverage) but fail in Eclipse.  

 

In short, the Trigger updates the X1st_Campaign__c field with the Id of the most recent Campaign that the Lead responded to.

 

Trigger

 

trigger Set1stCampaign on Lead (before update)

{

for (Lead l : System.Trigger.new)

{

List<CampaignMember> campaign = new List<CampaignMember>();

campaign = [select CampaignId from CampaignMember where LeadId = :l.Id AND HasResponded = True order by FirstRespondedDate Desc limit 1];

if(campaign.size()>0)

{

l.X1st_Campaign__c = campaign[0].CampaignId;

}

}

}

 

Test Class

 

public class Lead1stCampaignTestClass {

static testMethod void OppOwnerRoleTest ()

{

Lead l = new Lead (FirstName='Test', LastName='Leadxx11xx11', Company='Testing Company', Industry='BioPharma', Sub_Industry__c='Big Pharma', LeadSource='Web', Status='Open');

insert l;

 

Campaign c1 = new Campaign (Name='Test Campaign 1', CurrencyIsoCode='USD', IsActive=True, Status='In Progress');

insert c1;

 

Campaign c2 = new Campaign (Name='Test Campaign 2', CurrencyIsoCode='USD', IsActive=True, Status='In Progress');

insert c2;

 

CampaignMember cm1 = new CampaignMember (CampaignId=c1.id, LeadId=l.id, Status='Responded');

insert cm1;

 

CampaignMember cm2 = new CampaignMember (CampaignId=c2.id, LeadId=l.id, Status='Responded');

insert cm2;

 

update l;

System.assertEquals(c1.id, [select X1st_Campaign__c from Lead where LastName='Leadxx11xx11'].X1st_Campaign__c);

 

}

}

 

Here are the errors from Eclipse:

System.Exception: Assertion failed: Expected: [id is listed], Actual null

Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required

 

I would appear that the Campaigns aren't being associated with the Lead so maybe I'm missing something there.

 

 

Any help or suggestions would be appreciated.

 

Message Edited by tjm_pacstrats on 02-21-2009 07:04 PM
Message Edited by tjm_pacstrats on 02-21-2009 07:05 PM
Message Edited by tjm_pacstrats on 02-21-2009 07:06 PM

I'm trying to write a Trigger that copies the Name of the first contact in the Contact Role into a custom field within the Opportunity in order to automatically name the Opp using a standard naming convention.  The problem occurs when there isn't a Contact listed.  This is the error message that I receive:

 

Error: Invalid Data. 
Review all error messages below to correct your data.

Apex trigger SetPrimaryContact caused an unexpected exception, contact your administrator: SetPrimaryContact: execution of BeforeUpdate caused by: System.QueryException: List has no rows for assignment to SObject: Trigger.SetPrimaryContact: line 4, column 20

 

Here is a copy of my Trigger.  

 

trigger SetPrimaryContact on Opportunity (before update) { for (Opportunity o : Trigger.new) { OpportunityContactRole contactRole; contactRole = [select Contact.Name from OpportunityContactRole where OpportunityId = :o.id order by IsPrimary Desc limit 1]; if(contactRole != null){ o.Primary_Contact__c = contactRole.Contact.Name; } }}

 

 

I would want to skip the Trigger if there aren't any Contacts associated with the Account.

 

Any help would be appreciated.

    Dear all

whenever suppose one click convert button he can find the page of convert lead. here i m attaching  that page
now i cant get where i find the page layout for that perticular becoze i want to diseble some fields of that page

please if anyone have solution reply me

thanks in advance
 
my mail id: amar_sap_85@yahoo.com