• CliffA
  • NEWBIE
  • 25 Points
  • Member since 2007

  • Chatter
    Feed
  • 1
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 17
    Replies
Is there any reason the Schema.getGlobalDescribe() method would suddenly stop returning anything?  I have noticed this strange intermittent behavior seems to start when I run test cases.  Sometimes the getGlobalDescribe will just stop returning anything for a day or so and then it just magically starts back up again.
 
Any info on why this happens would be much appreciated.  Thanks.
 
 
Shiztastic


Message Edited by Shiztastic on 10-21-2008 02:45 PM

Has anyone else noticed different behavior for unit tests that are in a managed package?  

 

We have a managed package installed in a few hundred client orgs.  For years we've had clients run a script that would modify page layouts using the metadata API and it worked fine.  In the last couple of weeks, however, clients running our script are seeing unit test failures for tests that are within our managed package.  The test failures vary from client to client with the exception of one class that's pretty consistently failing.  The failures also seem to be more prevalent with asynchronous batch apex code - note we are enclosing the batch processing within the StartTest and StopTest commands.

 

Our first thought is that there are some sort of customizations or live data in the client org that are interfering with our tests so we tried to replicate the behavior in a trial org with our package and we're seeing similar problems.  

 

The big challenge is that it's very difficult to debug because the failures only occur in client orgs so the debug info is limited, even when we're logged into the client org using the "Subscriber Access" option.

 

Did something change on the SF side regarding unit test execution for packaged tests?  

  • October 29, 2012
  • Like
  • 0

We're using the new Apex Install Script feature and we're getting an error on package install.

 

When the attempt to install the package fails we receive the following email from Salesforce:

 

The package installation failed. Please provide the following information to the publisher:

 

Organization Name: [org name] Organization ID: [org id]

Package: [package name]

Version: 6.2

Error Message: The post install script failed.

 

Thank You,

salesforce.com

 

That doesn't really give us much to go on.  Does anyone know of a way to get more details about the failure?  Ideally we want to know what line number of the install handler or the exception that caused the problem.

  • August 03, 2012
  • Like
  • 0

I have a trigger that fires when accounts are merged so that the surviving account has a untion of territory assignments for the two accounts.  For example, if the master account is in territory A and the duplicate is in territory B then after the merge the master account is associated with both territories A and B.

 

The problem is that for certain records I'm getting an error on insert into AccountShare.

 

My original code was this:

 

List<AccountShare> acctSharesList = acctToShares.get(c.AccountId); // list of shares from "duplicate" account
for (AccountShare a : acctSharesList) {
AccountShare tmpAS = new AccountShare();
tmpAS.AccountId = masterContacts.get(c.MasterRecordID).AccountId; // get Account ID of Master account
tmpAS.UserOrGroupId = a.UserOrGroupId; // Get id from Duplicate account
// Don't add the share if the master already has it
if (!(masterAcctToShares.get(tmpAS.AccountId).containsKey(tmpAS.UserOrGroupId))) {
newAccountShares.add(tmpAS);
}
}

// add new entries for the territories
insert newAccountShares;

 

 

For some records when the trigger executes I get the following error:

 

First exception on row 0 with id 0034000000Xewa8AAB; first error: DELETE_FAILED, ContactMerge: execution of AfterDelete

caused by: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, missing required field: AccountAccessLevel: [AccountAccessLevel]

 

 

So, in response I updated the trigger to set that value (and another value based on an interim error that I haven't included in this post):

 

List<AccountShare> acctSharesList = acctToShares.get(c.AccountId); // list of shares from "duplicate" account
for (AccountShare a : acctSharesList) {
AccountShare tmpAS = new AccountShare();
tmpAS.AccountId = masterContacts.get(c.MasterRecordID).AccountId; // get Account ID of Master account
tmpAS.UserOrGroupId = a.UserOrGroupId; // Get id from Duplicate account
tmpAS.AccountAccessLevel = 'Read';
tmpAs.OpportunityAccessLevel = 'None';
// Don't add the share if the master already has it
if (!(masterAcctToShares.get(tmpAS.AccountId).containsKey(tmpAS.UserOrGroupId))) {
newAccountShares.add(tmpAS);
}
}

// add new entries for the territories
insert newAccountShares;

 

 

Now I get the following error:

 

First exception on row 0 with id 0034000000Xewa8AAB; first error: DELETE_FAILED, ContactMerge: execution of AfterDelete

caused by: System.DmlException: Insert failed. First exception on row 1; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: AccountAccessLevel (Access level should not be specified on territory manual assignment): [AccountAccessLevel]

 

So the first error tells me the AccountAccessLevel is missing but when I add it to the trigger the error changes and it tells me it shouldn't be specified.

 

Not quite sure what to make of these seemingly contradictary results.

 

Has anyone encountered this before of have any suggestions?

 

Want to build a full-featured application on Force.com?

 

Want to help non-profits achieve their mission?

 

Convio (http://www.convio.com/commonground) is looking for an experienced Force.com engineer to help us expand our Common Ground Donor Database product built on Salesforce.com.  This is a unique opportunity
to be in on the early stages of a new product within an established
company.

 

Learn more and apply online!

 

  • March 11, 2010
  • Like
  • 0

I need to test some Apex code that will behave differently depending on whether or not the user is assigned to the same territory as the objects they're looking for.

 

I have two classes with the 'with sharing' and 'without sharing' keywords and and they work as expected when testing the code via the UI.  Now I want to write unit tests and I'm running into trouble.  Here's what I'd like to do but can't:

 

  1. Create two territories, one that the user will belong to and one that they won't
  2. Create a new user
  3. Assign the new user to one of the territories by inserting into the UserTerritory object
  4. Create a 2 new accounts and assign one to the user's territory and one to the other territory
  5. Perform tests to ensure everything works as expected

I run into trouble at step 3 - DML is not allowed on this object.

 

I could add "real" data to use for the tests but I'd rather not rely on that for my unit test. 

 

Does anyone have any suggestions on how to best test territory behavior in this scenario?

  • March 26, 2009
  • Like
  • 0

I have an Apex class that's doing some behind the scenes duplicate detection on accounts/contacts.  The org has Territories enabled so the Apex code is operating at the system level so it can see across all territories.

 

Here's a brief description of what I want to do: Before a user adds a new contact we do a quick lookup using VisualForce and Apex.  If a matching account/contact is found in a territory that the user doesn't belong to I'd like to manually assign the matching Account to the user's territory.  What's the best way to:

  1. Determine the current user's territory via Apex? 
  2. Manually assign the Account to the user's territory via Apex?
  • March 18, 2009
  • Like
  • 0

I'm creating a new VF page to replace the standard SF view and edit layouts.  I overrode the new, edit and view buttons on the object to all point to my new VF page.


Regardless of whether you click the edit or view links the form always comes up in Edit format.  This isn't surprising since my fields all use the <apex:inputField> tag.  This leads me to my question.

 

What's the best practice for supporting both edit and view modes for a VF page? 

 

I could create two VF pages, one for editing (with <apex:inputField> tags) and one for viewing (with <apex:outputField> tags) but that seems like a less than ideal solution.

 

Are there other options?

 

Thanks...

  • February 16, 2009
  • Like
  • 0

I have two custom objects with a parent/child relationship.  Using the standard SF pages, if I click on the "New [Child Object]" button in the related list section of the Parent record the new child record page comes up with the reference field to the parent pre-filled with the parent's name.

 

If, however, I override the "New [Child Object]" button to point to my VisualForce page for the child the Parent's reference field is not pre-filled with the parent's name.  I don't want to force my users to manually enter the parent's name as that's not consistent with standard SF pages plus it's a pain.

 

Is there a way to pre-fill fields on a VisualForce page in this scenario? 

 

 

  • February 14, 2009
  • Like
  • 0
I have a custom field on the contact record that needs to be updated once a year to summarize YTD and Prior Year activity.  I can't use the standard SF rollup fields because it is not possible to dynamically specify the "current year" in the calculation.  I also can't hard-code the current year because the field is part of a package and I don't want to force users to install a new package at the start of every year.  Note that a trigger maintains the YTD/Prior Year activity fields on an ongoing basis.  The bulk update is used at the beginning of a new year to essentially move the YTD amount to the Prior Year field and reset the YTD field to 0.

I've thought through/tried a few solutions but none of them are viable/palatable:
  1. Use VisualForce to create a page with a button that would initiate the mass-update via an @future Apex method.  Good in concept but I'll quickly run into governor limits.
  2. Use the VisualForce/button solution and have the user initiate the update multiple times, biting off chunks of the data each submission that will fall under the governor limits.  Not a practical solution from a user interface perspective.
  3. Use an s-control and make multiple API calls that are within the governor limits.  This would work but it feels wrong to rely on the browser to perform a bulk-update
I couldn't find any other posts on this issue but I suspect others have faced this.  Has anyone else come up with a solution to this challenge that they can share?

Thanks...




  • December 09, 2008
  • Like
  • 0
We've been working on an app that incorporates PersonAccounts but we've run into a problem.  It's not possible create packages containing components that reference PersonAccounts.

We took the PersonAccount route because we will have both organizational and individual "customers" and we want their records to be peers for the purposes of reporting and association with opportunities.

Given that we can't package PersonAccount packages we began to wonder why we couldn't just create a new Account record type of "Individual" and create some supporting custom fields (i.e. first name, last name, email, etc...) and then create two page layouts: one tailored to Organizations and one tailored to Individuals.

Clearly SF could have done this too instead of creating the hybrid PersonAccount structure but we're not sure why, although I imagine there's a good reason.  Can anyone explain or offer concrete reasons why we one shouldn't add custom "individual" fields to the account object and have two record types?

Thanks.....


  • April 28, 2008
  • Like
  • 0
I'm working on an app that is based upon the PersonAccount model (http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_guidelines_personaccounts.htm) and when I attempt to create a package for it I receive the error "Salesforce does not currently allow export of components referencing person account fields."

Does anyone know if SF has plans to support PersonAccounts in packages and if so, when?

Thanks.....
  • April 14, 2008
  • Like
  • 0
A simple question regarding the interaction of the API and the Apex Governors.

Assuming I have a before-update trigger on account and I update 1000 accounts in one batch via the API is my trigger called 1 time with 1000 elements in trigger.new or is my trigger called 1,000 times each time with only 1 element in trigger.new?

Thanks....
  • January 10, 2008
  • Like
  • 0
If I develop and package an application that uses Apex code (i.e. a trigger) are there limitations on the SF Editions that my application can be installed on? 

In other words, can my application be installed on Group, Professional, Enterprise etc... editions or can it only be installed on editions that include Apex (i.e. the Unlimited version as defined here: http://www.salesforce.com/products/editions-pricing/feature-comparison/)

Thanks,
Cliff
  • November 28, 2007
  • Like
  • 1
If I develop and package an application that uses Apex code (i.e. a trigger) are there limitations on the SF Editions that my application can be installed on? 

In other words, can my application be installed on Group, Professional, Enterprise etc... editions or can it only be installed on editions that include Apex (i.e. the Unlimited version as defined here: http://www.salesforce.com/products/editions-pricing/feature-comparison/)

Thanks,
Cliff
  • November 28, 2007
  • Like
  • 1

We're using the new Apex Install Script feature and we're getting an error on package install.

 

When the attempt to install the package fails we receive the following email from Salesforce:

 

The package installation failed. Please provide the following information to the publisher:

 

Organization Name: [org name] Organization ID: [org id]

Package: [package name]

Version: 6.2

Error Message: The post install script failed.

 

Thank You,

salesforce.com

 

That doesn't really give us much to go on.  Does anyone know of a way to get more details about the failure?  Ideally we want to know what line number of the install handler or the exception that caused the problem.

  • August 03, 2012
  • Like
  • 0

I have a simple VisualForce window that works fine in my DE org.  It is basically a shell that passes context via {!} expressions to a Flex swf file.  Here is the source in the DE org:

 

<apex:page standardController="A_R_Summary__c" sidebar="true" showHeader="true">
   
  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="SliderGraphic" width="100%" height="100%"
          codebase="https://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
    <param name="movie" value="{!$Resource.SliderGraphic}" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#869ca7" />
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="flashVars" value="arId={!A_R_Summary__c.account__r.id}&arDate={!A_R_Summary__c.Date__c}&accountId={!A_R_Summary__c.id}" />
    <embed src="{!$Resource.SliderGraphic}"
           width="100%"
           height="300"
           quality="high"
           bgcolor="#869ca7"
           name="SliderGraphic"
           align="middle"
           play="true"
           loop="false"
           quality="high"
           allowScriptAccess="sameDomain"
           type="application/x-shockwave-flash"
           pluginspage="https://www.adobe.com/go/getflashplayer"
           flashVars="arId={!A_R_Summary__c.account__r.id}&arDate={!A_R_Summary__c.Date__c}&accountId={!A_R_Summary__c.id}">
    </embed>
  </object>
</apex:page>

 

Problems occur when I install it in another org.  The controller reference is updated with the namespace, but the {!} references are not.  The page cannot render and generates the error:


Unknown property 'testdfc1__A_R_Summary__cStandardController.A_R_Summary__c'

Here is the page in the installer org:

 

<apex:page standardController="testdfc1__A_R_Summary__c" sidebar="true" showHeader="true">



<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="SliderGraphic" width="100%" height="100%"

codebase="https://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">

<param name="movie" value="{!$Resource.SliderGraphic}" />

<param name="quality" value="high" />

<param name="bgcolor" value="#869ca7" />

<param name="allowScriptAccess" value="sameDomain" />

<param name="flashVars" value="arId={!A_R_Summary__c.account__r.id}&arDate={!A_R_Summary__c.Date__c}&accountId={!A_R_Summary__c.id}" />

<embed src="{!$Resource.SliderGraphic}"

width="100%"

height="300"

quality="high"

bgcolor="#869ca7"

name="SliderGraphic"

align="middle"

play="true"

loop="false"

quality="high"

allowScriptAccess="sameDomain"

type="application/x-shockwave-flash"

pluginspage="https://www.adobe.com/go/getflashplayer"

flashVars="arId={!A_R_Summary__c.account__r.id}&arDate={!A_R_Summary__c.Date__c}&accountId={!A_R_Summary__c.id}">

</embed>



</object>



</apex:page>

 

 

As you can see, the controller attribute is updated to include the namespace, but the other references are not.  If I attempt to manually prefix these {!} references in the DE org with the namespace, I cannot save the file.

 

Can someone help me?  Thanks!

 

Dave

 

  • May 12, 2009
  • Like
  • 0

Hi

 

I have been looking at the various bulk trigger solutions regarding the "Too many SOQL queries: 101" error.

 

I'm not sure how to reorganise the following code to get over the SOQL limit as it needs to lookup two fields in a custome object. Would I use a map here? The code works but fails with a larger record set.

 

Thanks in advance.


trigger targetCompanyDuplicatePreventer on TargetCompany__c (before insert, before update) {

    for (TargetCompany__c tc : System.Trigger.new) {
        // Check if either Account or Target Company List is blank
        if (tc.Account__c == Null || tc.TargetCompanyList__c == Null){
            tc.Account__c.addError('Account or Target Company List cannot be blank. Please select a value.');
        }
        else {
   TargetCompany__c[] duplicateCheck = [select Id from TargetCompany__c where Id != :tc.Id AND Account__c = :tc.Account__c AND TargetCompanyList__c = :tc.TargetCompanyList__c];
   if (duplicateCheck.size() > 0){
    tc.Account__c.addError('Duplicate combination exists. Please enter unique values.');
   }
  }
    }
}

I have two custom objects with a parent/child relationship.  Using the standard SF pages, if I click on the "New [Child Object]" button in the related list section of the Parent record the new child record page comes up with the reference field to the parent pre-filled with the parent's name.

 

If, however, I override the "New [Child Object]" button to point to my VisualForce page for the child the Parent's reference field is not pre-filled with the parent's name.  I don't want to force my users to manually enter the parent's name as that's not consistent with standard SF pages plus it's a pain.

 

Is there a way to pre-fill fields on a VisualForce page in this scenario? 

 

 

  • February 14, 2009
  • Like
  • 0
I have a custom field on the contact record that needs to be updated once a year to summarize YTD and Prior Year activity.  I can't use the standard SF rollup fields because it is not possible to dynamically specify the "current year" in the calculation.  I also can't hard-code the current year because the field is part of a package and I don't want to force users to install a new package at the start of every year.  Note that a trigger maintains the YTD/Prior Year activity fields on an ongoing basis.  The bulk update is used at the beginning of a new year to essentially move the YTD amount to the Prior Year field and reset the YTD field to 0.

I've thought through/tried a few solutions but none of them are viable/palatable:
  1. Use VisualForce to create a page with a button that would initiate the mass-update via an @future Apex method.  Good in concept but I'll quickly run into governor limits.
  2. Use the VisualForce/button solution and have the user initiate the update multiple times, biting off chunks of the data each submission that will fall under the governor limits.  Not a practical solution from a user interface perspective.
  3. Use an s-control and make multiple API calls that are within the governor limits.  This would work but it feels wrong to rely on the browser to perform a bulk-update
I couldn't find any other posts on this issue but I suspect others have faced this.  Has anyone else come up with a solution to this challenge that they can share?

Thanks...




  • December 09, 2008
  • Like
  • 0
Is there any reason the Schema.getGlobalDescribe() method would suddenly stop returning anything?  I have noticed this strange intermittent behavior seems to start when I run test cases.  Sometimes the getGlobalDescribe will just stop returning anything for a day or so and then it just magically starts back up again.
 
Any info on why this happens would be much appreciated.  Thanks.
 
 
Shiztastic


Message Edited by Shiztastic on 10-21-2008 02:45 PM
Hi,
  In our application, the WSDL file has been created from Apex class.
I have created client stubs out of this WSDL. How can I invoke the Webservice from a
stand-alone java application?
Also, How can I download the Salesforce library files related to apex classes?
 
Thanks in advance.
 
 
  • August 06, 2008
  • Like
  • 0
    Hi Folks,
                  Can any one clarify my doubt! Is salesforce automation system is enterprise application or hosted application!

is there any difference between sales force and sales force automation system?

Thanks & Regards,
 Rajeshwar.

I'm working on an app that is based upon the PersonAccount model (http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_guidelines_personaccounts.htm) and when I attempt to create a package for it I receive the error "Salesforce does not currently allow export of components referencing person account fields."

Does anyone know if SF has plans to support PersonAccounts in packages and if so, when?

Thanks.....
  • April 14, 2008
  • Like
  • 0
I have a very basic custom object in which I need to prevent duplicates(exact match).  I cannot just use a "unique" value though, because in certain circumstances duplicates should be allowed.  What I want to do is create a validation rule where if an "override" box is checked the rule will allow duplicates, but otherwise it won't.  Can someone please help me with the code?
 
Initially I tried:
 
REGEX ( field , field)  The only problem is that it checks itself and thinks every entry is a duplicate.
 
Please help!