• gjs
  • NEWBIE
  • 10 Points
  • Member since 2005

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 22
    Replies

We have a beta version of a functional equivalent of TRUNCATE SQL available on Sandbox organizations. Please open a case with support if you would like to try it out.  We will make a decision on when to GA based on adoption and feedback.

 

 

Truncating a custom object does the following:

  • Permanently disassociates ALL the object's data records from the object. You will not be able to operate on them using this object and they will not be recoverable from the Recycle Bin.
  • Recalculates values in Roll Up Summary Fields in parent objects that reference the object. You will not be able to recover the values that existed prior to the truncate. 
  • Creates a "shadow" custom object . This is a deleted custom object  associated with the truncated data records. Its name consists of the truncated object's name suffixed by "_trunc_n" where n is the number of times the object has been truncated. Like any deleted object, the shadow object will appear in the deleted objects list until you permanently erase the object and its data, or 45 days have passed. While it is in the deleted objects list  you can undelete the "shadow" and the data stored in it to create a new custom object. An undeleted  "shadow" custom object will not be a clone of the truncated table. It will not have any of the truncated object's :
      • relationships with other objects. Any foreign key fields will be converted to read-only text fields.
      • Autonumbers. AutoNumber fields  will be converted to read-only text fields
      • workflow rules or actions 
      • reports
      • formula fields
      • roll-up summary fields
      • validation rules or approval processes
      • Apex Code triggers
      • translations
      • field history
  • September 20, 2011
  • Like
  • 0

We have a beta version of a functional equivalent of TRUNCATE SQL available on Sandbox organizations. Please open a case with support if you would like to try it out.  We will make a decision on when to GA based on adoption and feedback.

 

 

Truncating a custom object does the following:

  • Permanently disassociates ALL the object's data records from the object. You will not be able to operate on them using this object and they will not be recoverable from the Recycle Bin.
  • Recalculates values in Roll Up Summary Fields in parent objects that reference the object. You will not be able to recover the values that existed prior to the truncate. 
  • Creates a "shadow" custom object . This is a deleted custom object  associated with the truncated data records. Its name consists of the truncated object's name suffixed by "_trunc_n" where n is the number of times the object has been truncated. Like any deleted object, the shadow object will appear in the deleted objects list until you permanently erase the object and its data, or 45 days have passed. While it is in the deleted objects list  you can undelete the "shadow" and the data stored in it to create a new custom object. An undeleted  "shadow" custom object will not be a clone of the truncated table. It will not have any of the truncated object's :
      • relationships with other objects. Any foreign key fields will be converted to read-only text fields.
      • Autonumbers. AutoNumber fields  will be converted to read-only text fields
      • workflow rules or actions 
      • reports
      • formula fields
      • roll-up summary fields
      • validation rules or approval processes
      • Apex Code triggers
      • translations
      • field history
  • September 20, 2011
  • Like
  • 0

I'm getting a new error in Winter '10.

 

"Implementation restriction: expression binding is not
allowed in the SELECT list of a batch query"

 

I started getting this error when we moved to a Winter '10 sandbox. The SOQL in question looks something like this:

 

select r.id from referral__c r where...

 

Note the "r" alias for referral__c.

 

This query is used to instantiate a StandardSetController. Other queries (not associated with a StandardSetController) with the alias notation work fine.

 

Removing the alias solves the problem.

 

ManDarMan2

http://comitydesigns.com

 

 

 

Hey Guys,

 

This one has just popped up on a clients org when running test classes, im frantically searching through the config to make sure no one has change something to unique but i havent found anything yet, any ideas?

 

System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: <unknown> duplicates value on record with id: <unknown>

Hi,
 
My requirement is :- Whenever User tries to insert/update/delete a record from the application (interface in VF page and Apex Controller), then based on the user's profile's object level permission he should be allowed/disallowed the DML operation. If in the Object Level Permission of the user's profile, the checkbox for creating a record in custom object is unchecked and if I try to insert a record from application then Salesforce should throw an error saying the "Insufficient privilege for inserting the record in Object".
 
But since I am writing the DML statements in apex script : all Apex scripts run in system mode, and the permissions and record sharing of the current user are not taken into account. For static testMethod's there is a system method runAs (System.runAs(user Object) ) which changes the user contexts to either an existing user or a new user. All of user's permission is then enforced. But this system method can only be used in test methods. Similarly, is there any method or way to achieve my above requirement in apex script.
We use Visualforce pages both at the top-level (their own page) and embedded as <page> elements in standard objects' page layouts.

These pages no longer work in IE if their Visualforce subdomain has been added to IE's "Trusted Sites" list.  We think the breakage occurred last night, but it's hard to say because we don't do browser testing every day just to see if something broke last night.  Maybe we should.



However, for top-level pages, no such message is displayed to the end-user.  Instead, the page loads and displays just fine, but the discerning eye notices that a javascript error is thrown on page load.  Clicking on IE's little "javascript error" icon on the bottom left brings up this dialog:



Viewing source, we see that line 5 is the UserContext.initialize call:

Code:
4  <script  type="text/javascript">window.sfdcPage = new GenericSfdcPage();
5  UserContext.initialize(....

 
This bug has serious downstream consequences, because actionFunction and actionSupport methods are broken.  If I click on link that calls an actionFunction, my UI just hangs in its "loading/throbber" state but I can again click that little javascript error icon on the bottom left and see this error:



Only by adding my subdomain (i.na5.visual.force.com) to IE's "Trusted Sites" list fixes these problem.  However, for the top-level pages, the user has no way of knowing to do this.  Instead, they just think that our app is broken.

As best as my testing recalls, all of this worked fine last week.

It all still works fine in Firefox 3 (of course, per this post, Salesforce does not officialy support Firefox 3)


  • November 08, 2008
  • Like
  • 0
Do you know what "too many apex requests" exception mean? I'm getting this message randomly. Has it something to do with the Callouts Limit?
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
It's my belief that all of these recent threads on this board probably refer to the same problem that seems to have surfaced within the past week or so having to do with dynamic apex and packaging and perhaps the "API access restrictions" on packages. I'm experiencing all the problems described below in a class that references only a custom object that is included in the package. My experience with these problems is that they occur intermittently.


Schema.SObjectType.Contact.fields.getMap() and Managed Package

Schema.SObjectType.Contact.fields.getMap() and Managed Package

Schema.SObjectType.Opportunity.fields.getMap() Returns Empty Map

System.QueryException: object is not accessible in query due to package restrictions

More Dynamic Apex issues






Message Edited by mshelman on 10-15-2008 02:06 AM
I am using a Schema.SObjectType.,<customobject>.fields.getMap() call which is intermittently returning null. It has been working fine in developer org for weeks but started failing after the apex class was added to a package. The package was deleted and the class started working again but is again failing after being added to a new package.

Mike
The "MIXED_DML_OPERATION" issue that plagues unit tests (see this forum discussion) is now effecting production code as well.

Our application adds an extra custom field to Users called "Other Emails".  This is a string field where a User can enter a bunch of email aliases; whenever it's updated we normalize the information into a separate "EmailAddress" table and the Address then points back at the User.

As of yesterday, that worked great.  I updated my User record to add an address to the "Other Emails" field.  The trigger code executed perfectly, and the EmailAddress object was created & linked to my User record.

As of today, it is failing:



This is a critical part of an Apex-based application that we have been developing for over 8 months, and this section of code has always worked until today.

We've had to comment out unit tests to deal with this issue - which was lame, but acceptable - but actually changing our object relationships and code at this late date would be difficult.
  • June 19, 2008
  • Like
  • 0
The Apex parser has a bug that won't allow a backslash to end string constants.

Try "System.debug('\\');" to see the problem. 

The compiler thinks the string is unterminated and gives compile error "line breaks not allowed in string literals".

I have a workaround:

String DirectoryPath = '\\\\test\\file\\path';

String BackSlash = '\\this'; //Try to remove 'this' from the string and try to run to see the bug
BackSlash = BackSlash.replace('this', ''); //Hack to be able to build backslash terminated character string

DirectoryPath = DirectoryPath + ( DirectoryPath.EndsWith(BackSlash) ? '' : BackSlash );

System.debug(DirectoryPath);

I was working on uploading some APEX code in our production environment, using the APEX Deployment Tool add-on for Apache Ant.  I downloaded the most recent version of this tool this morning, as I understand there were some issues with it over the last day or so.

Before I uploaded the code, I had wanted to delete a class created the other day, which had no triggers depending upon it.  However, I received the following error message when I attempted to do so.

BUILD FAILED
C:\Documents and Settings\RoarkM\Desktop\Apache Ant Files\build.xml:16: Failed:
Failed to delete class compileAndTest: Cannot complete this operation. Cannot delete classes/triggers in production.  Use compileAndTest verb to delete. : null

I have included the 'build.xml' file for this build below for anyone who would like to review it.

After realizing that I could not delete this class, I looked to find if there was a way of deactivating APEX triggers or classes in our production environment, as might be necessary if code were to become depreciated.  I could find no documented way through the UI or through the APEX Deployment Tools add-on to do this.

Are there plans to add this functionality, or an undocumented way to deactivate classes?  Has anyone else encountered issues deleting APEX code in production?  Did I misconfigure one of the elements below?

Any assistance would be greatly appreciated.


<project name="Sample usage of Salesforce Ant tasks" basedir="." xmlns:sf="antlib:com.salesforce">
  <property file="build.properties" />
  <property environment="env" />
- <!--
 Deploy to server 
  --> 
- <target name="deploy">
- <sf:compileAndTest username="${sf.username}" password="${sf.password}" server="${sf.serverurl}" apiversion="10.0" baseDir=".">
- <runTests>
  <class>compileAndTest</class>
  </runTests>
  </sf:compileAndTest>
  </target>
- <!--
 Cleans up above. (Deletes can be combined with compiles.) 
  -->
- <target name="delete">
- <sf:compileAndTest username="${sf.username}" password="${sf.password}" server="${sf.serverurl}" apiversion="10.0">
  <deleteClass>compileAndTest</deleteClass>
  <deleteTrigger>addTasksOnComplete</deleteTrigger>
  <deleteTrigger>reassignChildItems</deleteTrigger>
  </sf:compileAndTest>
  </target>
  </project>

I am trying to deploy APEX code using the process outlined by SFDC.  I keep getting a login faluire.  I am behind a fire wall and will all other programs I need to make sure that I supply a proxy.  However, I do not see any instructions for deploying from behind a firewall.
 
Are there any better instructions for deploying code from your DEV or SANDBOX to Production.
 
Thanks
 
Mike Viola
  • August 06, 2007
  • Like
  • 0