• AdamSBeal
  • NEWBIE
  • 50 Points
  • Member since 2012

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 13
    Replies
I have a class called IssueViewToCase which implements Messaging.InboundEmailHandler. It pulls info out of email and updates or creates a case. I need to get rid of this class and its associated test class because we haven't used IssueView product in a long time. I delete classes in Eclipse frequently in the past without issue. In this case I opened eclipse and choose the IssueviewToCase class and its test class meta data xml files and changed both of their status to "Deleted". Then I saved and "Deploy to Force.com Server". It finishes and says "success" but only deleted my test class and left the main IssueViewToCase class unchanged in production. No error reports just says success. I have de-activated the email service this handler uses even de-activated the email address it was using. This shouldn't be this hard very frustrating. Any ideas of what to try next?

Thanks

I have a contact field on a custom object I am exposing in a visualforce page in our customer portal. I would like it so that contacts related to the logged in portal user show only. Currently they can search all accounts which isn't cool. Any ideas on how to make this happen? 

 

Thanks!

 

Adam

I have created a new SF portal and want to allow authenticated external portal users to create contacts under their account. I can't seem to be able to get the Contacts tab to show up though for my test user. I found something which said I needed to "Delegate External User Administration" rights to my user and tried this:

 

http://login.salesforce.com/help/doc/en/customer_portal_dpua.htm#DelegatingRights

 

However, I don't see any "Delegated External User Administrator selection under the Customer Portal Manager Standard profile in my sandbox where I am testing this. I am a System Administrator there so not sure why the instructions above don't match what I am seeing. 

 

Can anyone see where I have gone wrong? How does one allow contact creation through the external portal?

 

Thanks,

 

Adam

I am passing some selected account Ids to my visualforce page in the querystring. I wish to add these to a related list in my visualforce page but I am getting an Invalid Id Error.  I am wondering if it is because my id is type string. The strange thing is when I hard code this same Id value it works. Any ideas?

Error:The following error occurred attempting to save:Invalid id: (001V000000606czIAA)

 

Here is the code:

 

String queryParamAccts = System.currentPagereference().getParameters().get('sAccts');

queryParamAccts = EncodingUtil.urlDecode(queryParamAccts, 'UTF-8');

 List<String> orderAccounts = queryParamAccts.split(',');
                 Set<Id> setAccountIds = new Set<Id>();
                 for(String s : orderAccounts)
                 {
                     setAccountIds.add(s); //error happens here
                 }

 Here is the debug log:

 

14:47:51.391 (391025000)|SYSTEM_METHOD_EXIT|[106]|System.debug(ANY)
14:47:51.391 (391095000)|SYSTEM_CONSTRUCTOR_ENTRY|[108]|<init>(Integer)
14:47:51.391 (391125000)|SYSTEM_CONSTRUCTOR_EXIT|[108]|<init>(Integer)
14:47:51.391 (391144000)|SYSTEM_METHOD_ENTRY|[109]|LIST<String>.iterator()
14:47:51.391 (391171000)|SYSTEM_METHOD_EXIT|[109]|LIST<String>.iterator()
14:47:51.391 (391184000)|SYSTEM_METHOD_ENTRY|[109]|system.ListIterator.hasNext()
14:47:51.391 (391199000)|SYSTEM_METHOD_EXIT|[109]|system.ListIterator.hasNext()
14:47:51.391 (391225000)|SYSTEM_METHOD_ENTRY|[111]|SET<Id>.add(Object)
14:47:51.391 (391287000)|EXCEPTION_THROWN|[EXTERNAL]|System.StringException: Invalid id: (001V000000606czIAA)
14:47:51.391 (391338000)|SYSTEM_METHOD_EXIT|[111]|SET<Id>.add(Object)
14:47:51.391 (391392000)|SYSTEM_METHOD_ENTRY|[132]|System.StringException.getMessage()
14:47:51.391 (391418000)|SYSTEM_METHOD_EXIT|[132]|System.StringException.getMessage()
14:47:51.391 (391487000)|SYSTEM_METHOD_ENTRY|[132]|ApexPages.addMessage(ApexPages.Message)
14:47:51.391 (391509000)|VF_PAGE_MESSAGE|The following error occurred attempting to save this order:Invalid id: (001V000000606czIAA)

I am passing some selected account Ids to my page in the querystring. I wish to add these to a list in my page but I am getting an Invalid Id Error.  I am wondering if it is because my id is type string. This is the error (The id is a valid account id): 

Error:The following error occurred attempting to save:Invalid id: (001V000000606czIAA)

 

Here is the code:

 

String queryParamAccts = System.currentPagereference().getParameters().get('sAccts');

queryParamAccts = EncodingUtil.urlDecode(queryParamAccts, 'UTF-8');

 List<String> orderAccounts = queryParamAccts.split(',');
                 Set<Id> setAccountIds = new Set<Id>();
                 for(String s : orderAccounts)
                 {
                     setAccountIds.add(s); //error happens here
                 }

 Here is the debug log:

 

14:47:51.391 (391025000)|SYSTEM_METHOD_EXIT|[106]|System.debug(ANY)
14:47:51.391 (391095000)|SYSTEM_CONSTRUCTOR_ENTRY|[108]|<init>(Integer)
14:47:51.391 (391125000)|SYSTEM_CONSTRUCTOR_EXIT|[108]|<init>(Integer)
14:47:51.391 (391144000)|SYSTEM_METHOD_ENTRY|[109]|LIST<String>.iterator()
14:47:51.391 (391171000)|SYSTEM_METHOD_EXIT|[109]|LIST<String>.iterator()
14:47:51.391 (391184000)|SYSTEM_METHOD_ENTRY|[109]|system.ListIterator.hasNext()
14:47:51.391 (391199000)|SYSTEM_METHOD_EXIT|[109]|system.ListIterator.hasNext()
14:47:51.391 (391225000)|SYSTEM_METHOD_ENTRY|[111]|SET<Id>.add(Object)
14:47:51.391 (391287000)|EXCEPTION_THROWN|[EXTERNAL]|System.StringException: Invalid id: (001V000000606czIAA)
14:47:51.391 (391338000)|SYSTEM_METHOD_EXIT|[111]|SET<Id>.add(Object)
14:47:51.391 (391392000)|SYSTEM_METHOD_ENTRY|[132]|System.StringException.getMessage()
14:47:51.391 (391418000)|SYSTEM_METHOD_EXIT|[132]|System.StringException.getMessage()
14:47:51.391 (391487000)|SYSTEM_METHOD_ENTRY|[132]|ApexPages.addMessage(ApexPages.Message)
14:47:51.391 (391509000)|VF_PAGE_MESSAGE|The following error occurred attempting to save this order:Invalid id: (001V000000606czIAA)

This is my first trigger and I am struggling with it.  I have a "OrderContract" custom object and it is attached to Account via a lookup field. I have a trigger on Opportunity that when a new opportunity is inserted if the record type is "Order" then it should do a lookup on the related account and get the OrderContract and populate that value into the related OrderContract field in the Opportunity.  Here is the code when I try to save it gives me this compile error:

 unexpected token: 'opportunityMap.get' at line 18 column 103

 

trigger SetContractOnOpportunity on Opportunity (after insert) 
{ 
  Map<Id, Opportunity> opportunityMap = new Map<Id, Opportunity>();
 
  RecordType rt = [select Id from RecordType where Name = 'Order' and SobjectType = 'Opportunity' limit 1];
 
  for (Opportunity oppNew : Trigger.new)
  {  
    if (oppNew.RecordType == rt && oppNew.Order_Contract__c != Trigger.oldMap.get(oppNew.Id).Order_Contract__c)
      opportunityMap.put(oppNew.Id, oppNew);
  }  
  
  if (opportunityMap.size() > 0)
  {  
      for (Opportunity opportunity : opportunityMap)
      {
           //pull the Order_Contract__c custom field defined on Account 
           List<Order_Contract__c> contractsList = [SELECT Order_Contract__c FROM Account where Id = opportunityMap.get(opportunity.Id).AccountId]; 
           opportunity.Order_Contract__c = contractsList;
        
      }
      update opportunityMap ;
   }
}

 

I am new at this so any help with how this trigger is wrong in general would be very much appreciated.

Thanks,

Adam

We have many types of products listed in salesforce and I would like to create an 'Orders' custom object that has fields which would vary per product that was chosen. I would like to do this declaritively if possible but not sure how to approach it. Can I do it using record types somehow? If so how would I do that? If not how would you do this?

 

Thanks,

Adam

I am creating a MassEmailMessage and attempting to send a message to a list of contactIds. This code sends the emails as long as I don't set a whatId but the template isn't filled with data from my deviceID. When I set the whatIDs I get the "Attempt to de-reference a null object". I do call this after I have done the DML insert(devicerequest) and in debugging I can see a deviceRequest.Id is there when I call mail.WhatIds.add(deviceRequestId). Here is the code any help is greatly appreciated:

 

insert(deviceRequest);
EmailTemplate emailTemplate = [SELECT id FROM EmailTemplate WHERE DeveloperName = 'Device_Request'];
Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
mail.setSenderDisplayName(senderName); 
mail.setReplyTo(senderEmail);	
						
mail.setTargetObjectIds(contactIds); 
mail.WhatIds.add(deviceRequest.Id);
		
mail.setTemplateId(emailTemplate.id); 
			
mail.saveAsActivity = false;
Messaging.sendEmail(new Messaging.MassEmailMessage[] { mail });

 

I have the following code and need to write a test for the constructor and the submitNotify method but am having a hard time trying to figure out how to do that since the server is set from a page parameter:

 

public with sharing class ServerNotificationsController {
	
    public Server__c server { get; set; } 
    public String notification {get; set;}
    public String emailBody {get; set;}
    public Boolean showFormPanel {get; set;}
    public Boolean showResultsPanel {get; set;}
    public String[] emailToList = new String[]{};     
    public String feedbackMessage {get; set;}
    public List<Contact> recipientsForDisplay = new List<Contact>{}; 
    
	
	public List<Contact> getRecipientsForDisplay() {
         return (List<Contact>) recipientsForDisplay;
    }
    
    public List<Account> accounts {
	  get {
	    if(accounts==null) {
	      accounts = [SELECT Id, (SELECT Id, Name, Email, Server_Down_Notification__c, Change_Control_Notification__c FROM Contacts) FROM Account WHERE Server__c = :server.Id AND Server__c != NULL];
	    }
	    return accounts;
	  }
	  private set;
	}
    
    private ApexPages.StandardController controller;   
	
	
	public ServerNotificationsController(ApexPages.StandardController controller) {
		this.controller = controller;
		if(server == null)
		{
			this.server = [select id, name from Server__c where id =
                       :ApexPages.currentPage().getParameters().get('id')];
		}
        this.showFormPanel = true; 
        notification = 'ServerDown';
        BuildSingleNotificationRecipientList();
	}
	
	
	 public PageReference submitNotify() {	 	
		if(emailToList.size() > 0)
		{
			Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();			
			String[] toAddresses = emailToList; 	
			mail.setToAddresses(toAddresses);			
			mail.setReplyTo('support@domain.com');
			mail.setSenderDisplayName('Support');
			
			mail.setSubject(notification + ' Notification - ' + server.Name);
			mail.setBccSender(false);
			mail.setUseSignature(false);
			
			mail.setPlainTextBody(emailBody);
			
			Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });		
			
		}
	 	this.showFormPanel = false;
       		this.showResultsPanel = true;
       		 
            return null;
     }

}
     
  

 

I am thinking the test needs to run the code in the constructor but not sure how to set the id parameter on the page and does it need to be a real object id or one I create in the test:

 

static testMethod void testServerNotificationsController () {

ApexPages.StandardController tempController = new ApexPages.StandardController(tempServer);
ServerNotificationsController serverController = new ServerNotificationsController(tempController);
System.assert(serverController.server != null);
}



I have a visual force page that creates a custom object called devicerequest which has a lookup field for a custom object named "Server". Server is a lookup on Accounts. I want to send an email to the Account Owner when someone creates a devicerequest. I have an email alert workflow setup but not sure how to get the account owners email into it or if that is even possible. Just looking for feedback as to how others would do it. 

 

Thanks!

sfdcfox helped me figure out how to get a list of accounts now I need to get a list of contacts from that list. I don't even have a code sample to kick this off because I can't figure out the best way to do it short of iterating through each account in the account list then building up a master list of its contacts. Does that sound like the approach to use or is there some kind of SOQL I can do against the accounts list I have?

I have a custom object called Server which has related list of Accounts (many accounts per server). I am trying to build a list of the accounts from a visual force controller doing something like this:

 

public List<Account> getAccounts() {

if(accounts == null) accounts = [SELECT (SELECT Id FROM Accounts__r) FROM Server__c WHERE Id = server.Id];

return accounts;

}

 

A couple of problems here the first being it doesn't like the server.Id line in the SOQL. The controller has a Server set and there is a value it just doesn't like the syntax I am using. I am wondering if someone could tell me how to put a dynamic value like that in SOQL like this above. 

 

My second issue is I get back an account related list but need to populate that into a list of accounts. Any thoughts on that? The syntax I have doesn't work I get an error saying "Illegal assignment from LIST<Server__c> to LIST<Account>

 

Thanks!

I created a simple inline VF page that does a window.open if there is anything in a custom field called Alerts on our Account Object. It opens another Visual Force page in the window.open which simply displays the important alert for the user.

 

This worked great on the sandbox no issues at all but on production when the window opens it has a bar at the bottom with an 'X' like symbol that says "VisualForce Development Mode Tools" on it. Next to that is a button with the name of the visual force page "AccountAlertPop" and another button next to that with the name of the Apex Controller. If I click on these then the actual source code loads up in the popup window.

 

Why is this showing up and how do I get rid of it? 



I notice that on standard pages and on my visual force page long text area type fields seem to wrap at around 30 characters. I assume so they can fit it in multi-column views but I am just trying to display the field as an outputfield in Visual Force and don't want to to wrap on my VF page. Any ideas?

I have a custom field on accounts called "AccountAlerts" which may have a value in it but most times will not. I want to display that value prominently for customer service reps if it is there in the Contacts standard page layout at the top of the page. I created a visual force page to show the alert and I can hide it if it isn't there but the space is still taken up in the standard layout page when it is invisible since salesforce forces you to specify the height in pixels for the section. 

 

My question is there some way in Javascript or somehow to hide a section completely if it is not needed? I saw this sample on another thread but not sure how to get the id of a page layout section or even if it would work:

 

  document.getElementById('id').style.display = 'none';// Does not show the section.

 

Thanks! 

 

Adam

We have a Long Text Area custom field on Account called "Account Notes" would like to display that on page layout of Contacts related to that Account but can't figure out how to do so. I attempted to use a forumla field to display it but Long Text Area fields aren't allowed there so I am stuck. Any ideas on how to do this would be much appreciated. 

 

Thank you!

I have a contact field on a custom object I am exposing in a visualforce page in our customer portal. I would like it so that contacts related to the logged in portal user show only. Currently they can search all accounts which isn't cool. Any ideas on how to make this happen? 

 

Thanks!

 

Adam

I have no idea what is causing this, but...

 

I used to be able to go to Apex Classes, and then  click the link that showed what percent of the code has been tested. Once clicked I could see in red what hasn’t been tested. Now when I do it, a blank page comes up and I have no idea what needs to be tested.

 

Any ideas?.... I have logged out/ logged in multiple times same issue. Tried in IE and Firefox.

 

I am passing some selected account Ids to my visualforce page in the querystring. I wish to add these to a related list in my visualforce page but I am getting an Invalid Id Error.  I am wondering if it is because my id is type string. The strange thing is when I hard code this same Id value it works. Any ideas?

Error:The following error occurred attempting to save:Invalid id: (001V000000606czIAA)

 

Here is the code:

 

String queryParamAccts = System.currentPagereference().getParameters().get('sAccts');

queryParamAccts = EncodingUtil.urlDecode(queryParamAccts, 'UTF-8');

 List<String> orderAccounts = queryParamAccts.split(',');
                 Set<Id> setAccountIds = new Set<Id>();
                 for(String s : orderAccounts)
                 {
                     setAccountIds.add(s); //error happens here
                 }

 Here is the debug log:

 

14:47:51.391 (391025000)|SYSTEM_METHOD_EXIT|[106]|System.debug(ANY)
14:47:51.391 (391095000)|SYSTEM_CONSTRUCTOR_ENTRY|[108]|<init>(Integer)
14:47:51.391 (391125000)|SYSTEM_CONSTRUCTOR_EXIT|[108]|<init>(Integer)
14:47:51.391 (391144000)|SYSTEM_METHOD_ENTRY|[109]|LIST<String>.iterator()
14:47:51.391 (391171000)|SYSTEM_METHOD_EXIT|[109]|LIST<String>.iterator()
14:47:51.391 (391184000)|SYSTEM_METHOD_ENTRY|[109]|system.ListIterator.hasNext()
14:47:51.391 (391199000)|SYSTEM_METHOD_EXIT|[109]|system.ListIterator.hasNext()
14:47:51.391 (391225000)|SYSTEM_METHOD_ENTRY|[111]|SET<Id>.add(Object)
14:47:51.391 (391287000)|EXCEPTION_THROWN|[EXTERNAL]|System.StringException: Invalid id: (001V000000606czIAA)
14:47:51.391 (391338000)|SYSTEM_METHOD_EXIT|[111]|SET<Id>.add(Object)
14:47:51.391 (391392000)|SYSTEM_METHOD_ENTRY|[132]|System.StringException.getMessage()
14:47:51.391 (391418000)|SYSTEM_METHOD_EXIT|[132]|System.StringException.getMessage()
14:47:51.391 (391487000)|SYSTEM_METHOD_ENTRY|[132]|ApexPages.addMessage(ApexPages.Message)
14:47:51.391 (391509000)|VF_PAGE_MESSAGE|The following error occurred attempting to save this order:Invalid id: (001V000000606czIAA)

I am passing some selected account Ids to my page in the querystring. I wish to add these to a list in my page but I am getting an Invalid Id Error.  I am wondering if it is because my id is type string. This is the error (The id is a valid account id): 

Error:The following error occurred attempting to save:Invalid id: (001V000000606czIAA)

 

Here is the code:

 

String queryParamAccts = System.currentPagereference().getParameters().get('sAccts');

queryParamAccts = EncodingUtil.urlDecode(queryParamAccts, 'UTF-8');

 List<String> orderAccounts = queryParamAccts.split(',');
                 Set<Id> setAccountIds = new Set<Id>();
                 for(String s : orderAccounts)
                 {
                     setAccountIds.add(s); //error happens here
                 }

 Here is the debug log:

 

14:47:51.391 (391025000)|SYSTEM_METHOD_EXIT|[106]|System.debug(ANY)
14:47:51.391 (391095000)|SYSTEM_CONSTRUCTOR_ENTRY|[108]|<init>(Integer)
14:47:51.391 (391125000)|SYSTEM_CONSTRUCTOR_EXIT|[108]|<init>(Integer)
14:47:51.391 (391144000)|SYSTEM_METHOD_ENTRY|[109]|LIST<String>.iterator()
14:47:51.391 (391171000)|SYSTEM_METHOD_EXIT|[109]|LIST<String>.iterator()
14:47:51.391 (391184000)|SYSTEM_METHOD_ENTRY|[109]|system.ListIterator.hasNext()
14:47:51.391 (391199000)|SYSTEM_METHOD_EXIT|[109]|system.ListIterator.hasNext()
14:47:51.391 (391225000)|SYSTEM_METHOD_ENTRY|[111]|SET<Id>.add(Object)
14:47:51.391 (391287000)|EXCEPTION_THROWN|[EXTERNAL]|System.StringException: Invalid id: (001V000000606czIAA)
14:47:51.391 (391338000)|SYSTEM_METHOD_EXIT|[111]|SET<Id>.add(Object)
14:47:51.391 (391392000)|SYSTEM_METHOD_ENTRY|[132]|System.StringException.getMessage()
14:47:51.391 (391418000)|SYSTEM_METHOD_EXIT|[132]|System.StringException.getMessage()
14:47:51.391 (391487000)|SYSTEM_METHOD_ENTRY|[132]|ApexPages.addMessage(ApexPages.Message)
14:47:51.391 (391509000)|VF_PAGE_MESSAGE|The following error occurred attempting to save this order:Invalid id: (001V000000606czIAA)

This is my first trigger and I am struggling with it.  I have a "OrderContract" custom object and it is attached to Account via a lookup field. I have a trigger on Opportunity that when a new opportunity is inserted if the record type is "Order" then it should do a lookup on the related account and get the OrderContract and populate that value into the related OrderContract field in the Opportunity.  Here is the code when I try to save it gives me this compile error:

 unexpected token: 'opportunityMap.get' at line 18 column 103

 

trigger SetContractOnOpportunity on Opportunity (after insert) 
{ 
  Map<Id, Opportunity> opportunityMap = new Map<Id, Opportunity>();
 
  RecordType rt = [select Id from RecordType where Name = 'Order' and SobjectType = 'Opportunity' limit 1];
 
  for (Opportunity oppNew : Trigger.new)
  {  
    if (oppNew.RecordType == rt && oppNew.Order_Contract__c != Trigger.oldMap.get(oppNew.Id).Order_Contract__c)
      opportunityMap.put(oppNew.Id, oppNew);
  }  
  
  if (opportunityMap.size() > 0)
  {  
      for (Opportunity opportunity : opportunityMap)
      {
           //pull the Order_Contract__c custom field defined on Account 
           List<Order_Contract__c> contractsList = [SELECT Order_Contract__c FROM Account where Id = opportunityMap.get(opportunity.Id).AccountId]; 
           opportunity.Order_Contract__c = contractsList;
        
      }
      update opportunityMap ;
   }
}

 

I am new at this so any help with how this trigger is wrong in general would be very much appreciated.

Thanks,

Adam

I am creating a MassEmailMessage and attempting to send a message to a list of contactIds. This code sends the emails as long as I don't set a whatId but the template isn't filled with data from my deviceID. When I set the whatIDs I get the "Attempt to de-reference a null object". I do call this after I have done the DML insert(devicerequest) and in debugging I can see a deviceRequest.Id is there when I call mail.WhatIds.add(deviceRequestId). Here is the code any help is greatly appreciated:

 

insert(deviceRequest);
EmailTemplate emailTemplate = [SELECT id FROM EmailTemplate WHERE DeveloperName = 'Device_Request'];
Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
mail.setSenderDisplayName(senderName); 
mail.setReplyTo(senderEmail);	
						
mail.setTargetObjectIds(contactIds); 
mail.WhatIds.add(deviceRequest.Id);
		
mail.setTemplateId(emailTemplate.id); 
			
mail.saveAsActivity = false;
Messaging.sendEmail(new Messaging.MassEmailMessage[] { mail });

 

I have a custom object called Server which has related list of Accounts (many accounts per server). I am trying to build a list of the accounts from a visual force controller doing something like this:

 

public List<Account> getAccounts() {

if(accounts == null) accounts = [SELECT (SELECT Id FROM Accounts__r) FROM Server__c WHERE Id = server.Id];

return accounts;

}

 

A couple of problems here the first being it doesn't like the server.Id line in the SOQL. The controller has a Server set and there is a value it just doesn't like the syntax I am using. I am wondering if someone could tell me how to put a dynamic value like that in SOQL like this above. 

 

My second issue is I get back an account related list but need to populate that into a list of accounts. Any thoughts on that? The syntax I have doesn't work I get an error saying "Illegal assignment from LIST<Server__c> to LIST<Account>

 

Thanks!

I created a simple inline VF page that does a window.open if there is anything in a custom field called Alerts on our Account Object. It opens another Visual Force page in the window.open which simply displays the important alert for the user.

 

This worked great on the sandbox no issues at all but on production when the window opens it has a bar at the bottom with an 'X' like symbol that says "VisualForce Development Mode Tools" on it. Next to that is a button with the name of the visual force page "AccountAlertPop" and another button next to that with the name of the Apex Controller. If I click on these then the actual source code loads up in the popup window.

 

Why is this showing up and how do I get rid of it? 



We have a Long Text Area custom field on Account called "Account Notes" would like to display that on page layout of Contacts related to that Account but can't figure out how to do so. I attempted to use a forumla field to display it but Long Text Area fields aren't allowed there so I am stuck. Any ideas on how to do this would be much appreciated. 

 

Thank you!