• Mycodex
  • NEWBIE
  • 50 Points
  • Member since 2008

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 36
    Replies

I have been trying to duplicate an org from some test accounts.

 

I've made some records and a custom field etc... in the first org. The second org is blank.

 

 

I've connected to the 1st org using Force.com eclipse... pulled in ALL required apex,classes,objects... ticked the whole lot.

 

then I tried deploying to the second org... I've had to change a few things like user of the org to this user.... but there are other errors which are stopping deployment...

 

in particular reports...

 

Please can anyone help me clone the data structure, schema and data from one ORG to another?

 

 

 

*** Deployment Log ***
Result: FAILED
Date: 29 May 2009 14:07:43 BST

# Deployed From:
   Project name: Test org1
   Username: *****@XXX.com
   Endpoint: www.salesforce.com

# Deployed To:
   Username: ****@hotmail.com
   Endpoint: www.salesforce.com

# Deploy Results:
   File Name:    reports/TEST1-meta.xml
   Full Name:  TEST1
   Action:  NO ACTION
   Result:  FAILED
   Problem: Not in package.xml

   File Name:    reports/TEST1/TEST1.report
   Full Name:  TEST1/TEST1
   Action:  NO ACTION
   Result:  FAILED
   Problem: Cannot find folder:TEST1

   File Name:    workflows/Account.workflow
   Full Name:  Account.TEST1
   Action:  NO ACTION
   Result:  FAILED
   Problem: In field: recipient - no User named rob.lone@pixpaycard.com found

   File Name:    layouts/Account-Account %28Marketing%29 Layout.layout
   Full Name:  Account-Account %28Marketing%29 Layout
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    layouts/Account-Account %28Sales%29 Layout.layout
   Full Name:  Account-Account %28Sales%29 Layout
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    layouts/Account-Account %28Support%29 Layout.layout
   Full Name:  Account-Account %28Support%29 Layout
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    layouts/Account-Account Layout.layout
   Full Name:  Account-Account Layout
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    layouts/TEST1__c-TEST1 Layout.layout
   Full Name:  TEST1__c-TEST1 Layout
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objectTranslations/TEST1__c-en_US.objectTranslation
   Full Name:  TEST1__c-en_US
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/Account.object
   Full Name:  Account.Active__c
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/Account.object
   Full Name:  Account.CustomerPriority__c
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/Account.object
   Full Name:  Account.NumberofLocations__c
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/Account.object
   Full Name:  Account.SLAExpirationDate__c
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/Account.object
   Full Name:  Account.SLASerialNumber__c
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/Account.object
   Full Name:  Account.SLA__c
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/Account.object
   Full Name:  Account.TEST1__c
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/Account.object
   Full Name:  Account.UpsellOpportunity__c
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/Account.object
   Full Name:  Account
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/Account.object
   Full Name:  Account.Billing
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/TEST1__c.object
   Full Name:  TEST1__c
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    package.xml
   Full Name:  package.xml
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/Admin.profile
   Full Name:  Admin
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/ContractManager.profile
   Full Name:  ContractManager
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/Custom%3A Marketing Profile.profile
   Full Name:  Custom%3A Marketing Profile
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/Custom%3A Sales Profile.profile
   Full Name:  Custom%3A Sales Profile
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/Custom%3A Support Profile.profile
   Full Name:  Custom%3A Support Profile
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/CustomerManager.profile
   Full Name:  CustomerManager
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/MarketingProfile.profile
   Full Name:  MarketingProfile
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/Partner.profile
   Full Name:  Partner
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/ReadOnly.profile
   Full Name:  ReadOnly
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/SolutionManager.profile
   Full Name:  SolutionManager
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/Standard.profile
   Full Name:  Standard
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/StandardAul.profile
   Full Name:  StandardAul
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    workflows/Account.workflow
   Full Name:  Account
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    workflows/Account.workflow
   Full Name:  Account.TEST1
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    workflows/TEST1__c.workflow
   Full Name:  TEST1__c
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

# Test Results:
   n/a

 

 

 

Love the app- its been useful for our users. The one complaint I'm getting is that the My Records checkbox is checked by default. Can you make this a custom setting so that its either checked or not checked by default similar to the Leads, Contacts checkboxes? Thanks!

I'm having trouble sending out an email message if I use an adderror. I've read in the apex docs that its not processing since the adderror does not allow the tranaction to commit. Knowing this is the case, what alternatives do I have?

 

Ultimately, I want to prevent a user from deleting a contact when there are licenses and I also want to be notified that the action has taken place. I think I might have to get creative for this. Here is the trigger I have so far:

 

 

trigger PreventDelete on Contact (before delete) {
for (License__c l : [select contact__c from license__c
where contact__c in :Trigger.oldMap.keySet()]) {

//Setup email and send
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {'email@acme.com'};
mail.setToAddresses(toAddresses);
mail.setReplyTo('emaiL@acme.com');
mail.setSenderDisplayName('Salesforce Support');
mail.setSubject('Contact Deletion Attempted');
mail.setBccSender(false);
mail.setUseSignature(false);
mail.setPlainTextBody('A contact delete was attempted.');
mail.setHtmlBody('Review contact for deletion<p>'+
' View license<a href=https://na5.salesforce.com/l.id>click here</a>');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

Trigger.oldMap.get(l.contact__c).addError('Contact has licenses attached. Support has been notified.');
}
}

 

 

 

email@acme

 So what is the different? To illustrate my point, here are both way returning a similar set.

 

 #1

Set<String> nameSet = new Set<String>(); List<Account> acct = [SELECT Name FROM Account]; for(Account a_insert: acct){ nameSet.add(a_insert.Name); }

 

#2

Set<String> nameSet = new Set<String>(); for(Account acct : [SELECT Name FROM Account]){ nameSet.add(Name); }

 

Would I hit a limit earlier with #2 since I am storing the results in the sObject instead a list?




 

 

Our company uses four types of contracts and there can only be one of each type. i would like to create a picklist that only displays the available values. I can display all of the active types but how would I receive the inverse of this list.

 

For example, if the account already has Type 1 and Type 2 contracts then only Type 3 and Type 4 should be available in the dropdown.  Here is what I have so far.

 

 

public List<SelectOption> getAllContractTypes() { List<SelectOption> ContractTypes = new List<SelectOption>(); ContractTypes.add(new SelectOption('Type 1','Type 1')); ContractTypes.add(new SelectOption('Type 2','Type 2')); ContractTypes.add(new SelectOption('Type 3','Type 3')); ContractTypes.add(new SelectOption('Type 4','Type 4')); return ContractTypes; } public List<SelectOption> getActiveTypes() { List<SelectOption> options = new List<SelectOption>(); for (contract co : [SELECT Contract_Type__c FROM Contract WHERE Accountid =
:ApexPages.currentPage().getParameters().get('ctrc7') AND Active__c=TRUE]) { options.add(new SelectOption(co.Contract_Type__c,co.Contract_Type__c)); } return ActiveTypes; }

 

 

 

I'm trying to embed a Visualforce page within an Opportunity to display some checkboxes in a view mode. The logic is there and it works just fine, but I just can't get the thing to look like the rest of the opportunity page. 

 

Now I know what you're going to say... why didn't I use a pageblock and pageblocksection? It just doesn't look good. It looks like I have a section within a section instead of a new section on its own. Basically, all I want is the pageblocksection. Unfortunately, you need the pageblock to have a pageblocksection.

 

I tried using Salesforce's common CSS stylesheet, but couldn't figure out which class to use. Here is the visualforce, anyone willing to help out?

 

<apex:page standardController="Opportunity"> <apex:form > <apex:panelgrid width="100%"> <h3>Sales Management Questionaire</h3> </apex:panelgrid> <apex:panelGrid columns="2" > <apex:inputcheckbox value="{!opportunity.Q1__c}" disabled="true"/>Question 1 <apex:inputcheckbox value="{!opportunity.Q2A1__c}" disabled="true"/>Question 2 <apex:inputcheckbox value="{!opportunity.Q2B1__c}" disabled="true"/>Question 3 <apex:inputcheckbox value="{!opportunity.Q2C1__c}" disabled="true"/>Question 4 </apex:panelGrid> </apex:form> </apex:page>

 

 

 

 

 

 

I'm trying to create a simple messaging system for users to display on the home page. Since visualforce pages can't change their size dynamically, I was hoping to make it a static height and then create pagination (previous page and next page). I'm stuck though on how to proceed. My apex and visualforce code is pretty basic. Has anyone done this?

public class messageController {

public SLX__Change_Control__c[] getMessages() {
return [select Name, Publish_Date__c, Published_Text__c from SLX__Change_Control__c WHERE Publish_Date__c <= TODAY AND Publish_Expiration__c >= TODAY AND Published__c = TRUE ORDER BY Publish_Date__c DESC];
}
}

 

<apex:page showHeader="false" controller="messageController">
<apex:repeat value="{!Messages}" var="message">
{!message.Name}
<apex:outputText value=" - Posted on {0,date,MM/dd/yyyy}">
<apex:param value="{!message.Publish_Date__c}" /></apex:outputText>
{!message.Published_Text__c}
</apex:repeat>
</apex:page>

 

 

I'm trying to display a table of events and all associated attendees if it is a group event.

Code:
public List<Event> getEvents() { 
        return [SELECT id, whatID, subject, startdatetime, whoID, accountID,
            (SELECT ID, AttendeeID, Status, RespondedDate, Response FROM EventAttendees)
           FROM Event
           WHERE whatID = :ApexPages.currentPage().getParameters().get('id')
           ORDER BY startdatetime DESC];
    }

I can confirm with Apex Explorer that the SOQL statement is at least accurate and doesn't fail. Now my issue is displaying the attendees on the Visualforce page

Code:
<apex:PageBlock title="Events">
    <apex:pageBlockTable value="{!events}" var="event" >
        <apex:column value="{!event.subject}"/>
        <apex:column value="{!event.startdatetime}"/>
        <apex:column value="{!event.whoID}"/>
        <apex:column value="{!event.accountID}"/>
    </apex:PageBlockTable>
</apex:pageBlock>

 I've tried !event.EventAttendees.AttendeeID (Error: Unknown property 'ArrayList.attendeeID') and !event.AttendeeID (Error: Invalid field attendeeID for SObject Event)

The EventAttendees object is not well documented and this might just be a complete failure from the start. Any help would be appreciated.
Hi all, I'm trying to make a PDF version of a custom detail page. I was looking to add the related list of Open Activities and Activity History. I can't seem to figure out the SQL statement to combine the Task and Event objects together so they show as Activities.

Any help would be useful.

Code:
public List<Event> getEvents() { 
        return [SELECT id, whatID, subject, startdatetime, whoID, accountID
           FROM Event
           WHERE whatID = :ApexPages.currentPage().getParameters().get('id')
           ORDER BY startdatetime DESC];
    }

 

Was trying to play around with the new PDF functionality of Visualforce. I found a post (http://community.salesforce.com/sforce/board/message?board.id=Visualforce&message.id=1782) that shows how to dynamically display it based on the url. When I ran the following code, I receive a File Download dialog box saying

Name: vforcetest.url=1
Type: Unknown File Type

When I save the file and then rename it from vforcetest.url=1 to vforcetest.pdf, the page opens up in Adobe Reader displaying the pdf correctly.  I've tested this both in a developer sandbox and in production along with different profiles. Has anyone run into something like this? I changed a page to renderas pdf last week and it worked fine.

Here is the code I used:


Code:
<apex:page renderAs="{!if($CurrentPage.parameters.p == null, null, 'pdf')}"> 
    <apex:pageBlock title="Some Page Block">
        <apex:pageBlockSection title="Section 1"> Text </apex:pageBlockSection>
        <apex:pageBlockSection title="Section 2"> Text </apex:pageBlockSection>
    </apex:pageBlock>
    <apex:outputLink rendered="{!$CurrentPage.parameters.p == null}" value="/apex/vforcetest—p=true" target="_blank">PDF</apex:outputLink>
</apex:page>





  • September 08, 2008
  • Like
  • 1
So i've been at this for quite some time already and can not see any references to triggering a get/set. I was following the Blog tutorial on visualforce and have the pages working perfectly. Now I want to promote them to production. I have 27% coverage so far, but I can't seem to figure out how to fire off my getStage, setStage, and deselectCheckboxes functions. Can anyone provide a resource or example?

Code:
public class OppControllerExtension {

    /* The standard controller object which will be used later for navigation and to invoke
       it's save action method to create the new Opportunity. */
    ApexPages.StandardController controller;
 
    /* The Opportunity property */
    public Opportunity o {get;set;}
  
    public OppControllerExtension(ApexPages.StandardController c) {
        controller = c;
        o = (Opportunity) c.getRecord();
    }
 
    Opportunity opp;
    
    String stage;
        
    /* Setter for the stage value */
    public void setStage(String s) { this.stage = s;}
    
    /* Getter for the stage value */
    public String getStage() { return this.stage; }
    
    /* Getter which generates the options for the stage selectList */
    public List<SelectOption> getStages() {
      List<SelectOption> optionList = new List<SelectOption>();
      /* Add a null option to force the user to make a selection. */
      optionList.add(new SelectOption('','- None -'));

      /* Loop through the feature_category__c records creating a selectOption
         for each result with the record ID as the value and the name as the label 
         displayed in the selectList */
      for (Reason_Stage__c rs : [select name from Reason_Stage__c order by Name]){
        optionList.add(new SelectOption(rs.name,rs.name));
      }
      return optionList;     
    }
    
    /* Invoke the standard controller save method which returns the pageReference class 
           that will be used in the navigation, i.e. send the user to the expected location based on
           standard navigation rules provided by salesforce.com. Modified to save the downdown values. */
    public PageReference save() {
        
        o.stagename = this.stage;
        o.reason__c = this.reason;
        o.industry_group__c = this.industry;
        o.industry_subgroup__c = this.industry_subgroup;
        PageReference p = controller.save();
        
        /* Return the page reference generated by the standard controller save, which usually drops the user
           on the detail page for the newly created object. */
        return p;   
    }
    
    /* Used on the edit page to populate the dropdowns with their respective database values. Only references
        the needed dropdown fields to increase performance */
    public void initializeDropdowns() {
        opp = [select id, reason__c, stagename, industry_group__c, industry_subgroup__c 
                from Opportunity where id = :ApexPages.currentPage().getParameters().get('id') limit 1];
        this.stage = opp.stagename;
        this.industry = opp.industry_group__c; 
        this.industry_subgroup = opp.industry_subgroup__c; 
        this.reason = opp.reason__c;
    }
    
    /* Method used to reset all checkboxes to a non-checked value. New checkboxes must be added below. */
    public PageReference deselectCheckboxes()  { 
      o.Competition_True__c = false;
      return null;
    }

/* BEGIN TEST METHODS FOR ABOVE CLASS */
    /* ================================== */
    public static testMethod void OppControllerTest() {
        Opportunity o = setupTestOpportunity();
        ApexPages.StandardController con = new ApexPages.StandardController(new Opportunity());
        Test.startTest();
        OppControllerExtension ext = new OppControllerExtension(con);
        PageReference result = ext.save();
        Test.stopTest();
    }

 private static Opportunity setupTestOpportunity() {

        /* Create an account */
        Account a = new Account();
        a.name    = 'TEST';
        Database.insert(a);
        
  /* Setup a basic opportunity */
        Opportunity o  = new Opportunity();
        o.Name         = 'TEST';
        o.AccountId    = a.id;
        o.CloseDate    = Date.today();
        o.Stagename    = 'Quote lost';
                
        /* Create the opportunity */
        Database.insert(o);
        
        system.debug(a.id);
        
        /* Set the request parameter that the constructor for quoteExt is expecting */
        PageReference pref = Page.DynamicInsuredNew;
        pref.getParameters().put('oppid',o.id);
        Test.setCurrentPage(pref);

        return o;
        
 }

}


Message Edited by Mycodex on 09-03-2008 02:07 PM
  • September 03, 2008
  • Like
  • 0
I have a series of checkboxes on a visualforce page I created. I have one master checkbox that when it is checked, it deselects all the checkboxes below it. Here is the code for the master checkbox:

Code:
<apex:page standardController="Opportunity" extensions="OppControllerExtension" sidebar="true">
...
<apex:pageBlockSectionItem > <apex:outputLabel value="1. Does our agent currently control the business—" for="agent_controls_business"/> <apex:inputcheckbox value="{!opportunity.agent_controls_business__c}" id="agent_controls_business"> <apex:actionSupport event="onclick" rerender="thePageBlock" action="{!deselectCheckboxes}" status="status"> </apex:actionSupport> </apex:inputcheckbox> </apex:pageBlockSectionItem>

It simply runs the actionSupport component with an action of deselectCheckboxes. My extension then fires the following class

Code:
public class OppControllerExtension {

  private final Opportunity insured;
  
  public OppControllerExtension(ApexPages.StandardController stdController){
    this.insured= (Opportunity)stdController.getRecord();
  }
  
  public PageReference deselectCheckboxes()  { 
      if (insured.Competition_True__c == true) {insured.Competition_True__c = false;}
      if (insured.Know_coverage_and_pricing_details__c == true) {insured.Know_coverage_and_pricing_details__c = false;}
      if (insured.Agent_commited__c == true) {insured.Agent_commited__c = false;}
      if (insured.agent_allow_us_in_sales_process__c == true) {insured.agent_allow_us_in_sales_process__c = false;}
      if (insured.account_moved__c == true) {insured.account_moved__c = false;}
      if (insured.XL_write_other_lines_for_insured__c == true) {insured.XL_write_other_lines_for_insured__c = false;}
      if (insured.agent_hit_ratio_True__c == true) {insured.agent_hit_ratio_True__c = false;}
      return null;
  }
}

 As you can see, this is very crude. It does not account for any new checkbox fields automatically. Is there any way I can simply the deselectCheckboxes function to loop through a series of checkboxes with an id of "checkbox1" or something similar?

I could even just ignore the if statement and go straight to setting the checkboxes as false. I was just throwing this out also because I couldn't find any way to change the value of a checkbox easily on these discussion boards.


Message Edited by Mycodex on 08-20-2008 02:52 PM
Was trying to play around with the new PDF functionality of Visualforce. I found a post (http://community.salesforce.com/sforce/board/message?board.id=Visualforce&message.id=1782) that shows how to dynamically display it based on the url. When I ran the following code, I receive a File Download dialog box saying

Name: vforcetest.url=1
Type: Unknown File Type

When I save the file and then rename it from vforcetest.url=1 to vforcetest.pdf, the page opens up in Adobe Reader displaying the pdf correctly.  I've tested this both in a developer sandbox and in production along with different profiles. Has anyone run into something like this? I changed a page to renderas pdf last week and it worked fine.

Here is the code I used:


Code:
<apex:page renderAs="{!if($CurrentPage.parameters.p == null, null, 'pdf')}"> 
    <apex:pageBlock title="Some Page Block">
        <apex:pageBlockSection title="Section 1"> Text </apex:pageBlockSection>
        <apex:pageBlockSection title="Section 2"> Text </apex:pageBlockSection>
    </apex:pageBlock>
    <apex:outputLink rendered="{!$CurrentPage.parameters.p == null}" value="/apex/vforcetest—p=true" target="_blank">PDF</apex:outputLink>
</apex:page>





  • September 08, 2008
  • Like
  • 1

We are currently experiencing degraded performance in our NA6 instance.  I am curious if anyone else is having these issues.  The most invasive issues occurred (is still occurring) today 2/18/2011 surrounding our AsyncApexJobs.  We have gone from these jobs being run in a few seconds to more than 10 hours on some and an average of 2 hours on the rest.  There has been no code or configuration changes on our part.

I am working with L3 support right now and will report what they find, but would like to hear if any of the community has experienced something similar.



Hi,

 

I just installed Salesforce for outlook to try it.

I'm able to send and add an email to a contact but on received or sent email that I tried, I always have the

"The email did not contain any useable content." message.

 

Is there something I do wrong?

 

Thanks,

 

 

Hi,

Is there a similar Select Case construct in Apex? I use this Select Case construct from .Net platform as an example.

Please advice. Thanks

 

Select

  statement1..

End Select

Case

  • August 05, 2010
  • Like
  • 0

I'm working in a Developer Edition org in which the new UI theme is enabled. When I create a VF page like this:

 

<apex:page standardController="Contact" tabStyle="Contact">
<apex:form >
<apex:sectionHeader title="{!contact.Name}" subTitle="Contact"/>
<apex:pageBlock title="Details">
  <apex:pageBlockSection title="Basic Information" columns="2">
    <apex:outputField value="{!contact.FirstName}" />
    <apex:outputField value="{!contact.Phone}" />
  </apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 

the page renders using the old theme -- it has purple borders and pageBlockSection bars. How do I get these components to render using the new UI theme?

This should be an easy one but it doesn't seem to be in the documentation:

 

When executing a hard delete with the bulk api dataloader command line, what is the right syntax?

 

<entry key="process.operation" value="hard delete"/> - this throws an error. As does 'Hard Delete' and 'harddelete.'  So I'm not quite sure what to put.  Regular 'delete' works just fine.

 

Thanks!

I'm having trouble sending out an email message if I use an adderror. I've read in the apex docs that its not processing since the adderror does not allow the tranaction to commit. Knowing this is the case, what alternatives do I have?

 

Ultimately, I want to prevent a user from deleting a contact when there are licenses and I also want to be notified that the action has taken place. I think I might have to get creative for this. Here is the trigger I have so far:

 

 

trigger PreventDelete on Contact (before delete) {
for (License__c l : [select contact__c from license__c
where contact__c in :Trigger.oldMap.keySet()]) {

//Setup email and send
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {'email@acme.com'};
mail.setToAddresses(toAddresses);
mail.setReplyTo('emaiL@acme.com');
mail.setSenderDisplayName('Salesforce Support');
mail.setSubject('Contact Deletion Attempted');
mail.setBccSender(false);
mail.setUseSignature(false);
mail.setPlainTextBody('A contact delete was attempted.');
mail.setHtmlBody('Review contact for deletion<p>'+
' View license<a href=https://na5.salesforce.com/l.id>click here</a>');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

Trigger.oldMap.get(l.contact__c).addError('Contact has licenses attached. Support has been notified.');
}
}

 

 

 

email@acme

 Hi All,

 

I have this opportunity object for which many record types have been defined.
When user clicks on opportunity tab and then new opportunity button , it prompts for record type selection where as when user clicks on new opportunity button from the related list on account detail page , it takes the default record type value and doesn't prompt user.

I want to prompt user to choose a record type even when coming from account detail page. I have looked at profile record type setting and my personal record type setting has the checkbox unchecked.

Any idea why is it happening ? Is it because opportunity object has trigger defined on it?

I have the contract object for which record type prompt is always happending even though all record type settings are same as for opportunity object but contract doesn't have any trigger defined for it.

I am really baffled over it , and help would be greatly appreciated .

Thanks in advance.

 

 

  • January 29, 2010
  • Like
  • 0

Our company uses four types of contracts and there can only be one of each type. i would like to create a picklist that only displays the available values. I can display all of the active types but how would I receive the inverse of this list.

 

For example, if the account already has Type 1 and Type 2 contracts then only Type 3 and Type 4 should be available in the dropdown.  Here is what I have so far.

 

 

public List<SelectOption> getAllContractTypes() { List<SelectOption> ContractTypes = new List<SelectOption>(); ContractTypes.add(new SelectOption('Type 1','Type 1')); ContractTypes.add(new SelectOption('Type 2','Type 2')); ContractTypes.add(new SelectOption('Type 3','Type 3')); ContractTypes.add(new SelectOption('Type 4','Type 4')); return ContractTypes; } public List<SelectOption> getActiveTypes() { List<SelectOption> options = new List<SelectOption>(); for (contract co : [SELECT Contract_Type__c FROM Contract WHERE Accountid =
:ApexPages.currentPage().getParameters().get('ctrc7') AND Active__c=TRUE]) { options.add(new SelectOption(co.Contract_Type__c,co.Contract_Type__c)); } return ActiveTypes; }

 

 

 

Can some one help me in Validating SSN Number
  • November 23, 2009
  • Like
  • 0

I have a very simple Batch class and I am trying to write a unit test to cover it but the execute method in this batch class is never executing. I'm stumped.

 

Batch Class:

global class ideaCleanBatch implements Database.Batchable<sObject>{

global Database.QueryLocator start(Database.BatchableContext bc){
//We want to process all Ideas
return Database.getQueryLocator('select Id from Idea');
}

global void execute(Database.BatchableContext bc, List<sObject> objects){
Set<Id> ideaIds = new Set<Id>();
for(sObject s : objects){
Idea i = (Idea)s;
ideaIds.add(i.Id);
}
//Send ideas to ideaClean for processing
ideaClean.recalcNumbers(ideaIds);
}

global void finish(Database.BatchableContext bc){
system.debug('All done.');
}
}

Test Method:

static testMethod void ideaBatchTest(){
List<Idea> ideas = new List<Idea>();
Id communityId = [select Id from Community limit 1].Id;
for(Integer i = 0; i < 200; i++){
ideas.add(new Idea(Title = 'myIdea' + i, CommunityId = communityId));
}
insert ideas;

Test.startTest();
ideaCleanBatch job = new ideaCleanBatch();
ID batchprocessid = Database.executeBatch(job);
Test.stopTest();
}

Coverage:

 

Thanks,

Jason

 

  • October 30, 2009
  • Like
  • 0

I have been trying to duplicate an org from some test accounts.

 

I've made some records and a custom field etc... in the first org. The second org is blank.

 

 

I've connected to the 1st org using Force.com eclipse... pulled in ALL required apex,classes,objects... ticked the whole lot.

 

then I tried deploying to the second org... I've had to change a few things like user of the org to this user.... but there are other errors which are stopping deployment...

 

in particular reports...

 

Please can anyone help me clone the data structure, schema and data from one ORG to another?

 

 

 

*** Deployment Log ***
Result: FAILED
Date: 29 May 2009 14:07:43 BST

# Deployed From:
   Project name: Test org1
   Username: *****@XXX.com
   Endpoint: www.salesforce.com

# Deployed To:
   Username: ****@hotmail.com
   Endpoint: www.salesforce.com

# Deploy Results:
   File Name:    reports/TEST1-meta.xml
   Full Name:  TEST1
   Action:  NO ACTION
   Result:  FAILED
   Problem: Not in package.xml

   File Name:    reports/TEST1/TEST1.report
   Full Name:  TEST1/TEST1
   Action:  NO ACTION
   Result:  FAILED
   Problem: Cannot find folder:TEST1

   File Name:    workflows/Account.workflow
   Full Name:  Account.TEST1
   Action:  NO ACTION
   Result:  FAILED
   Problem: In field: recipient - no User named rob.lone@pixpaycard.com found

   File Name:    layouts/Account-Account %28Marketing%29 Layout.layout
   Full Name:  Account-Account %28Marketing%29 Layout
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    layouts/Account-Account %28Sales%29 Layout.layout
   Full Name:  Account-Account %28Sales%29 Layout
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    layouts/Account-Account %28Support%29 Layout.layout
   Full Name:  Account-Account %28Support%29 Layout
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    layouts/Account-Account Layout.layout
   Full Name:  Account-Account Layout
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    layouts/TEST1__c-TEST1 Layout.layout
   Full Name:  TEST1__c-TEST1 Layout
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objectTranslations/TEST1__c-en_US.objectTranslation
   Full Name:  TEST1__c-en_US
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/Account.object
   Full Name:  Account.Active__c
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/Account.object
   Full Name:  Account.CustomerPriority__c
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/Account.object
   Full Name:  Account.NumberofLocations__c
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/Account.object
   Full Name:  Account.SLAExpirationDate__c
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/Account.object
   Full Name:  Account.SLASerialNumber__c
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/Account.object
   Full Name:  Account.SLA__c
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/Account.object
   Full Name:  Account.TEST1__c
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/Account.object
   Full Name:  Account.UpsellOpportunity__c
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/Account.object
   Full Name:  Account
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/Account.object
   Full Name:  Account.Billing
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    objects/TEST1__c.object
   Full Name:  TEST1__c
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    package.xml
   Full Name:  package.xml
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/Admin.profile
   Full Name:  Admin
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/ContractManager.profile
   Full Name:  ContractManager
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/Custom%3A Marketing Profile.profile
   Full Name:  Custom%3A Marketing Profile
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/Custom%3A Sales Profile.profile
   Full Name:  Custom%3A Sales Profile
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/Custom%3A Support Profile.profile
   Full Name:  Custom%3A Support Profile
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/CustomerManager.profile
   Full Name:  CustomerManager
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/MarketingProfile.profile
   Full Name:  MarketingProfile
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/Partner.profile
   Full Name:  Partner
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/ReadOnly.profile
   Full Name:  ReadOnly
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/SolutionManager.profile
   Full Name:  SolutionManager
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/Standard.profile
   Full Name:  Standard
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    profiles/StandardAul.profile
   Full Name:  StandardAul
   Action:  UPDATED
   Result:  SUCCESS
   Problem: n/a

   File Name:    workflows/Account.workflow
   Full Name:  Account
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    workflows/Account.workflow
   Full Name:  Account.TEST1
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

   File Name:    workflows/TEST1__c.workflow
   Full Name:  TEST1__c
   Action:  NO ACTION
   Result:  SUCCESS
   Problem: n/a

# Test Results:
   n/a

 

 

 

I'm seeing this error relatively frequently as I attempt to upsert data to Salesforce. However, it isn't 100% repeatable - if I try to run the same batch job again it is a different set of records that fails to upsert.

Some notes on our upload process:

1. We are using multi-threading to increase upload speed.
2. We are *not* upserting the same record at the same time with multiple threads. (A given record only appears once in the batch upload process).
3. The object we are upserting to does have an Apex trigger on it - but this trigger only modifies the record being updated, so we should not run into any locking issues here.
4. The object we are upserting is included in a roll-up summary.

I'm thinking that maybe it's the parent in the roll-up summary that is being locked? Does this sound plausible?

I'll be investigating further. Just wondering if anyone else has ever run into this error...

-Greg

Message Edited by glorge on 11-12-2008 05:10 PM
  • November 13, 2008
  • Like
  • 0
Anyone out there ever do anything with processing the data in an email attachment.
Here is my scenario:  We want to create an inbound email service that receives emails from our old system, including a CSV file as an attachment.  The CSV file contains new and updated opportunity records.  I would like to be able to read the file out of the email, and process the records, doing validation and upserting them to the database.

Anyone???

Thanks in advance!
  • November 07, 2008
  • Like
  • 0