• mikef
  • SMARTIE
  • 623 Points
  • Member since 2004

  • Chatter
    Feed
  • 24
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 24
    Questions
  • 395
    Replies

Hello everyone,

 

I'm trying to write a trigger that will only fire when a particular field is updated on an object. Not when any other field is modified. is something like this possible in APEX?

 

Any help is greatly appreciated, thanks!

-Jon

Is there any way to retrieve a WRITEABLE reference to an SObject field at runtime?

 

Yes, I've seen all of the Schema.DescribeFieldResult stuff, and it's dandy if you want a READ-ONLY reference to the object metadata, but I was hoping to find a way to remap data from an existing Salesforce standard / default field into a set of user-defined custom fields.

 

What I'd like to do is pass in two field names at runtime and have the code-behind read the value from the first field and write it to the second field -- for purposes of illustration, something like:

 

    String data = Account.[field1];

    Account.[field2] = data;

 

Does anyone have a clue about how to do this?  I could hard-code a bunch of select statements into a bunch of methods, but I'd prefer to have a general-purpose reusable solution.

 

Jerry H.

 

  • December 09, 2010
  • Like
  • 0

I am creating a button on a home page which wud take me to  VF PAGE which shows a Case record in a particular Queue.

I created a button "Accept" and when we click the button it shud get redirected to that case.i am able to get the record on the VF page but however not able to redirect to that record from the VF  Page

 

when iam trying to click Accpet button it takes me toURL which has both record type id and id ...but i juss need id from the queue

 

Here is the code..

public class Getnextcase {

  


   public PageReference Accept() {
    List<Case>cas;
    id caseid;
  cas = [Select id from case c where ownerid=:'00G30000000lZ39' limit 1];
  
    string url = 'https://cs1.salesforce.com/';
    url+=Cas ;
   
    PageReference nextpage = new pagereference( url);
        return nextpage;
        
    }


   

 

    
    List<Case> Cases;
    public List<Case> getCases(){
    Cases = [Select id,casenumber,account.name,contact.name,CreatedDate,Subject,Status from case where Ownerid=:'00G30000000lZ39' order by CreatedDate ASC limit 1];
    return cases;
}
}

 

 

We have a business rule, that if 1st Opportunity created under the Account has a Primary Campaign Source set to a certain Campaign, then every opportunity after has to have save Primary Campaign Source.

Issue is, sales people forget to enter that, or don't bother looking it up, if they are in a rush.

So I need a trigger, that looks up 1st Opportunity under the Account (which is set to Type = New Business) and copies the Primary Campaign Source from that Opportunity, to any subsequent Opportunities under the same Account.

How do I go about doing that?

I have a trigger that is creating recurring events based on the number of hours specificed for a specific month.  For example, the trigger fires and queries a record that indicates there are 40 hours in January.  My trigger logic would create a recurring event for 5 days because there are 8 hours in a day and 5 working days X 8 hours is 40 hours.

 

The trick is I can only create the events on actual workdays (not weekends Saturday and Sunday) and lets I am in December 2010, but the record entry is for January 2011.  I need to obtain the 2011 year and not 2010.

 

Can anyone provide some help on how I can correctly calculate the recurrencestartdatetime for the event and the RecurrenceEndDateOnly?

 

My trigger is creating the recurring events, but the startDates are off and the endDate is not correct for the series.  I'm not clear on how to properly calculate these dates.

 

Additionally, all I have to work with from the record is the month index...i.e. Jan = 1, Feb = 2, March = 3, etc.

 

Here is my code:

 

private static void doCreateResourceEvents(List<ProductManagement__c> inNew, Map<Id, ProductManagement__c> inOld)
    {
    	RecordType rt = [Select Id From RecordType Where Name = 'Service Delivery Event' and sObjectType = 'Event'];
    	
    	List<Scheduling__c> schedulingNew = [Select Hours__c, Month_Index__c, Resource__r.Id, Resource__r.User_Id__c, ProductManagement__r.Id From Scheduling__c Where ProductManagement__c in: inNew];
				
		List<Event> evs = new List<Event>();
	
		for (Scheduling__c s : schedulingNew) {
						
			if (s.Hours__c != null && s.Resource__r.User_Id__c != null 
				&& s.Resource__r.Id != inOld.get(s.ProductManagement__r.Id).Res1__c 
				&& s.Resource__r.Id != inOld.get(s.ProductManagement__r.Id).Res2__c 
				&& s.Resource__r.Id != inOld.get(s.ProductManagement__r.Id).Res3__c 
				&& s.Resource__r.Id != inOld.get(s.ProductManagement__r.Id).Res4__c 
				&& s.Resource__r.Id != inOld.get(s.ProductManagement__r.Id).Res5__c) {
				Integer recurrenceInterval = math.round(s.Hours__c / 8);
				Integer mnth = math.round(s.Month_Index__c);
				Integer endDay = system.today().day() + recurrenceInterval;
				Datetime startDate = Datetime.newInstance(system.today().year(), mnth, system.today().day(), 8, 0, 0);
				Date endDate = Date.newInstance(system.today().year(), mnth, endDay);
				

				Event e = new Event();
				e.IsRecurrence = true;
				e.RecurrenceDayOfWeekMask = 62;
				e.RecurrenceType = 'RecursEveryWeekday';
				e.OwnerId = s.Resource__r.User_Id__c;
				e.RecordTypeId = rt.Id;
				e.Subject = 'Other';
				e.RecurrenceStartDateTime = startDate;
				e.RecurrenceEndDateOnly = endDate;
				e.DurationInMinutes = 60;
				evs.add(e);
				
			}
			
		}
    	insert evs;
    }	

 

Thanks for any help.

Greetings,

 

Any idea why i can't send Email? my code below

 

Class Code:

 

public class EmailMessage
{  
   public static void SendEmail()
   {
       System.debug('Sending Email...');
       Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
       String[] toAdd = new String[]{'m*******','l*******com','t******.com'};
       mail.setToAddresses(toAdd);
       mail.setReplyTo('ke****.com');
       mail.setSenderDisplayName('Salesforce Notification');
       mail.setSubject('Duplicating Account Name');
       mail.setBccSender(false);
       mail.setUseSignature(false);
       mail.setPlainTextBody('Some user attempts to duplicate you Account Name.');
       List<Messaging.SendEmailResult> results = Messaging.sendEmail(new Messaging.Email[] { mail });
       System.debug('Email Sent: '+results.get(0).isSuccess() );
    }
}

 Trigger Code:

 

trigger ErrorDuplicateOutput on Account (before insert, before update)
{
  List<Account> accList =new List<Account>();
  Set<String> b = new Set<String>();
  accList = [Select Name FROM Account];
  
  for (Account acc : accList)
  {
   b.add(acc.Name);
  }
  
  for(integer x = 0; x < Trigger.new.size(); x++)
  {
      if(b.contains(Trigger.new[x].name))
      {
          Trigger.new[x].addError('Error:Account name already exist!');
          EmailMessage.SendEmail();
      }
  }
}

 

Any ideas are welcome, thank you!

S-L

 

 

Any idea on how I could make this trigger fire to another field if the 1st field is full?

 

I have a custom object called Quote_Ocean_Container__c that is a Master-Detail to the Quote and I'm unable to create a workflow to update the custom field on the quote.  Whenever a record is created in the Quote_Ocean_Container__c, the trigger will combine to fields and update a custom field on the Quote called "Container_1__c". 

 

However, if Container_1__c is already filled in, I want the trigger to update Container_2__c, and if that is filled in, then update Container_3__c and so on.  There are 6 Container fields.

 

Thanks in advance for any guidance or advise.

 

 

Trigger UpdateQuoteContainer1 on Quote_Ocean_Container__c(after insert, after update)

{

Set<Id> ids = trigger.newmap.keySet();

List<Quote_Ocean_Container__c> quocon=[select Quote__r.Container_1__c, Number_Required__c, Container_Type__c, from  Quote_Ocean_Container__c where id IN :ids];

List<Quote> updateQuote=new List<Quote>();

For(Quote_Ocean_Container__c Quocon:quo)

{

Quocon.Quote__r.Ocean_Container__c=Quocon.Number_Required__c + '-' + '  ' + Quocon.Container_Type__c;

updateQuote_Ocean_Container__c.add(Quocon.Quote__r);

}

Update updateQuote_Ocean_Container__c;

}

Hi,

Sorry if this is a stupid question but can you not group your apex classes into packages like you can in Java?

I use the Eclipse IDE plugin and it allows you to create a folder under src/classes but I can't create any apex classes in the subfolder...

Hi All,

 

I have a visualforce page that has delete command button. My code as follows.

 

<apex:commandButton action="{!delete}" value="Delete"/>

 

When I click on delete button on the page, it is not deleting the record. Could anyone please let me know how can I make delete button work? Your help is greatly appreciated.

 

 

  • October 25, 2010
  • Like
  • 0

I have a trigger using a variable that is the value of an equation that I need to get the absolute value of.  I can't seem to get the code to compile.  Here's the error I get and my code:

 

Error: Compile Error: Method does not exist or incorrect signature: ABS(Double) at line 32 column 32

 

 

Decimal DiscountDiff1 = null; Decimal DiscountDiff2 = null; Opportunity O = [select Id, Discount_Rollup__c, Max_Discount__c, Discount_Approved__c, SA_Discount__c, Account.Strategic_Account_Designation__c from Opportunity where Id = :OLI.OpportunityId LIMIT 1]; DiscountDiff1 = ABS (OLI.Discount__c - O.SA_Discount__c); DiscountDiff2 = ABS (O.SA_Discount__c - OLI.Discount__c);

 

OLI.Discount__c  & O.SA_Discount__c are both decimal (percent) fields.

 

 

 

Any help would be appreciated!

I am developing a custom search page based on the Contact object.
At the moment, the search is recognizing empty search fields as having a blank value, so if the search field is left blank the results only show records that have a blank value in the field.
I need it to work so that, essentially if the search field is left blank, the search ignores it and shows results for all values.
I hope that makes sense. Any help would be greatly appreciated.
Controller Code: 

public with sharing class contactSearchExtension { public contactSearchExtension(ApexPages.StandardSetController controller) { } public contactSearchExtension(ApexPages.StandardController controller) { } public String getName() { return null; } public String getState() { return null; } public List<Contact> result = new List<Contact>(); private String Name; private String State; public contactSearchExtension(){ } public List<Contact> getResult() { return result; } public void setName(String Name) { this.Name = Name; } public void setState(String State) { this.State = State; } public void search() { String queryName = '%' + Name + '%'; String queryState = '%' + State + '%'; result = [ SELECT Account.Name, Name, MailingState FROM Contact WHERE Account.Name like :queryName AND MailingState like :queryState]; } }

 

Message Edited by Doctor on 01-12-2010 02:44 PM
  • January 12, 2010
  • Like
  • 0

Hello Friends,

how do i get the username from ownerid,do i query the user table with id matching with the

owner id

regards

hegdek

I'm going to break down what i'm doing into a very simple example. Basically, I'm getting a value and testing to see if the value equivalent to another value.

 

Account MySobject = [Select a.id, a.AM_Last_Connect_Amplifi__c, a.name from Account a where a.id = '001T000000ELK88']; Sobject s= MySobject; Sobject delegate = s; Schema.SobjectField f; Schema.DescribeSObjectResult objDescribe = delegate.getSobjectType().getDescribe(); f = objDescribe.fields.getmap().get(MyDate__c); system.debug('Current Value: ' + delegate.get(f)); Object Test = delegate.get(f); system.debug('Value in Test: ' + Test); date dTest = date.valueof(Test); system.debug('Value of dTest: ' + dTest); system.debug('Conditional: ' + dtest == dtest);

 

 

So basically here's what I want to do. Eventually I want to compare the value set in f to a different value. I attempted a completely different date field -- but that didn't work. I figured the simpliest conditional would be to see if dtest is the equivalent to itself (I would think it would be!).

 

What happens: commenting out the conditional debug I see:

 

Current value = 2009-12-07 00:00:00

Value in Test = 2009-12-07 00:00:00

Value of dtest = 2009-12-07 00:00:00

 

so here I've confirmed that value is the same in all 3 items -- including the item where I convert the Object value into a date (dtest).

 

Adding the conditional back I get the following error:

"Comparison arguments must be compatible types: String, Date"

 

Huh? My arguments are the same item! I would expect to get true. How is dTest being treated as a string and as a date?

 

I've also created a different variablel: "date vTest = date.today();" and attempted to compare dTest with vTest. both with are date variables -- and I'll get the same error.

 

Thoughts? What am I doing wrong?

 

Hey guys,

 

In our sandbox, I've created a Visualforce/Apex/email combo that provides users with a button to send an email to the owner of a record requesting ownership of that record. The button sits on the record page and, when pressed, the UI navigates to a new page where the user cancels or confirms the request. Upon confirmation, the controller calls a class/method that sends an email to the owner of the record (or an administrator, if the user is not active) requesting the transfer.

 

I'm unable to deploy the code to the production instance of our Salesforce. I believe this because I use the setTemplateId() method to inform the apex which template to use.

 

Is there a way to ensure the id of the deployed template matches the id of the template in the sandbox? Alternatively, is there a way for the apex to select a template based upon template name?

 

I cannot write the code in the production instance, as it has to have test coverage, surely?

 

How are we supposed to write apex that sends emails and uses templates? Am I being really stupid?

 

With thanks,

Andy

Here's my code.

 

Visual Force:

 

<apex:page controller="sendEmail" tabStyle="Inspection__c"> <apex:messages /> <apex:pageBlock title="Designated Totalreport Recipients."> <apex:repeat value="{!account.account_contacts__r}" var="contact"> {!contact.EMAIL__c}, </apex:repeat> <apex:form > <br /> <apex:commandButton value="Email TOTALREPORT" action="{!send}" /> </apex:form> </apex:pageBlock> <apex:detail /></apex:page>

 And here is my Custom Controller:

 

public class sendEmail { public String subject = 'Text Only Version of TOTALREPORT'; public String body = 'This is your TOTALREPORT.'; public string id = ApexPages.currentPage().getParameters().get('id'); //inspection ins = [Select building__c from inspection__c where id = :id]; myInspection ins = new myInspection(id); private final account_c__c account; public myInspection getIns() { return ins; } public sendEmail() { account = [Select (Select EMAIL__c From account_contacts__r where TR_Recipient__c = true) From Account_c__c a where id = :ins.buildingid]; } public account_c__c getAccount() { return account; } public PageReference send() { // Define the email Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); // Reference the attachment page and pass in the account ID PageReference pdf = Page.totalreport; pdf.getParameters().put('id',this.id); pdf.setRedirect(true); // Take the PDF content Blob b = pdf.getContent(); // Create the email attachment Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment(); efa.setFileName('TOTALREPORT.pdf'); efa.setBody(b); String addresses; if (account.account_contacts__r != null) { addresses = account.account_contacts__r[0].EMAIL__c; // There may be more contacts, so loop through the whole list for (Integer i = 1; i < account.account_contacts__r.size(); i++) { if (account.account_contacts__r[i].EMAIL__c != null) { addresses += ':' + account.account_contacts__r[i].EMAIL__c; } } } //String bccAddresses = 'totalreportmailinglist@criticalsystems.us'; //bccAddresses += ':' + ins.lead_inspector__r.email__c; String[] toAddresses = addresses.split(':', 0); //String[] tobccAddresses = bccaddresses.split(':', 0); String[] tobccAddresses = new String[] {'totalreportmailinglist@criticalsystems.us'}; // Sets the paramaters of the email email.setSenderDisplayName('Critical Systems'); email.setSubject( subject ); email.setBccAddresses( tobccAddresses ); email.setReplyTo('totalreportmailinglist@criticalsystems.us'); email.setToAddresses( toAddresses ); email.setPlainTextBody( body ); email.setUseSignature(false); email.setFileAttachments(new Messaging.EmailFileAttachment[] {efa}); ins.distributed = true;

update ins; 

// Sends the email Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email}); inspection__c thisIns = new Inspection__c(id = ins.id); return null; }}

 This is all just a slightly modified version of the Email an Attachment from Visualforce example in the Force.com Visualforce Development documentation found on page 112.

 

I have a checkbox that I want to change to True when the user clicks the send button. I am trying to do this via the two lines "ins.distributed = true;  update ins;"

 

But it won't work.

 

Why not? 

 

 

 

 

Hi Everyone,

 

i've got some trouble by using Lookup Reference Fields from sObjects. 

Ive created a sObject called 'Shapes' with fields 'Shape' and 'Name' as autonummered id field. Secondly, ive created a sObject 'Materials' with an Look-up field related to 'Shapes':

 

 

for(Material__c mtr : [select Name, Shape_ID__c from Material__c]){ String shapeID = (mtr.Shape_ID__c);//...

 returns me a Reference (Exp: a07A0000000dVGCIA2

 How do i Approach the corresponding sObject to get its field value 'Shape' ?

 

Ive tried:

 

shapeC = [select Shape__c from Shape__c where Name = mtr.Shape_ID__c];

 but this is obv. not working...

 

andy ideas? 

 

 

 

Is it possible to convert a Double to a string?  I have a date that is part of a string, and I want to pull out of the date and convert it to a double, but I can't figure out how? 

 

 

 

 

 

 

I want to get the context user of a page for which I am writing a controller because I want the page to appear one way for a certain type of user and another for a different type of user.

 

This is an example of what I had in mind.

 

String showForm = ($User.Role.Name = 'License Control') ;

 

There seems to be something wrong with my syntax, and I am having trouble finding a solution in the documentation. 

 

 

  • March 27, 2009
  • Like
  • 1

Hi All,

 

I would like to be able to call the SF Metadata API from Apex code in my custom app.

 

I went to Setup/App Setup/Develop/API and clicked on 'Download Metadata WSDL' and saved it to my hard drive.

 

Then I went to Setup/App Setup/Develop/ApexClasses and clicked on the 'Generate from WSDL' button. For Step 1, I navigate to the Metadata WSDL that I just saved and click 'Parse WSDL.' This takes me to the Step 2 screen where I then click on the 'Generate Apex code' button.

 

This takes me to the Step 3 screen which shows this error:

 

<error>

Apex generation failed.

Error message:
Error: Class name 'Metadata' already in use. Please edit WSDL to remove repeated names

 

</error>

 

Does this error mean that what I am attempting to do is not allowed? If it is allowed, how do I get around this error.

 

Any help would be appreciated.

 

Thanks,

Andrew



public class RasmussenEnrollmentClass{

EA__c enrollment;

public RasmussenEnrollmentClass() {

}

public EA__c getEnrollment() {
if (enrollment==null) {
enrollment= [select Date_of_Birth__c, Phone_Number__c, Secondary_Phone__c, Address_1__c,
Address_2__c, City__c, Country__c, Email__c,Last_Legal_Name__c, First_Legal_Name__c,
Maiden_Name__c,Phone__c,Start_Date__c,Start_Date_2__c,Degree_Applied_For__c,
Program_Emphasis__c, State__c,Zipcode__c, Social_Security_Number__c,
Name_of_Institution__c,Name_of_Institution_2__c,Name_of_Institution_3__c,Name_of_Institution_4__c,Name_of_Institution_5__c,
Dates_Attended__c,Dates_Attended_2__c,Dates_Attended_3__c,Dates_Attended_4__c,Dates_Attended_5__c,
Degree_Received__c,Received_2__c,Received_3__c,Received_4__c,Received_5__c FROM EA__c WHERE Student_Name__c=:userinfo.getuserid()];
}

return enrollment;
}

public PageReference save() {

try {

update enrollment;
}

catch(System.DMLException e) {
ApexPages.addMessages(e);
return null;
}

return null;
}


}

 

VF Page

 

<apex:page sidebar="false" controller="RasmussenEnrollmentClass">
<center>
<table width="75%" border="0">
<tr>
<td>

<apex:sectionHeader title="Rasmussen Enrollment Agreement" subtitle="Page 1"/>
<apex:form >
<apex:pageBlock helpTitle="Click for help" helpUrl="http://www.google.com" title="ENROLLMENT INFORMATION" mode="edit" >
<apex:pageBlockButtons >
<apex:commandButton action="{!Save}" value="Save"/>
</apex:pageBlockButtons>

<apex:pageBlockSection columns="2">

<apex:inputField id="FName" value="{!enrollment.First_Legal_Name__c}" required="FALSE"/>
<apex:inputField id="LName" value="{!enrollment.Last_Legal_Name__c}" required="FALSE"/>
<apex:inputField id="SSN" value="{!enrollment.Social_Security_Number__c}" required="FALSE"/>
<apex:inputField id="DOB" value="{!enrollment.Date_of_Birth__c}" required="FALSE"/>
<apex:inputField id="Phone" value="{! enrollment.Phone_Number__c}" required="FALSE"/>
<apex:inputField id="Phone2" value="{! enrollment.Secondary_Phone__c}" required="FALSE"/>
<apex:inputField id="Address1" value="{! enrollment.Address_1__c}" required="FALSE"/>
<apex:inputField id="Address2" value="{! enrollment.Address_2__c}" required="FALSE"/>
<apex:inputField id="City" value="{! enrollment.City__c}" required="FALSE"/>
<apex:inputField id="Country" value="{! enrollment.Country__c}" required="FALSE"/>
<apex:inputField id="Email" value="{! enrollment.Email__c}" required="FALSE"/>
<apex:inputField id="Maiden" value="{! enrollment.Maiden_Name__c}" required="FALSE"/>
<apex:inputField id="Phone3" value="{! enrollment.Phone__c}" required="FALSE"/>
<apex:inputField id="State" value="{! enrollment.State__c}" required="FALSE"/>
<apex:inputField id="Zip" value="{! enrollment.Zipcode__c}" required="FALSE"/>

</apex:pageBlockSection>
</apex:pageBlock>



</apex:form>

</td>
</tr>
</table>
</center>

</apex:page>

 

 

I created a VF Page for the Customer Portal. When a customer logs in, it pulls information in Salesforce based on their user id.

 

I want to allow the customer to edit their information and save it. 

 

My issue is it is saving changes to the  First_Legal_Name__c and Last_Legal_Name__C...However none of theother fields are saving. Am I going about this wrong? Do I need to have a View page and an Edit page like how Salesforce does it on their objects?

 

Thank you for any help you may have.

 

 

Does anyone have a sample of Apex to workday?

WSDL2Apex creates the classes for me just fine but the Authentication class doesn't look complete, no password member.

 

Thanks.

  • February 09, 2011
  • Like
  • 0

Hi if you are interesed in the position outlined below please reply to this post. Thanks.

 

Business Analyst/Systems Administrator.

 

Location – Los Gatos, CA

 

Description:

What to take your career to the next level? We are looking for a Business Analyst /System Administrator for our business applications. We run our business on Salesforce.com and Google Premier. The ideal candidate is someone who knows Salesforce.com, with at least 2 years experience. This candidate will need to be able to manage operational projects, both in implementation and outside resource management.

Responsibilities: 

  • Administration
    • Manage Onpharma’s database of record, implemented on the Salesforce.com platform, for all organization users
    • Manage ongoing support requests and administrative needs of users
    • Develop reports, dashboards, and processes to continuously monitor data quality and integrity
    • Google Premier Administrator, manage all of our Google apps and adoption through out the business.
    • Manage the on premise phone system, Switchvox, Digium, with third party support.
    • Manage the corporate website and work with Marketing on rolling out new features.
  • Training and Documentation
    • Develop and communicate a schedule for future database releases/enhancements
    • Monitor user adoption rates and respond as needed (additional training sessions, communication, modifications, or other resources) to improve
    • Assist users with report design and management
  • Planning
    • Define, communicate, and manage a change management (release) process to develop and implement new applications and updates to existing applications
  • Process Discovery and Management
    • Work with various departments and end users to identify, document, and communicate standard business processes as they related to salesforce
    • Work with management to identify new and creative opportunities to leverage salesforce to support additional business processes or functions
  • Vendor Management
    • Manage outsourced Salesforce.com implementation partners as required
    • Manage ongoing relationship with Salesforce.com
    • Manage and work with our desktop support vendors.
    • Manage and work with our phone system provider.

 

Experience/Skills:

  • 2+ years administrator level experience with Salesforce.com.
  • Experience in integration and management of additional applications into the Salesforce.com platform.
  • Software & Marketing related project management experience.
  • Analytical, logical-thinking and problem solving skills.
  • Flexibility in work hours during implementation and testing.
  • Good communication skills: Verbal & Written.
  • HTML experience.
  • Project oriented and detailed.
  • Experience as a self-starter with a track record of quickly learning new skills.
  • Ability to handle multiple priorities and adjust to meet target deadlines.
  • Detail-oriented mindset and reliability to insure high quality of end product.
  • Strong analytical and problem solving skills.
  • Flexibility and adaptability to work alone or on teams.
  • Strong interpersonal skills with the ability to interact effectively with individuals at all levels of the organization.
  • Apex, Visualforce, and javascript are a plus.
  • December 22, 2010
  • Like
  • 0

So I am pretty sure this is an Eclipse issue, and I am hoping others have solved it and can point me in the correct direction.

 

What gives with the warning in visualforce page files for HTML comment tags?

See attached screen shot.


Any help to remove these warning would be greatly appreciated.

  • November 22, 2010
  • Like
  • 0

Hi:

 

On some browsers our sites page looks like the css file did load. I am storing the css file in a static resource and it works perfectly on my work computer and my home computer.

 

I used the development feature in Safari to view the site in all sorts of browsers and it looks just fine.

But when this one customer looks at the site it looks like the css file didn't load.

 

Can some browsers reject linked CSS? That would seem odd.

Also the graphics are showing up fine, and they are in the same static resource zip file.

 

Thoughts?

  • July 28, 2010
  • Like
  • 0

Hi:

 

I want to host large files but keep them "behind" the sites login. Currently there is a 5 mb file limit for storing the file in Salesforce.

We have a corporate web site, and our hosting company said we can host them there, but it's not secure.

 

Has anyone solved this problem? and did you do it with some custom php code on the web server, or with a third party file hosting company?

Or another way?

Thanks.

  • July 28, 2010
  • Like
  • 0

Hi I am trying to parse a very simple web service and getting this error:

Error: Failed to parse wsdl: Unable to find schema for element; {http://www.w3.org/2001/XMLSchema}schema

 

Here is the wsdl:

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
      <s:import namespace="http://www.w3.org/2001/XMLSchema" />
      <s:element name="GetQuery">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="UserName" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="DEA" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="BAC" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="BASC" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="ExpirationDate" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="Company" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="Zip" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="State" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="MaxRows" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="GetQueryResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="GetQueryResult">
              <s:complexType>
                <s:sequence>
                  <s:element ref="s:schema" />
                  <s:any />
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="DataSet" nillable="true">
        <s:complexType>
          <s:sequence>
            <s:element ref="s:schema" />
            <s:any />
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
  </wsdl:types>
  <wsdl:message name="GetQuerySoapIn">
    <wsdl:part name="parameters" element="tns:GetQuery" />
  </wsdl:message>
  <wsdl:message name="GetQuerySoapOut">
    <wsdl:part name="parameters" element="tns:GetQueryResponse" />
  </wsdl:message>
  <wsdl:message name="GetQueryHttpGetIn">
    <wsdl:part name="UserName" type="s:string" />
    <wsdl:part name="Password" type="s:string" />
    <wsdl:part name="DEA" type="s:string" />
    <wsdl:part name="BAC" type="s:string" />
    <wsdl:part name="BASC" type="s:string" />
    <wsdl:part name="ExpirationDate" type="s:string" />
    <wsdl:part name="Company" type="s:string" />
    <wsdl:part name="Zip" type="s:string" />
    <wsdl:part name="State" type="s:string" />
    <wsdl:part name="MaxRows" type="s:string" />
  </wsdl:message>
  <wsdl:message name="GetQueryHttpGetOut">
    <wsdl:part name="Body" element="tns:DataSet" />
  </wsdl:message>
  <wsdl:message name="GetQueryHttpPostIn">
    <wsdl:part name="UserName" type="s:string" />
    <wsdl:part name="Password" type="s:string" />
    <wsdl:part name="DEA" type="s:string" />
    <wsdl:part name="BAC" type="s:string" />
    <wsdl:part name="BASC" type="s:string" />
    <wsdl:part name="ExpirationDate" type="s:string" />
    <wsdl:part name="Company" type="s:string" />
    <wsdl:part name="Zip" type="s:string" />
    <wsdl:part name="State" type="s:string" />
    <wsdl:part name="MaxRows" type="s:string" />
  </wsdl:message>
  <wsdl:message name="GetQueryHttpPostOut">
    <wsdl:part name="Body" element="tns:DataSet" />
  </wsdl:message>
  <wsdl:portType name="DEAWebsvcClassSoap">
    <wsdl:operation name="GetQuery">
      <wsdl:input message="tns:GetQuerySoapIn" />
      <wsdl:output message="tns:GetQuerySoapOut" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:portType name="DEAWebsvcClassHttpGet">
    <wsdl:operation name="GetQuery">
      <wsdl:input message="tns:GetQueryHttpGetIn" />
      <wsdl:output message="tns:GetQueryHttpGetOut" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:portType name="DEAWebsvcClassHttpPost">
    <wsdl:operation name="GetQuery">
      <wsdl:input message="tns:GetQueryHttpPostIn" />
      <wsdl:output message="tns:GetQueryHttpPostOut" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="DEAWebsvcClassSoap" type="tns:DEAWebsvcClassSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
    <wsdl:operation name="GetQuery">
      <soap:operation soapAction="http://tempuri.org/GetQuery" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:binding name="DEAWebsvcClassHttpGet" type="tns:DEAWebsvcClassHttpGet">
    <http:binding verb="GET" />
    <wsdl:operation name="GetQuery">
      <http:operation location="/GetQuery" />
      <wsdl:input>
        <http:urlEncoded />
      </wsdl:input>
      <wsdl:output>
        <mime:mimeXml part="Body" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:binding name="DEAWebsvcClassHttpPost" type="tns:DEAWebsvcClassHttpPost">
    <http:binding verb="POST" />
    <wsdl:operation name="GetQuery">
      <http:operation location="/GetQuery" />
      <wsdl:input>
        <mime:content type="application/x-www-form-urlencoded" />
      </wsdl:input>
      <wsdl:output>
        <mime:mimeXml part="Body" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="DEAWebsvcClass">
    <documentation xmlns="http://schemas.xmlsoap.org/wsdl/" />
    <wsdl:port name="DEAWebsvcClassSoap" binding="tns:DEAWebsvcClassSoap">
      <soap:address location="http://www.deanumber.com/Websvc/deaWebsvc.asmx" />
    </wsdl:port>
    <wsdl:port name="DEAWebsvcClassHttpGet" binding="tns:DEAWebsvcClassHttpGet">
      <http:address location="http://www.deanumber.com/Websvc/deaWebsvc.asmx" />
    </wsdl:port>
    <wsdl:port name="DEAWebsvcClassHttpPost" binding="tns:DEAWebsvcClassHttpPost">
      <http:address location="http://www.deanumber.com/Websvc/deaWebsvc.asmx" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

 I found this post. And simple type is not supported, so this wsdl uses complexType, could that be the issue?

 

Thanks.


 

  • July 21, 2010
  • Like
  • 0

Hi:

I have a VF page that uses inputFile to let the portal user upload files on a custom object.
My design works just fine in the native SFDC UI but for some reason when I login as a portal user I can't upload a file. I don't get an error message, and the page works because it's redirecting me to the next step in the process, without the upload working. Are there any known issues with the portal and using the inputFile tag?

 

 

</apex:outputPanel>
<apex:outputPanel layout="block" >
<apex:inputFile value="{!Attachment.Body}" filename="{!Attachment.Name}" />
<apex:commandButton value="Attach" action="{!saveAttachment}" />
</apex:outputPanel>

 

public PageReference saveAttachment(){ PageReference p; try{ this.sc.save(); p = returnToAttachmentPage(); }catch(DmlException e){ ApexPages.addMessages(e); p = null; } return p; }

 I don't see a message on the screen from the catch block, and my page is continuing the process because its following the 'returnToAttachmentPage()' method.

Thanks

 

 

 

  • January 05, 2010
  • Like
  • 0

Just let me know if this is expected behavior or this is a bug.

I want to update/insert an sobject and in one of the text long fields I want leading new lines.
But I can’t get that to happen.



Here is a test script.

Account test = new Account(name='miketest',Description='\n\n what is going on?'); insert test; test = [select description from Account where id = : test.id]; System.debug('**** ' + test.description); test = new Account(id=test.id,Description='What\n\nis Going on?'); update test; test = [select description from Account where id = : test.id]; System.debug('**** ' + test.description);

 



Here is the debug log.

 

 

12:50:14 INFO - 20091029194505.598:AnonymousBlock: line 2, column 1: Insert: SOBJECT:Account 20091029194505.598:AnonymousBlock: line 2, column 1: DML Operation executed in 84 ms 20091029194505.598:AnonymousBlock: line 3, column 8: SOQL query with 1 row finished in 23 ms 20091029194505.598:AnonymousBlock: line 4, column 1: **** what is going on? 20091029194505.598:AnonymousBlock: line 6, column 1: Update: SOBJECT:Account 20091029194505.598:AnonymousBlock: line 6, column 1: DML Operation executed in 49 ms 20091029194505.598:AnonymousBlock: line 7, column 8: SOQL query with 1 row finished in 21 ms 20091029194505.598:AnonymousBlock: line 8, column 1: **** What is Going on? Cumulative resource usage:

 



So I can save line breaks after the first character of a string but not before

 



The outcome I want is:

 

20091029194505.598:AnonymousBlock: line 8, column 1: **** What is Going on?

 

 

 

Any insight would be helpful.

  • October 29, 2009
  • Like
  • 0

Hi:

 

I have a visualforce page that uses the inputFile tag to up load files, code below.

I let the user upload multiple files and every file is saved using a Transient variable.


Everything seems to be working correctly, I can up load lots of files, the strange thing is when I upload a file that is 128K or more I get the "Maximum view state size limit (128K) exceeded. Actual viewstate size for this page was 130.141K" error.

 

BUT when I go to the record in sfdc the attachment is there and I can download it and view it.

 

Any ideas?

 

 

public class MyController{

private Boolean showMessage;

private Message__c newMessage;
private Attachment newAttachment;
private List<String> attachmentList;
private String attachmentName;
Transient Blob attachmentBody;

public Boolean getShowMessage(){retrun this.showMessage;}

public Message__c getNewMessage(){return this.newMessage;}
public List<String> getAttachmentList(){return this.attachmentList;}
public String getAttachmentName(){return this.attachmentName;}
public Blob getAttachmentBody(){return this.attachmentBody;}

public void setAttachmentName(String pAttachmentName){this.attachmentName = pAttachmentName;}
public void setAttachmentBody(Blob pAttachmentBody){this.attachmentBody = pAttachmentBody;}

public PageReference newMessage(){
this.newMessage = new Message__c();
return null;
}

public PageReference saveNewMessage(){
try{
insert this.newMessage;

}catch(DmlException e){
ApexPages.addMessages(e);
}
return null;
}

public PageReference saveNewMessageAndAttach(){
saveNewMessage();

showMessage = false;

return null;
}

public PageReference attachDocument(){
this.newAttachment = new Attachment();
this.newAttachment.Name = this.attachmentName;
this.newAttachment.Body = this.attachmentBody;
this.newAttachment.ParentId = this.newMessage.Id;

try{
insert this.newAttachment;
this.attachmentList.add(this.attachmentName);
}catch(DmlException e){
ApexPages.addMessages(e);

}

return null;
}

public PageReference saveMessageWithAttachments(){
this.attachmentList = new List<String>();
return null;
}

}

 

 

<apex:page controller="MyController" >
<apex:form id="messageCenter">
<apex:outputPanel id="newMsg" layout="block" >
<apex:pageBlock title="Title" rendered="{!showMessage}" >
<apex:pageBlockButtons >
<apex:commandButton value="Send" action="{!saveNewMessage}" />
<apex:commandButton value="Save and Attach" action="{!saveNewMessageAndAttach}" />
</apex:pageBlockButtons>
<apex:pageBlockSection title="this is a test" collapsible="false" columns="1" >
<apex:inputField value="{!newMessage.To__c}" />
<apex:inputField value="{!newMessage.Name}" />
<apex:inputField value="{!newMessage.Body__c}" />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:outputPanel>
<apex:outputPanel id="attach" layout="block" >
<apex:pageBlock title="Title" rendered="{!!showMessage}" >
<apex:pageBlockButtons >
<apex:commandButton value="Done" action="{!saveMessageWithAttachments}" />
</apex:pageBlockButtons>
<apex:pageBlockSection title="this is a test" collapsible="false" columns="1" >
<apex:outputField value="{!newMessage.To__c}" />
<apex:outputField value="{!newMessage.Name}" />
<apex:outputField value="{!newMessage.Body__c}" />
</apex:pageBlockSection>
<apex:pageBlockSection title="Attachments" collapsible="false" columns="1" >
<apex:actionStatus id="attach" startText="Attaching..."/>
<apex:pageBlockSectionItem >
<apex:inputFile value="{!attachmentBody}" filename="{!attachmentName}" />
<apex:commandButton value="Attach" action="{!attachDocument}" status="attach" />
</apex:pageBlockSectionItem>
<apex:outputPanel layout="block" >
<apex:pageBlockTable value="{!attachmentList}" var="a" >
<apex:column value="{!a}" />
</apex:pageBlockTable>
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:outputPanel>\
</apex:form>
</apex:page>

 

 

  • October 23, 2009
  • Like
  • 0

Hi I have a vf page that shows a list of records, and I want to make the column sortable.

I thought of a way to do this and it's pretty straight forward, the problem I am having; I can't make the header a link.

 

I want the user to click on the header value to sort the column.

But when I add an apex commandLink to the header the value of the header goes away.

 

Any insight would be very helpful.

Thanks.

 

 

<apex:pageBlockTable value="{!myMessages}" var="msg" > <apex:column width="15%" > <apex:facet name="header"> <b> <apex:commandLink action="{!orderInbox}" value="Subject" rerender="message,inbox" > <apex:param assignTo="{!orderedBy}" name="theOrderedBy" value="msg.name" /> </apex:commandLink> </b> </apex:facet> <apex:outputField value="{!msg.name}" /> </apex:column> </apex:pageBlockTable>

 

 

 

  • October 09, 2009
  • Like
  • 0

Hi I am using the ant toolkit to deploy code into our sandbox and I getting this error.

 

"Cannot coerce from class core.apexpages.el.adapters.metadata.ApexObjectValueMetadataELAdapter to class"

 

Any idea what is going on?

  • August 25, 2009
  • Like
  • 0
Hi:

I am using Integer.valueOf and passing a double in, but I am getting back a double.

Anyone have this issue as well?


Code:
public class ProposalContractEndDate {

public static void stampContractEndDate(Proposal__c[] proposals){
for(Proposal__c p : proposals){
if(p.Contract_Start_Date__c != null &&
p.Contract_Term_Months__c != null){
p.Contract_End_Date__c = getContractEndDate(p.Contract_Start_Date__c,Integer.valueOf(p.Contract_Term_Months__c));
}
}
}

public static Date getContractEndDate(Date startDate, Integer termInMonths){
Date newDate = startDate.addMonths(termInMonths);
return newDate;
}

}

 

Error,
Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger ProposalTrigger caused an unexpected exception, contact your administrator: ProposalTrigger: execution of BeforeUpdate caused by: System.TypeException: Invalid integer: 12.0: Class.ProposalContractEndDate.stampContractEndDate: line 22, column 86


Message Edited by mikef on 12-22-2008 02:13 PM
  • December 22, 2008
  • Like
  • 0
Hi:

I have an existing page that works great that shows the user a consoled view of a few objects.
I want to render this as a pdf but the users want to do this on their own.
So I will have a button on the page that creates the pdf.

My question is can I have a new page just be the pdf wrapper to my existing page and not duplicate the page code for the pdf page?
  • October 29, 2008
  • Like
  • 0
I am trying to pull a field token back from a field schema map and use it in an SObject.
I do a describe call for all the fields in the SObject and then use a string value of the field name to get the field token back.

Apex compiler throws an error, Invalid field accField for SObject Account.
But the accField is a variable of type Schema.SObjectField and the map I use to set the variable is bring back the correct schema.
And the field does exist on the Account record.

Bottom line I trying to set a variable of type Schema.SObjectField with a valid account field. Can I do this in Apex?
  • October 28, 2008
  • Like
  • 0
Hi:

Does anyone know if the ant toolkit was updated to not update Apex code that didn't change?

IE: Last release every class in my deploy directory was updated in salesforce when I only made changes to one class.
But looks like the LastModDate wasn't changed on classes that didn't change.

Can someone confirm this, the metadata docs didn't have anything about this.
Thanks
  • October 16, 2008
  • Like
  • 0
Does anyone know if you can merge a lead from the after trigger of the inserted lead?

I get the error: The master record id [SObject id] appears in the merge id list:

My thinking is you can't merge a Lead, Contact, or Account while inserting that record.

Business case:
On the insert of a lead I am querying to see if there is other leads with the same email.
If so then merge the inserted lead with the found lead.

Thank you.
  • August 13, 2008
  • Like
  • 0
Hi:

Does VF support the field help icon?
I added the help to a custom field but it doesn't show up on my VF page that I display the label.

How do I show the help icon and the help text pop-up?

Thank you.
  • July 04, 2008
  • Like
  • 0
Hi:

I am getting this error, build.xml:20: Request timed out, check max poll and poll wait millis attributes

I looked through the ant-salesforce.jar file and never found an xml file with these attributes.

Where can I set these?

Thank you.
  • June 09, 2008
  • Like
  • 0
Hi:

I am having an issue with the ant tool kit and hope you can help.

I ran the test just fine, but when I got to replace my class with the sample class I get this error.

"An object 'MyClassName' of type ApexClass was named in manifest but was not found in zipped directory"

I updated the package.xml file with my class name, I can login just fine, and the test worked fine.

Thank you.

  • May 27, 2008
  • Like
  • 0
Hi:

I can't get my set method to fire when I have a selectList VF tag.

Code:
<!-- page code -->
<apex:selectList id="chooseRole" value="{!partnerRoleValue}" size="1">
        <apex:selectOption itemValue="Source Lead" itemLabel="Source Lead"/>
        <apex:selectOption itemValue="Joint Sales" itemLabel="Joint Sales"/>
        <apex:selectOption itemValue="Reseller" itemLabel="Reseller"/>
        <apex:selectOption itemValue="Referral" itemLabel="Referral"/>
        <apex:selectOption itemValue="Technology" itemLabel="Technology"/>
</apex:selectList>


Code:
/**controller code**/

public String getPartnerRoleValue() {
     return partnerRoleValue;
}

public void setPartnerRoleValue(String parterRoleValues) {
     this.partnerRoleValue = partnerRoleValue;
     System.debug('test partner value ' + getPartnerRoleValue()); 
}

When viewing the  system  log window the debug comes up null, and the value of the selectList doesn't populate back to sfdc.
I have other fields on the record that I populate and their are working fine.


 

  • March 31, 2008
  • Like
  • 0

I am running a query on the Event object, and it's working until I tried grabbing a custom field on the User who is assigned (the Owner).  I already had standard fields pulling from the Owner, so not sure why it's not working for the custom field.  I pulled my naming from the schema browser a few different times, just to be sure...

 

Here's my query:

 

tempAppts = [SELECT WhoId, WhatId, OwnerId, Owner.FirstName, Owner.Profile__c, Owner.Name, Subject, StartDateTime, Result__c
	FROM Event
	WHERE WhoId = :contactID
	AND StartDateTime >= :yaynow
	AND Result__c != 'Rescheduled'];

OwnerId, Owner.FirstName, and Owner.Name work fine, but once I put in Owner.Profile__c I get an error on save.  I have tried OwnerId.Profile__c, Owner__r.Profile__c, etc.  The error message is strange as well, references "Name" instead of "Owner":

 


Save error: No such column 'Profile__c' on entity 'Name'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

 

 

  • March 09, 2011
  • Like
  • 0

Please help write test code for the following trigger:

 

 

trigger ApplyContractDiscount on QuoteLineItem (before insert, before update) 
{         
    for (QuoteLineItem isContract:trigger.new) 
    {      
        // Build SQL string returning the contract with the highest end date
        string strSQL1 = 'SELECT c.AccountId, c.Account.Id, c.Discount_Level__c, c.EndDate FROM Contract c WHERE c.AccountId = ';
        strSQL1 += '\'';
        strSQL1 += isContract.Account_ID_Formula__c;
        strSQL1 += '\'';
        strSQL1 += ' ORDER BY c.EndDate DESC LIMIT 1';
            
        List<Contract> L = Database.query(strSQL1);
    
        if (L.size() > 0) //Does a contract exist?
        {
            Contract A = Database.query(strSQL1);
            isContract.Discount = A.Discount_Level__c;
        }

        isContract.UnitPrice = isContract.ListPrice;
        isContract.Discount = 0;
    }
}

 

 

Hi,

 

Is it possible to send email notification to parent case owner whenever child case close?

 

Thanks

Hi, 

 

I am having trouble getting this query working in a batchable class. 

 

In my start method when I use the following query : 

 

 

String query = 'Select a.Id, a.Name, a.OwnerId ,(Select Id, OwnerId From Contacts) from Account a Where a.Type IN: '+ accTypesToInclude ;
 return Database.getQueryLocator(query);

 

 

I am getting the error :

 

System.QueryException: unexpected token: '(' 

 

Any ideas whats wrong

 

Thanks

Hello,

 

I'm trying to create a trigger on Case Comments so that my Customer Portal users are not able to add comments to closed cases.

 

 

trigger CloseComment on CaseComment (before insert) {

for (CaseComment t: Trigger.new)
{
	Case c = new Case(Id = t.ParentId);
	c = [SELECT Status FROM Case WHERE Id = :c.Id];

	if(c.Status == 'Closed' && System.Userinfo.getUserType()!= 'Standard')
		{
		t.addError('You cannot add comments to closed cases.');
		}
	}

 

but it fails with bulk import. any ideas?

 

Hello everyone,

 

I'm trying to write a trigger that will only fire when a particular field is updated on an object. Not when any other field is modified. is something like this possible in APEX?

 

Any help is greatly appreciated, thanks!

-Jon

How do I check if a valid Contact is returned from a query like this in Apex.

 

Contact o = [SELECT c.Id, Email, LastName, FirstName, MailingCity, HomePhone, MailingState, MailingStreet, MailingPostalCode, AccountId, Source_Code__c, Drupal_User_Id__c FROM Contact c WHERE c.Email = :n.Email AND c.Id != :n.Id limit 1];

 

How do I check to see if o is a populate Contact object.

I can call System.schedule() to schedule a job.

 

Is there any way to query the job list and delete jobs programmactically from Apex?

 

WHAT: I would like to set up a system where I can get a view of all contacts in campaign X or campaign Y, but not in campaign Z.

 

WHY: My mass emailing application, which is integrated with SF, requires that I create mailing lists from campaigns.  I need a view so that I can easily create a new campaign from this new list of contacts, and then create a mailing list from that new campaign.

 

PROBLEM: It seems views do not support lookup by multiple campaigns, and by the looks of the idea exchange section, that may not happen for awhile.

 

HOW: I thought up one solution...

 

1. Add a text field to the contact record

2. Create a trigger that appends the campaign name to that text field when the contact is added to that campaign.

3. Add another trigger that removes the campaign name from the text field

4. Create a view that searches the text field for the campaign names I want and used advanced views to do the filtering

 

Does that seem reasonable to the Apex developer community?  How could I achieve steps 2 and 3?  Or, am I missing some obvious solution that exists out there that allows me to do this filtering and create a new campaign from the resulting contacts?

 

I have no experience coding Apex and would appreciate anyone who can lend some advice or point me in the right direction.

 

Thanks!

 

Rob

Guys......

 

   Please Help me....Getting this error.whern using aggeregate result.

 

    *******field 'name' can not be grouped in a query call*****

 

 Thank You,

 

  

I have a question about what can be done in a batch execution process.

 

Typically, the batch process is something like this:

 

 

for (sObject s : scope) {
   do stuff here
} update scope;

 

 

 

But can you do things based on the object in scope.

 

 

for (sObject s : scope) {
   do stuff here

      // Other stuff
   List<sObject> nsoList = [select based on value in s];
   for (SObject nso : nsoList) {
      do stuff here on nso
   }
   update nsoList;
}
update scope;

 

 

What if you set the batch size to 1?

 

Would this work?

 

Any ideas?

 

 

This class displays all Payment-History__c records associated with Client__c and allows to edit and save. I am trying to create the ability to insert a new line in the table basically an add row functionality. I cannot seem to make it work, here is the original class without the add row function:

 

 

public with sharing class BulkEdit {
    public List<Payment_History__c> payments;
    public Id thePH;
    
  // class constructor 
    public BulkEdit() {
        thePH = ApexPages.currentPage().getParameters().get('id');
        payments = getPayments();
    }
    
  // get all the children for this Client__c
    public List<Payment_History__c> getPayments() {
      payments = [SELECT Name, Payment_Amount__c, Payment_Scheduled_Date__c, Payment_Cleared_Date__c, Payment_Status__c, Fee_Payment__C, Set_Payment__c, Processing_Fee__c
                    FROM Payment_History__c  WHERE Client__r.Id = :thePH];

       return payments;
    }
    
    public PageReference back()
    {      
        return new PageReference('/' + thePH);
    }
    
  // the Save button's method.  This will update both the parent and children records.
    public PageReference savePayments() {
        update payments;
        payments = getPayments();
        
        if (thePH == null)
        {
      return null;
        }
                
        Client__c phToUpdate = [ SELECT Id FROM Client__c WHERE Id = :thePH LIMIT 1];
        update phToUpdate;
        //return new PageReference('/' + thePH);
        
        // refresh current page
        return ApexPages.currentPage();
    }
}

 

 

Here is my attempt at adding the add row function, on this one the ad row function works..but the original function to display and save does not...lol what am i doing wrong????

 

 

public with sharing class BulkEdit {
    public List<Payment_History__c> payments {get; set;}
       public Id thePH;
 
        
  // class constructor 
    public BulkEdit() {
        thePH = ApexPages.currentPage().getParameters().get('id');
        payments = getPayments();
        payments = new List<Payment_History__c>();
        payments.add(new Payment_History__c());

    }
    public void addrow(){
        
        payments.add(new Payment_History__c());  
    }
    
  // get all the children for this Client__c
    public List<Payment_History__c> getPayments() {
      payments = [SELECT Name, Payment_Amount__c, Payment_Scheduled_Date__c, Payment_Cleared_Date__c, Payment_Status__c, Fee_Payment__C, Set_Payment__c, Processing_Fee__c
                    FROM Payment_History__c  WHERE Client__r.Id = :thePH];

       return payments;
    }

    public PageReference back()
    {      
        return new PageReference('/' + thePH);
    }
    
  // the Save button's method.  This will update both the parent and children records.
    public PageReference savePayments() {
        update payments;
        insert payments;
        payments = getPayments();
                             
        if (thePH == null)
        {
      return null;
        }
                
        Client__c phToUpdate = [ SELECT Id FROM Client__c WHERE Id = :thePH LIMIT 1];
        update phToUpdate;
        
        //return new PageReference('/' + thePH);
        
        // refresh current page
        return ApexPages.currentPage();
        
        
    }
    }

 

 

I have received a lot of help form these boards and greatly appreciate the opportunity to learn, my developer is on vaction until monday (shes been gone 2 weeks!) and I am trying to make sure we dont miss our deadline. Thank you for any help!

 

Jason Burns

Ok, I've been working with the IDE for a while, and when it comes to saving work in progress, it goes from bad to ridiculous. If I have automatic builds on, every time I save, depending on the connection, everything freezes when I have two saved actions in the queue. Why? 

 

So, I turned off automatic builds choosing to bypass the whole waiting part until I am ready to "Save to Server", at which point, when I try to save a file to server, the IDE decides that it is a good idea to take the other files and refresh them from the server, because hey, it's obviously what I wanted it to do. It is very frustrating to lose your work on the one hand, and have to stare at the hour-glass on the other.

 

Is there hope for the future here? Or do I need to build process to work around these horrible decisions/features/bugs?

Is there any way to retrieve a WRITEABLE reference to an SObject field at runtime?

 

Yes, I've seen all of the Schema.DescribeFieldResult stuff, and it's dandy if you want a READ-ONLY reference to the object metadata, but I was hoping to find a way to remap data from an existing Salesforce standard / default field into a set of user-defined custom fields.

 

What I'd like to do is pass in two field names at runtime and have the code-behind read the value from the first field and write it to the second field -- for purposes of illustration, something like:

 

    String data = Account.[field1];

    Account.[field2] = data;

 

Does anyone have a clue about how to do this?  I could hard-code a bunch of select statements into a bunch of methods, but I'd prefer to have a general-purpose reusable solution.

 

Jerry H.

 

  • December 09, 2010
  • Like
  • 0