• Doug ACF
  • NEWBIE
  • 49 Points
  • Member since 2006
  • CTO
  • ACF Solutions


  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 21
    Questions
  • 39
    Replies

Hi Friends ,

 

I need some advice on writing a batch apex

 

I am calling a Batch Apex let say to insert contacts for Account SObject

I am having more than 100,000  Account Records, so these are devided in to

several Batch processes let say 200 each .

 

For all the new contact records , iam adding them to a Contact List and upserting them at the end.

 

For one of these batch process , the log is showing "Too many DML rows:15034"

 There may be a chance that few Accounts having large number of contact , and I am getting this error.

Remaining batch process are running with out any problem.

 

I thought the list cannot accomodate more than 10,000  so i used List<List<Contact>>

and for everytime the new record  count increases 2000 i am inserting into a new list.

and upserting each List<Contact> by looping through List<List<Contact>>

Even then I am getting  "Too many DML rows:10030".

 

Please let me know, that there is any certain limit to upsert records fort a single Batch Process?

 

  • February 15, 2010
  • Like
  • 0

Hi,

As we know, starting next year Salesforce will stop providing option to write/develop new s-controls in the org. This is part of the product roadmap where s-control becomes an obsolete technology moving forward.

 

Does Salesforce have a recommendation on the replacement options of existing s-controls that are working today? As s-controls nears EOL (end of life) stage, even older s-controls will have to be retired and converted into an alternate technology like Visualforce.

 

1) I wanted to check with peers in this forum, if you are aware of any recommended approaches to migrate or replace s-control code.

 

2) One of the pattern that has started emerging (at least this is what I notice with some of our customers where we have lot of non-UI s-controls doing batch kind of processing) - bulk of the processing within s-control, mostly dealing with SOQL & DML operations, has been moved to APEX class and exposed as a Web Service.

 

existing s-controls becomes lightweight and invokes APEX web service for main business logic.

 

In this case, since most of logic has already been shifted out of s-control we can easily get rid of such s-controls by using inline Javascript option and whatever little processing is being done in s-control (showing alerts to user etc), that can be accommodated in inline Java script and hence practically doing away with s-control.

 

So we can see below pattern, as a  phased approach for retiring s-control :

 

A) custom link on page --> invokes s-control --> API calls to server

B) custom link on page --> invokes trimmed down s-control --> calls APEX web service --> Database calls

C) custom link on page --> inline JavaScript code --> calls APEX web service --> database calls

 

Would like to invite comments on above approach (works with non-UI, batch process s-contols) from experienced s-controls developers to validate if solution (C) will work equally fine.  

 

Important --> Remember we continue to use/refer to "connection.js" & "apex.js" in option C (inline javascript) as well. Since this is part of AJAX toolkit, I believe retirement of s-controls from the scene isn't going to impact the way we work with AJAX toolkit in future.

 

3) For bulk data processing s-controls, we can't think of replacing it with Visualforce as APEX governor limits constraints starts applying. In s-controls, we had the flexibility to batch and process records so we can work around these governor limits. For that matter any client application on force.com API doesn't have restriction on governor limits.

 

So question is how do we handle such cases? What can be a possible retirement strategy? VF+FLEX mashup? 

 

Appreciate your comments, suggestions.

 

 

Thanks

Satgur

  • February 25, 2009
  • Like
  • 0

We have two customer portals.  Each is setup with a unique New User registration email template.  It used to be that when a new user registered, they would get the template defined in that portal's config.  However, now the default email is being sent instead.  This is happening for both portals.

 

Anyone out there with multiple portals encountering the same issue?  We have a case submitted to Salesforce but no progress yet.

We have a pretty typical Sites login page for a Customer Portal.  We are finding that if the user logs in successfully, closes just that one browser tab, opens a new tab, and then attempts to login again, they get one of those generic "An error has occurred loading a Visualforce page" errors.  If the user logs out first, or closes the browser entirely, they can login fine. 

 

Seems like something to do with the session cookie but not sure not to work around it.  Any suggestions?

Is there a Summer 11 Force.com IDE for Eclipse release coming?  Sure would be nice to not have to manually change the API version on every new component...

Summer 11 added the ability to mark a field as required in a Field Set.  However, this does not seem to be working.  The required fields do not show as required on the VF page (even though the database-required fields do).  Has anyone gotten this to work for them?

We have a Site "approval" which contains a page that has fielded data from a custom object record and a link to an attachment to that record (like http://xxx.dev.cs2.force.com/approval/servlet/servlet.FileDownload?file=00PR0000000hPpZ).  It all worked fine with public sharing. 

 

However, when we turned sharing for the object to private, the data from the object still displays fine, but when you click the link to the attachment, you get an Authorization Required error.

 

My understanding is that if you have read permission to a particular record via sharing, you can download attachments to that record.  But that does not seem to be the case.

 

Any thoughts?

Excited about the new View State inspector.  However after enabling it, when I bring up one page in development mode, I got a timeout error, and on another page the message "java.lang.NullPointerException".  Dev mode works fine with view state turned off.

 

Any limitations to this functionality we should know about?

ACF Solutions, a Reston, VA based consulting company, is looking for VA/DC/MD based employees to join our dynamic team.  Our firm is focused on implementing cloud-based business systems solutions for non-profit, education, public sector and commercial clients.  We are the leading salesforce.com consultancy to non-profit and education organizations in the DC area.  And we partner with other leading cloud solution providers, including Convio, Intacct, and ExactTarget.

 

All successful candidates will have the following characteristics:

  • Demonstrate a mix of technology and business acumen and enjoy a good challenge
  • Be comfortable working in a highly collaborative and team oriented environment.
  • Experience implementing business systems software products
  • Experience with CRM a plus, particularly salesforce.com
  • Non-profit experience a plus
  • Excellent communications
  • Enthusiasm and ability to drive results
  • Understanding of data modeling, data mapping and/or data conversion
  • Degree in IT or business with IT experience

We are hiring in multiple roles with the following specific requirements:

 

Project Managers

  • Experience speaking to clients about their needs and developing holistic business systems solutions.
  • Consulting project management skills including managing client relationships and communications
  • Experience supporting business development activities by attending client sales meetings and assisting the business development team in scoping and proposing on projects
  • Experience managing project teams including staff assignment and managing project scope, budget, and timeline
  • Ability to manage staff through requirements analysis, conceptual design, detailed design, software development and configuration, quality assurance and training
  • 5 – 10+ years experience

Business Systems Analysts

  • Experience speaking to clients about their needs and then translating those needs into software designs and software configurations. 
  • Experience in business analysis techniques including requirements analysis, conceptual design, creating detailed design specifications and quality assurance
  • 1 – 10 years experience or recent graduate with some hands-on technology experience

Cloud Software Developers

  • Experience developing in a variety of languages and contexts and the ability to quickly learn new technologies
  • Experience in object oriented development, for example C++ or Java
  • Experience with web technologies including HTML, XML, PHP, CSS, Javascript, and AJAX
  • Experience with salesforce.com’s Force.com platform a plus, including Visualforce and Apex
  • Understanding of data modeling and SQL
  • Understanding of systems interfacing strategies, protocols such as SOAP and REST, and experience with interfacing platforms like Jitterbit or Cast Iron a plus
  • 1 – 5 years experience or recent graduate with some hands-on technology experience

What you will like about working at ACF Solutions

  • While we work with clients globally, out of town travel is very infrequent - and we provide a work-from-home option
  • You will be empowered to build new skills and take on responsibility so you will always be learning, always be challenged, and always making an impact.
  • You will have daily interaction with the company’s executives in a highly collaborate and friendly environment
  • You will work on multiple client engagements simultaneously that complete in months, not years, wearing multiple hats throughout the lifecycle
  • You can "do good" while doing your work since over half of our business is in the non-profit and education segments

Now is the time to accelerate your career!

Apply now by sending an email to jobs@acfsolutions.com with the name of the position in the subject line along with:

  • A cover letter stating why you are interested in and qualified for the position.
  • Your recent salary history and your work authorization status
  • Your résumé in Microsoft Word format

Please, only full time, DC/VA/MD based candidates and those authorized to work in the US should apply.  No contractors or recruiters.

We are building an integration that requires us to send a time value that is within 30 seconds of the NIST standard time.  Does anyone know if the Salesforce server timestamp is synced to NIST?

We have a working process where the user submits a Visualforce form which causes a Visualforce PDF to be created and emailed to the user.  We want the same PDF generation/email to happen on a daily schedule.  So we have made some changes to invoke similar functionality via the Apex Scheduler.  The scheduled class runs without any error messages and a PDF email gets sent, but the PDF is unable to be opened (indicating that something went wrong in the Visualforce rendering of it).

 

We have tested the functionality using anonymous execute and it works fine.  Seems to be a problem related to it being run by the scheduler.  Is there a limitation where you can't invoke Visualforce (new PageReference / getContent()) from within a scheduled Apex class?

From a custom detail page button, we want to display a prepopulated Send an Email form.  Forming the email body takes some data queries, so we are using a Visualforce page that onload calls a controller method to assemble the data and then return a PageReference to the emailauthor page with URL parameters.  A Visualforce email template won't work for our use case since it would need to be an HTML template and those aren't editable by the user before sending.

 

The good news is that this design works fine in sandbox.  However, in production it works sometimes, while other times the emailauthor page displays without any fields populated from the URL parameters.  The behavior is very flaky (for the same record, it will work once, then not the next time, then everytime one day, and none the next day).  It does not appear to dependent on the content/size of the data in the parameters.

 

Does anyone have an idea why a redirect to emailauthor would work consistently in sandbox and inconsistently in production?

It seems that the related lists rendered by <apex:detail> as well as <apex:relatedList> do not respect sharing rules.  Is this expected behavior or am I missing something?

I'm having trouble creating a record and then attaching the content of a Visualforce page as an attachment to that record.  In the sample below, I have three methods: one that creates a contact, one that renders the page and attaches it to the contact, and one that calls those two methods in sequence.

 

Apex class:

public class tcshelper {

 

public static void processContact(Id acctId) {

ID conID = addNewContact(acctId);

attachPage(conId);

}

 

public static ID addNewContact(Id acctId) {

Contact con = new Contact();

con.lastname = 'Smith';

con.accountid=acctID;

insert con;

return con.id;

}

 

public static void attachPage(Id conId) {

PageReference blobPage = Page.tcstest;

blobPage.getParameters().put('id',conId);

Blob txtBlob = blobPage.getContent();

Attachment a = new Attachment(parentId = conId, name= 'conpage.txt', body = txtBlob);

insert a;

}

}

Visualforce page:

 

<apex:page standardcontroller="account">

<apex:detail />

</apex:page>

 

When I execute createNewContact or attachPage individually, they work fine (the contact attachment has the detail section displayed).  But when I execute the top method processContact, the resulting attachment contains the message:

 

Data Not Available
The data you were trying to access could not be found. It may be due to another user deleting the data or a system error. If you know the data is not deleted but cannot access it, please look at our support page.

It seems like the page is not able to find my newly created contact.  What am I missing?
Message Edited by Doug ACF on 01-31-2009 09:02 AM

ACF Solutions is a business systems consulting firm and salesforce.com Consulting Partner.  We specialize in the implementation of revenue stream optimization solutions based on salesforce.com. 

 

To support our rapidly expanding salesforce.com consulting practice, we are hiring full-time employees in Reston, VA, Chicago, IL, and New York, NY with experience and interest in one of the following roles:

 

Salesforce.com System Analysts & Project Managers

- Revenue stream business process analysis & design

- Salesforce.com design & configuration

- Data design, conversion & quality management

- Customized training development and delivery

 

Salesforce.com Developers

- S-Control development using AJAX toolkit and the Apex API

- Apex Code development, including SOAP web services and XML

- External system integration using tools such as Cast Iron

- Custom webpage design & development using HTML, Javascript, and Visualforce

 

Regardless of role, all candidates need to demonstrate strong consulting and client relations skills, including communications, problem solving and flexibility.  A good sense of humor and occasional business travel are also required.

 

In addition to a competitive salary and annual bonus program, ACF Solutions offers a full range of benefits, including health, dental, life, and AD&D insurance, a retirement savings plan with company matching, 3 weeks of paid time off and 9 paid holidays.

A career with ACF Solutions provides motivated employees with challenging opportunities and a chance to influence the development of a growing company.  Our client engagements include high visibility projects with industry leading companies.  Our employees work side-by-side with our clients to solve their business and technology challenges.  We frequently work on-site at client locations in a collaborative, team environment.  If you are motivated to contribute to the development of a dynamic organization, ACF Solutions may be the place for you.

 

We are looking for full-time employees local to VA/MD/DC, Chicago, or New York only.  No contractors or part-timers please.  All positions require a bachelor’s degree and authorization to work in the US for any employer without sponsorship (US citizen or permanent resident). 

 

Please submit your resume, cover letter, and salary requirements to jobs@acfsolutions.com

 

Find out more about ACF Solutions at www.acfsolutions.com

ACF Solutions is a business systems consulting firm and salesforce.com Consulting Partner.  We specialize in the implementation of revenue stream optimization solutions based on salesforce.com. 

 

To support our rapidly expanding salesforce.com consulting practice, we are hiring full-time employees in Reston, VA, Chicago, IL, and New York, NY with experience and interest in one of the following roles:

 

Salesforce.com System Analysts

- Revenue stream business process analysis & design

- Salesforce.com design & configuration

- Data design, conversion & quality management

- Customized training development and delivery

 

Salesforce.com Developers

- S-Control development using AJAX toolkit and the Apex API

- Apex Code development, including SOAP web services and XML

- External system integration using tools such as Cast Iron

- Custom webpage design & development using HTML, Javascript, and Visualforce

 

Regardless of role, all candidates need to demonstrate strong consulting and client relations skills, including communications, problem solving and flexibility.  A good sense of humor and occasional business travel are also required.

 

In addition to a competitive salary and annual bonus program, ACF Solutions offers a full range of benefits, including health, dental, life, and AD&D insurance, a retirement savings plan with company matching, 3 weeks of paid time off and 9 paid holidays.

A career with ACF Solutions provides motivated employees with challenging opportunities and a chance to influence the development of a growing company.  Our client engagements include high visibility projects with industry leading companies.  Our employees work side-by-side with our clients to solve their business and technology challenges.  We frequently work on-site at client locations in a collaborative, team environment.  If you are motivated to contribute to the development of a dynamic organization, ACF Solutions may be the place for you.

 

We are looking for full-time employees local to VA/MD/DC, Chicago, or New York only.  No contractors or part-timers please.  All positions require a bachelor’s degree and authorization to work in the US for any employer without sponsorship (US citizen or permanent resident). 

 

Please submit your resume, cover letter, and salary requirements to jobs@acfsolutions.com

 

Find out more about ACF Solutions at www.acfsolutions.com

Our requirement is to prevent users from causing the total price of an OpportunityLineItem to change when an Opportunity is in a closed stage.  We always have revenue schedules on every OpportunityLineItem.  Here is the dilemma:
 
- you can't have a trigger on OpportunityLineItemSchedule
- the SFDC background update to the OpportunityLineItem UnitPrice and TotalPrice that happens when the sum of the underlying schedule records change does not appear to fire an update trigger on OpportunityLineItem
 
Has anyone worked out a way to control revenue schedule changes?

I am writing a trigger to copy an auto-number field into another text field whenever an opportunity is created.  I'm using an "after insert" since I don't think an auto-number value is available in a "before insert".  The update executes successfully, but no data is actually populated in the record.  When I run the exact same code with an "after update", it works fine.  What am I missing here about "after insert"?

Code:
trigger CopyOptyID on Opportunity (after insert) {

// Only execute trigger if context variable indicates it has not executed already

if (!TriggerHelper.hasAlreadyCopiedOptyID()) 
{

// Initialize array to hold Opportunity records to be updated

 Opportunity[] newOpps = new Opportunity[]{};

// Loop through each Opportunity triggered and if type="New", copy Opty_ID to Original_Opty_ID

 for (Opportunity opps:Trigger.New) {

  if (opps.Type=='New')
  {
   Opportunity o = new Opportunity(Id=opps.Id);
   o.Original_Opty_ID__c=opps.Opty_ID__c;
   newOpps.add(o);
  }
 }

// Set context variable to indicate that trigger has already executed

 TriggerHelper.setAlreadyCopiedOptyID();

// Update Opportunity records

 try {
  System.debug(newOpps);
  update newOpps;
 } catch (DmlException e) {
   System.debug(e.getMessage());
 }

}

}


 

I'm writing a bunch of date logic and haven't been able to get the daysInMonth and isLeapYear methods to work.  When I go to save in Eclipse, I get "Method does not exist or incorrect signature". 
 
My basic code looks like:
 

Date startDate=oli.Project_Start_Date__c;

Integer startYear=startDate.year();

if (isLeapYear(startYear))

dostuff...;

Any ideas?

We are implementing the Google Adwords integration on a website built on .NET.  When we add the SFGA tracking Javascript code to the bottom of pages on the site, it seems to highjack the .NET managed buttons, such that they all throw a Javascript error.  Anyone have any advice?

ACF Solutions is a business systems consulting firm and salesforce.com Consulting Partner.  We specialize in the implementation of revenue stream optimization solutions based on salesforce.com. 

 

To support our rapidly expanding salesforce.com consulting practice, we are hiring full-time employees in our Reston, VA and Chicago, IL locations with experience and interest in one of the following roles:

 

Salesforce.com System Analysts

- Revenue stream business process analysis & design

- Salesforce.com design & configuration

- Data design, conversion & quality management

- Customized training development and delivery

 

Salesforce.com Developers

- S-Control development using AJAX toolkit and the Apex API

- Apex Code development, including SOAP web services and XML

- External system integration using tools such as Cast Iron

- Custom webpage design & development using HTML, Javascript, and Visualforce

 

Regardless of role, all candidates need to demonstrate strong consulting and client relations skills, including communications, problem solving and flexibility.  A good sense of humor and occasional business travel are also required.

 

In addition to a competitive salary and annual bonus program, ACF Solutions offers a full range of benefits, including health, dental, life, and AD&D insurance, a retirement savings plan with company matching, 3 weeks of paid time off and 9 paid holidays.

A career with ACF Solutions provides motivated employees with challenging opportunities and a chance to influence the development of a growing company.  Our client engagements include high visibility projects with industry leading companies.  Our employees work side-by-side with our clients to solve their business and technology challenges.  We frequently work on-site at client locations in a collaborative, team environment.  If you are motivated to contribute to the development of a dynamic organization, ACF Solutions may be the place for you.

 

We are looking for full-time employees local to VA/MD/DC or Chicago only.  No contractors or part-timers please.  All positions require a bachelor’s degree and authorization to work in the US for any employer without sponsorship (US citizen or permanent resident). 

 

Please submit your resume, cover letter, and salary requirements to jobs@acfsolutions.com

 

Find out more about ACF Solutions at www.acfsolutions.com

ACF Solutions is a business systems consulting firm and salesforce.com Consulting Partner.  We specialize in the implementation of revenue stream optimization solutions based on salesforce.com. 

 

To support our rapidly expanding salesforce.com consulting practice, we are hiring full-time employees in our Reston, VA and Chicago, IL locations with experience and interest in one of the following roles:

 

Salesforce.com System Analysts

- Revenue stream business process analysis & design

- Salesforce.com design & configuration

- Data design, conversion & quality management

- Customized training development and delivery

 

Salesforce.com Developers

- S-Control development using AJAX toolkit and the Apex API

- Apex Code development, including SOAP web services and XML

- External system integration using tools such as Cast Iron

- Custom webpage design & development using HTML, Javascript, and soon Visualforce

 

Regardless of role, all candidates need to demonstrate strong consulting and client relations skills, including communications, problem solving and flexibility.  A good sense of humor and occasional business travel are also required.

 

In addition to a competitive salary and annual bonus program, ACF Solutions offers a full range of benefits, including health, dental, life, and AD&D insurance, a retirement savings plan with company matching, 3 weeks of paid time off and 9 paid holidays.

A career with ACF Solutions provides motivated employees with challenging opportunities and a chance to influence the development of a growing company.  Our client engagements include high visibility projects with industry leading companies.  Our employees work side-by-side with our clients to solve their business and technology challenges.  We work on-site at client locations in a collaborative, team environment.  If you are motivated to contribute to the development of a dynamic organization, ACF Solutions may be the place for you.

 

All positions require a bachelor’s degree and authorization to work in the US for any employer without sponsorship (US citizen or permanent resident). Local VA/MD/DC or Chicago candidates only.  Principals only.

 

Please submit your resume, cover letter, and salary requirements to jobs@acfsolutions.com

 

Find out more about ACF Solutions at www.acfsolutions.com

We have a pretty typical Sites login page for a Customer Portal.  We are finding that if the user logs in successfully, closes just that one browser tab, opens a new tab, and then attempts to login again, they get one of those generic "An error has occurred loading a Visualforce page" errors.  If the user logs out first, or closes the browser entirely, they can login fine. 

 

Seems like something to do with the session cookie but not sure not to work around it.  Any suggestions?

We have a Site "approval" which contains a page that has fielded data from a custom object record and a link to an attachment to that record (like http://xxx.dev.cs2.force.com/approval/servlet/servlet.FileDownload?file=00PR0000000hPpZ).  It all worked fine with public sharing. 

 

However, when we turned sharing for the object to private, the data from the object still displays fine, but when you click the link to the attachment, you get an Authorization Required error.

 

My understanding is that if you have read permission to a particular record via sharing, you can download attachments to that record.  But that does not seem to be the case.

 

Any thoughts?

We are building an integration that requires us to send a time value that is within 30 seconds of the NIST standard time.  Does anyone know if the Salesforce server timestamp is synced to NIST?

Hello.  I have a client who uses Convio Common Ground, which is a managed package.  I wrote an opportunity trigger to do some custom YTD calculations and update a YTD field in the Contact record.  The trigger seems to works fine for single records, but when the client does a mass update of as few as 10-12 opps using the Data Loader, sometimes the opp trigger fails, but the error actually originates in Common Ground's own contact trigger.

[My opp trigger is CalcYTDAmounts, their contact trigger is cv.ContactAll:]

"CalcYTDAmounts: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 0038000000j3NvyAAE; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, cv.ContactAll: execution of BeforeUpdate caused by: System.Exception: cv:Too many script statements: 11001"

My opp trigger code is definitely bulkified - I've written many other bulk triggers before, but not in situations where managed packages are also triggering actions.

I opened a case with Convio and they suggested  A) try reducing the batch size to 1 and B) "write trigger recursion safeguards into your code."

I've searched the forums and documentation but haven't found enough info to help me understand how to detect/prevent trigger recursion, esp. when managed package code is involved.  Can anyone suggest some examples?

Thanks
David

 

We have a working process where the user submits a Visualforce form which causes a Visualforce PDF to be created and emailed to the user.  We want the same PDF generation/email to happen on a daily schedule.  So we have made some changes to invoke similar functionality via the Apex Scheduler.  The scheduled class runs without any error messages and a PDF email gets sent, but the PDF is unable to be opened (indicating that something went wrong in the Visualforce rendering of it).

 

We have tested the functionality using anonymous execute and it works fine.  Seems to be a problem related to it being run by the scheduler.  Is there a limitation where you can't invoke Visualforce (new PageReference / getContent()) from within a scheduled Apex class?

Hi Friends ,

 

I need some advice on writing a batch apex

 

I am calling a Batch Apex let say to insert contacts for Account SObject

I am having more than 100,000  Account Records, so these are devided in to

several Batch processes let say 200 each .

 

For all the new contact records , iam adding them to a Contact List and upserting them at the end.

 

For one of these batch process , the log is showing "Too many DML rows:15034"

 There may be a chance that few Accounts having large number of contact , and I am getting this error.

Remaining batch process are running with out any problem.

 

I thought the list cannot accomodate more than 10,000  so i used List<List<Contact>>

and for everytime the new record  count increases 2000 i am inserting into a new list.

and upserting each List<Contact> by looping through List<List<Contact>>

Even then I am getting  "Too many DML rows:10030".

 

Please let me know, that there is any certain limit to upsert records fort a single Batch Process?

 

  • February 15, 2010
  • Like
  • 0

Is there any method in Apex which allows to move a selected opportunity to next stage.

 

Something like

opportunity o = [Select Id from Opportunity where Id ='asdsdasd' limit 1]; o.StageName = o.nextStage(); update o;

 

We are looking for a Salesforce Developer to help us with some immediate projects, as well as build a relationship for ongoing support and development. We use Salesforce for ~80% of our business operations, and will need continual support in the coming months.

 

We currently have a few projects needing immediate attention including:

  • Partner Portal Implementation
  • Cleaning up profiles and roles
  • Updating and Configuring existing Adobe Flex within Salesforce
  • Updating fields so they are shown on multiple objects
  • Setting up validation rules and requirements (not just basic validation rules- we need some coding)
  • Updates to an existing page layout (fields, custom buttons, custom objects, formula fields, validation rules, etc) 

 

Please let me know if you can help!

Thanks

  • February 04, 2010
  • Like
  • 0
I am looking for someone to assist me in developing/launching a SalesForce-enabled community that supports Ideas.

I'm pretty sure I'm just trying to do some straightforward AJAX here.  When I use oncomplete or reRender widhin actionFunction, I see the following Javascript error (via Firebug):

 

element.selectNodes is not a function

 

And the Javascript engine basically choke at this point.   The error happens within the Salesforce AJAX library: 

3_3_0.GAorg.ajax4jsf.javascript.AjaxScript on line 101.  This occurs at a point where the code does a try{selectNodes()} to figure out of it should run either selectNodes() or getElementsByTagName().  If the try{} fails, the catch(){} should run the getElementsByTagName().

 

I've seen this in FF3.5.6, though things seem to work fine in FF3.0.16.   In IE7 and IE8 I get data back inconsistently.  Generally if I put trash data in yahooProduct and then try good data, I will things will work fine.  However, until I do this special sequence, the AJAX will not work in IE.  I know, this part this sounds like a bug of my own making... probably is... but for the life of me I cannot pin point it.  The code isn't all that complicated.

 

If I take out oncomplete and reRender, I get no Javascript errors.  Of course, I have no way to see if the AJAX did anything, either.

 

Strangely, I can find no references to this issue on the discussion boards.  I'm not doing anything particularly fancy.  Anything stand out in my code below?

 

 

My Visualforce:

 

 

<apex:page standardController="Purchase__c" extensions="PurchaseExtension" recordSetVar="purchases" title="New Purchase">

<apex:sectionHeader title="Purchase Edit" subtitle="New Purchase"/>

<apex:messages layout="table"/>

<style>
td.labelCol {
vertical-align: middle;
}
</style>
<apex:form styleclass="p-form" id="p_form">

<apex:pageBlock title="Purchase Edit" mode="edit">

<apex:actionFunction name="updateProductDetails" action="{!updateProductDetails}" immediate="true" reRender="field_table">
<apex:param name="firstParam" assignTo="{!yahooProduct}" value="" />
</apex:actionFunction>

<apex:outputPanel id="field_table">
<table cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td class="labelCol requiredInput">Contact</td>
<td class="dataCol col02" style="height:20px;">
<apex:inputField value="{!p.Contact__c}" required="true"/>
</td>
</tr>
<tr>
<td class="labelCol requiredInput">Purchase Date</td>
<td class="dataCol col02">
<apex:inputField value="{!p.Purchase_Date__c}" required="true"/>
</td>
</tr>
<tr>
<td class="labelCol requiredInput">Yahoo! Product</td>
<td class="dataCol col02">
<apex:inputField value="{!p.Yahoo_Product__c}" required="true" onchange="updateProductDetails(this.value)" />
</td>
</tr>
<tr>
<td class="labelCol requiredInput">Item Description</td>
<td class="dataCol col02">
<input disabled="true" id="item-desc" type="text" value="{!productDesc}"/>
</td>
</tr>
<tr>
<td class="labelCol requiredInput">Item Price</td>
<td class="dataCol col02">
<input disabled="true" id="item-price" type="text" value="{!productPrice}"/>
</td>
</tr>
<tr>
<td class="labelCol requiredInput">Quantity</td>
<td class="dataCol col02">
<apex:inputField value="{!p.Quantity__c}"/>
</td>
</tr>
<tr>
<td class="labelCol requiredInput">Total</td>
<td class="dataCol col02">
<input id="total" type="text"/>
</td>
</tr>
<tr>
<td class="labelCol requiredInput">Ship Date</td>
<td class="dataCol col02">
<apex:inputField value="{!p.Ship_Date__c}" />
</td>
</tr>
</tbody>
</table>
</apex:outputPanel>

<apex:inputHidden value="{!p.Name}"/>
<apex:inputHidden value="{!p.Contact__c}"/>

<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>

</apex:pageBlock>

</apex:form>

</apex:page>

 

 

 

 and my Extension:

 

 

public class PurchaseExtension {
public Purchase__c p {
get {
if (p == null)
p = new Purchase__c();
return p;
}
set;
}

public Contact c {
get {
String contactId = Apexpages.currentPage().getParameters().get('id');
if (c == null) {
c = [select c.FirstName,c.LastName from Contact c where c.id = :contactId];
}
return c;
}
set;
}


String productDesc, productPrice;
public String getProductDesc() {
return productDesc;
}
public String getProductPrice() {
return productPrice;
}

String yahooProduct = 'init';
public void setYahooProduct(String p) {
yahooProduct = p;
}
public String getYahooProduct() {
return yahooProduct;
}

public PageReference updateProductDetails() {
if (yahooProduct != null) {
List<Yahoo_Products__c> yp = [select p.Item_Description__c,p.Price__c from Yahoo_Products__c p where p.Name = :yahooProduct];
if (yp.size() > 0) {
productDesc = yp[0].Item_Description__c;
productPrice = ''+yp[0].Price__c;
} else {
productDesc = 'No product details avalable';
productPrice = 'No product details avalable';
}
} else {
productDesc = 'No product?';
productPrice = 'No product?';
}
return null;
}

public PurchaseExtension(ApexPages.StandardSetController ctlr) {
p.Contact__c = c.Id;
p.Purchase_Date__c = Date.today();
}

public PageReference save() {
PageReference pr = null;
// stub
return pr;
}

public PageReference cancel() {
// stub
return null;
}

public static testMethod void testSave() {
Test.setCurrentPage(new PageReference('/?id=003A0000004JoTl'));
List<Purchase__c> pList = new List<Purchase__c>();
ApexPages.StandardSetController ctlr = new ApexPages.StandardSetController(pList);
PurchaseExtension e = new PurchaseExtension(ctlr);
e.c = new Contact(FirstName = 'Foo', LastName = 'Bar');
e.p.Yahoo_Product__c = 'a04A000000101DT';
e.save();
System.assertNotEquals(e, null);
}

public static testMethod void testUpdateProduct() {
Test.setCurrentPage(new PageReference('/?id=003A0000004JoTl'));
List<Purchase__c> pList = new List<Purchase__c>();
ApexPages.StandardSetController ctlr = new ApexPages.StandardSetController(pList);
PurchaseExtension e = new PurchaseExtension(ctlr);
e.setYahooProduct('HistProd');
e.updateProductDetails();
String newDesc = e.getProductDesc();
System.assertNotEquals(newDesc, null);
}
}

 

 

 

 

Message Edited by JasonGabler on 01-05-2010 11:13 AM
Message Edited by JasonGabler on 01-05-2010 02:37 PM
I finally got around to starting development in Sandbox of using APEX + Controllers + VF to manipulate CRM Content objects but I immediately ran into a roadblock where perhaps you can help:

1.      

  1. Force.com IDE is at V16.0 because SFDC chose not to release a version 17 IDE; we apparently have to wait until Spring 10 (Version 18).    
  2. Because of this, the Schema that shows in Eclipse IDE is only V16.0 objects and thus excludes the CRM Content objects.
  3. Therefore, I can’t develop any code to use the CRM Content objects because the Schema isn’t aware of them.
  4. I tried changing the package.xml to <version> tag from <version>16.0</version>
    to <vesion>17.0</version> but this made no difference.
  5. Is there some other trick I am missing here?  Or must I wait until Spring 10?  (using the WSAPI is not an answer here)

Thanks

 

Eric

I'd like to automatically format the Account Name field in the standard Accounts object based on the value of a few select custom fields.

 

This is something I'd normally create a formula for, but there's no way to do that on standard field as far as I can see.

 

Basically, let's say I'm editing or creating a new account inside salesforce.com -- I have the following custom fields:

 

Prefix

First Name

Last Name

Middle

Suffix

 

 

I'd like to set it up so the standard account name fields gets updated via JavaScript as the values in those custom fields are modified.

 

Is this possible, or a pipe dream?

Hello.

We would like to customize a few things in SF and looking for someone to help us sort out how to do this and also to implement.

We need help with our quoting/mail merge area in SF, creating a custom database of special subscribers and possibly some help setting up forecasting reports.

 

We work in SF Professional Edition.  Located in Mpls (outside of this area is ok but only in the U.S.)

 

Thanks!

  • September 15, 2009
  • Like
  • 0

From a custom detail page button, we want to display a prepopulated Send an Email form.  Forming the email body takes some data queries, so we are using a Visualforce page that onload calls a controller method to assemble the data and then return a PageReference to the emailauthor page with URL parameters.  A Visualforce email template won't work for our use case since it would need to be an HTML template and those aren't editable by the user before sending.

 

The good news is that this design works fine in sandbox.  However, in production it works sometimes, while other times the emailauthor page displays without any fields populated from the URL parameters.  The behavior is very flaky (for the same record, it will work once, then not the next time, then everytime one day, and none the next day).  It does not appear to dependent on the content/size of the data in the parameters.

 

Does anyone have an idea why a redirect to emailauthor would work consistently in sandbox and inconsistently in production?

Background:
Our application overrides the tab for an custom object with a Visualforce page.

The tab URL itself is set by salesforce & always goes to the "/servlet/servlet.Integration" page provided by salesforce.  A series of redirects takes place and the user is eventually redirect to our app's Visualforce domain (https://i.xyz.visual.force.com/apex/aaPendingAddrs).

Bug:
In the past week or so, something has broken in this redirect sequence.  Specifically, logging into to multiple salesforce instances no longer works.  Once you have visited a Visualforce page in one instance, you have to completely close your browser before you can use a Visualforce page on another instance.  Using the "logout" functionality does not work - you must completely close all browser windows.

It appears that salesforce is setting a session-length cookie in the global ".salesforce.com" domain that holds which instance should serve your Visualforce pages.  This behavior is new, and has severe consequences.  We've gotten a lot of customer calls, and we've seen problems crop up strangely multiple times.

 

I spent some time this morning documenting what I could find.  I doubt the bug is restricted solely to tabs-overriden-with-Visualforce-pages .. this probably happens whenever Visualforce pages are used.

 

 

The bug strikes in a variety of ways.  In my examples below, I first logged into an EE instance on NA4 and then logged into an EE "test edition" org on NA5.  If you watch the AVI's carefully, you will see the URL change unexpectedly from one instance back to the other.

 

 

 

1.  Login to instance 1 (na4), go to Visualforce page, then login to instance 2 (na5), then go to the Visualforce tab.  Salesforce will try to redirect to an incorrect (non-namespaced) URL in instance 1 (na4):

Here are AVIs of the bug in Firefox, IE, and Chrome.

Here's a snapshot of the error screen:

 

 

Here's a snapshot of Firebug (Firefox dev. plugin) tracing the redirect from na5 to na4:

 

 

 

 

2.  Similar to above, but try to be a good citizen and "logout" between logins:  Login to instance 1, go to Visualforce page, logout, login to instance 2, go to the visualforce tab.  Salesforce will launch into an infinite redirect loop that ends with an error being displayed to the user (exactly which error depends on the browser).


Here are AVIs of the bug in Firefox, IE, and Chrome.


Here's a snapshot of the "infinite loop" message in firefox:

 

 

 

 

 

3.  Depending on the sequence of clicks, you can also get a situation where no visible error occurs BUT when you click to a Visualforce page on one instance, you actually end up in the other instance.  This might be the worst way that the bug strikes, because you are silently in the wrong build!

Here's an AVI of that happening in Firefox.  I use two tabs (one in each instance) to show the sequence of clicks.  Note the first tab (na4) ends up at na5 when I click the "Emails" tab!

 
 Salesforce: I have opened case 02627980 to track this issue.
Message Edited by jhart on 05-04-2009 11:11 AM
  • May 04, 2009
  • Like
  • 0

I have an online lead generation business and a subscription to Salesforce.com Enterprise Edition. 

I want to find someone who's experienced with Salesforce's API and can help me create some tight, simple PHP code to insert and update Person Accounts in Salesforce.com from the forms on my websites. 

These are pretty simple HTML form, think 10-20 fields max. The architecture is as follows: 
- each Person Account will be uniquely ID'd by a combo of IP address and name, or, if no name is given (which is a possibility), just IP address 
- when a form is submitted, the script needs to: 

1) search Salesforce to see if that combo of IP and name already exists as a Person Account 
2) if it does, then create a closed Opportunity for that Person Account which contains info on the form submitted (the university degree program the person is interested in, the $$ value of that lead, the time/date submitted, etc.) 
3) if it does not, then create the Person Account record first (with IP, source info, name and address etc. from the form), and then create the Opportunity per #2 above 

I use a handful of the out-of-the-box fields for Person Account objects, and a bunch of custom ones.  The code will need some rudimentary error handling etc. as well.

 

This should be very easy money for someone who knows PHP and the Force.com API.  I have to believe there are people out there who have created this exact kind of setup before.

 

I know a little bit of PHP and a very little bit about the API, and this is an important enough piece of code that I would rather just pay someone and make sure it's done right. 

Please respond with details of your experience with both PHP and the Force.com API. 

Thanks! 
Joe

  • April 23, 2009
  • Like
  • 0
It seems that the related lists rendered by <apex:detail> as well as <apex:relatedList> do not respect sharing rules.  Is this expected behavior or am I missing something?

We are interested in organizing a Developer meeting in the greater Washington DC area. Let us know if interested.

Thanks

Tony 

Our requirement is to prevent users from causing the total price of an OpportunityLineItem to change when an Opportunity is in a closed stage.  We always have revenue schedules on every OpportunityLineItem.  Here is the dilemma:
 
- you can't have a trigger on OpportunityLineItemSchedule
- the SFDC background update to the OpportunityLineItem UnitPrice and TotalPrice that happens when the sum of the underlying schedule records change does not appear to fire an update trigger on OpportunityLineItem
 
Has anyone worked out a way to control revenue schedule changes?