• Paul Dyson.ax812
  • NEWBIE
  • 25 Points
  • Member since 2010

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 21
    Replies
We've found a very odd bug in our system which we've managed to track down to some Salesforce behaviour that is at the least counter-intuitive and may be a bug.

We have a query like

select Contact__c from Custom_Object__c where Contact__c in :listOfIds

Contact__c is a lookup relationship to contact. This returns all the Custom_Object__c records where the related Contact is in a list of Contact Ids

This works as expected unless we add null into listOfIds. If we do then every record is matched and it appears that null in an array of Ids queryed using and  'in' condition effectively breaks that condition as it is interpreted as any value.

Is this known behaviour? Is it intentional? Will it get fixed at some point? 

With/without sharing allows us to write controllers and other classes that respect the sharing rules which is absolutely brilliant. But suppose we want to test whether a user has read or write permissions (example below)? There appears to be nothing in Apex which allows us to do that. We can query the CustomObject__Share table but that only gives us access to the raw sharing data: if a user has directly had a record shared with them their user Id will appear in the sharing table. But what if the user is a member of a group that has had the record shared with them. Or what if the user is in a sub-role of a role in the hierarchy that has had the record shared with 'Role and Subordinates'.

 

Clearly, with enough time and effort we could write something that crawls over the entire hierarchy of users, groups and roles and figures out which users a record has been shared in and whether the current user is in that list. But that's non-trivial and I can't believe no-one else has faced this problem before. Is their and Apex class or part of the API we're missing that does this (or at least helps to do this)? Is their a codeshare or other type of project that does some or all of this? Are we the only people facing this question?

 

The concrete example is that we want to determine whether a user is allowed to perform an action or not based on whether they have just read or read/write permissions on a record that isn't directly related to the action. So we have something called a Research Library which describes a set of Research, and Research Documents which relate to the Research Library. We only want people to be able to create Research Documents related to the Library if they have Read/Write permissions on the library record and not if they only have read (its easy if the library is not shared with them as they don't see it at all). Creating a Research Document doesn't alter the Library record at all so we can't catch a permissions exception and, besides, we don't want to offer the ability to create a Research Document if the user only has read permission for the library ... not tell them after they've entered a load of data that they never had permission to do so.

 

Any help gratefully received!

Singletrack System has been an ISV partner since 2009 and has an establshed Force.com product for the financial services. We're hiring experienced force.com developers based in Lonon, please see http://www.singletracksystems.com/tech-careers/ for more details.

Getting a very odd but consistent problem when trying to save new classes that contain an inner class (or enum) such as:

 

public class OuterClass {

    // some methods

    public class InnerClass {
        // some methods
    }
}

 

 Whether saving from the IDE or the Web interface we get the error message:

 

OuterClass: line -1, column -1: The configuration of your org has changed, please reload the page.  Missing dependent object: Type: OuterClass: InnerClass

 

If we remove all the methods of outer class and save just with the InnerClass declared the problem goes away and we can then add the methods back in and save the full class declaration.

 

 

We've migrated all our bespoke JSON handling code over to native. This all works fine in our development orgs but as soon as we try to package it we get lots of test failures; mostly just internal errors, sometimes JSONExceptions ("don't know the type of the Apex object to deserialize"). We're still somewhat baffled by this but have managed to at least recreate some of the problem.

 

With a smple class like:

 

public class JSONTest {
    public class JSONElement {
        public String one {get; set;}
        public List<String> two {get; set;}
        public List<JSONElement> three {get; set;}
    }
    
    public JSONTest() {
    }
    
    public String getJSON() {
        JSONElement e = new JSONElement();
        e.one = 'Test String';
        e.two = new String[] {'A', 'B'};
        
        JSONElement e1 = new JSONElement();
        JSONElement e2 = new JSONElement();
        e1.one = 'e1';
        e2.two = new String[] {'C', 'D', 'E'};
        
        e.three = new JSONElement[] {e1, e2};
        
        JSONElement[] es = new JSONElement[] {e, e1, e2};
        
        return System.JSON.serialize(es);
    }
}

 

and a test class (doesn't do any asserts, just exercises the behaviour):

 

@IsTest
private class JSONTestTest {
    public static testmethod void testGetJSON() {
        JSONTest t = new JSONTest();
        System.JSON.deserialize(t.getJSON(), JSONTest.JSONElement[].class);        
    }
}

 we get an internal salesforce error (Internal Salesforce Error: 807469011-10609 (503254483) (503254483)) in our packaging org but not in our development orgs. As far as we can tell the crucial but is trying to deserialise a collection, if getJSON() just returns a single JSONTest.JSONElement everything works fine (even though the JSONElement has a list of itself), make getJSON return a list of JSONTesst.JSONElements and it blows up. However it appears to be the deserialize only, if we don't deserialise and use debug to display the return value from getJSON:

 

[{"two":["A","B"],"three":[{"two":null,"three":null,"one":"e1"},{"two":["C","D","E"],"three":null,"one":null}],"one":"Test String"},{"two":null,"three":null,"one":"e1"},{"two":["C","D","E"],"three":null,"one":null}]

 which is valid JSON and looks correct for the code above.

 

Unfortunately we currently have so many tests failing we can't just comment them out and upload regardless.

 

We are about to start pre-release testing our product against Winter '12. We created the sandboxes at the end of August, as per instructions, and have just activated. In between creation and activation we were required to reset passwords. Now the sanboxes have been activated, the new password doesn't work for login and we don't have a copy of the old password. Worse, when we try and reset the password, we get no email - I guess because the email addresses for users have the environment name appended to them and so don't work.

 

So we don't have administrator access to these important sandboxes. Is there any other way to reset the password than going through the email 'I forgot my password' route?

I've hit the problem where the Feed Tracked Changes storage has hit 80% of my orgs storage and I now can't create any more records. I've found various posts which suggest deleting all the records in the following tables:

 

AccountFeed
AssetFeed
CampaignFeed
CaseFeed
CollaborationGroupFeed
ContactFeed
ContentDocumentFeed
ContractFeed
DashboardFeed
EventFeed
LeadFeed
NewsFeed
OpportunityFeed
Product2Feed
ReportFeed
SiteFeed
SolutionFeed
TaskFeed
UserFeed 

 

I've done this and emptied my org's recycle bin. I've disabled and re-enabled chatter, etc. and I still have 80% storage commited to Feed Track Changes. How do I get this back?

All the examples of using the Bulk API show how to insert records (including the sample code). This works perfectly but we're also interested in using the API to delete all records of a particular type - basically we have a need to delete and recreate some reference data on a daily or weekly basis.

 

 

  • Do you need to provide a CSV file if you want to delete all records?
  • If you do, what format should the CSV be in (just the Id needed) and any hints on how to get the Ids of 100,000 records without hitting limits?
Thanks in advance for any help!

 

We have a bit of an odd situation with a package installed in a client org. We have a managed package - let's say the prefix is MPackage__ - and a custom field on Contact Custom_Field__c. The client also has a field on Contact called Custom_Field__c. If we want to query these from the system log the difference is obvious:

 

'select MPackage__Custom_Field__c from Contact' - for our packaged field

 

vs

 

'select Custom_Field__c from Contact' - for the 'local' field

 

How would we distinguish them from inside the package? If we use 'select Custom_Field__c from Contact' inside the package its automatically prefixed with the namespace MPackage__ and so refers to our packaged field, not the local field. Obviously, most of the time, this is exactly correct, but in this case we want to be able to distinguish between the two fields and treat them differently. We know there are two fields because the SObject method returns them differently in response to getName() but we can't work out how to query the local one.

 

Any ideas?

 

TIA

We've recently been caught out a couple of times by deployment of a package breaking page layouts and reports. Here's what seems to be happening.

 

 

  • We have a custom field called Nickname on Contact (API name Nickname__c)
  • We also have a managed package which has a field called Nickname on Contact (API name MyManagedPackage__Nickname__c)
  • We have page layouts and reports referring to Nickname__c
  • We deploy the managed package to the org
  • Nickname__c disappears from the page layouts and reports
  • On further investigation, the field level security of Nickname__c has been set so the field is no longer visible to any profile
  • Restoring the field level security fixes the page layouts and reports although the builders for each doesn't make it easy to figure out which of the two fields you're dealing with as there is no namespace qualification
Is this expected behaviour? If so what scenario is it trying to deal with and is there any way to detect it has happened. We build a product for a narrow business domain so this type of clash between our packaged field names and custom fields added to the clients org is actually reasonably common? 
Is it a bug?

 

I created a new DE this morning and the default user created for that org has its language value set to '2'. If I try and save changes to that user I get an 'invalid value' error although if I then set it to 'English' everything saves fine.

 

However, if I then try and create a new user I get the following error:

 

Unable to Access Page
Invalid parameter value "Language: bad value for restricted picklist field: 2" for parameter "LanguageLocaleKey". 

Error: The value of the parameter specified above contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and re-submit. If the error still persists, please report it to our Customer Support team and provide the URL of the page you were requesting as well as any other related information. 


 

This happens whether I use the 'New User' button or the 'Add Multiple Users' button. I will raise a case but anyone got any ideas of how to work around this problem?

Simple question really but one that's difficult to test without messing with production systems! We have several Sites that use urls like www.mydomain1.com, www.mydomain2.com style but now need one that uses nonewww.mydomain3.com to sit alongside www.mydomain3.com (not served by force.com). Is this possible?

Can anyone explain the difference between High-Volume Customer Portal licenses (which are currently in pilot) and Authenticated Web User licenses (which are GA and described as a type of HVCP)? The specific use case we want to support, and have working with full Customer Portal licenses, is:

 

 

  • We have some Sites pages that should be visible by anyone and some that are only visible to logged in users
  • We model a page as a custom object
  • We use custom sharing rules to ensure that pages that are public are shared with both Sites (Guest) users and CP users and that pages that require login are only shared with CP users

 

 

We have a release that does exactly the same using HVCP and we want to take it into production but are being blocked because the licenses are not yet GA. What does it mean to use AWU instead?

We've found a very odd bug in our system which we've managed to track down to some Salesforce behaviour that is at the least counter-intuitive and may be a bug.

We have a query like

select Contact__c from Custom_Object__c where Contact__c in :listOfIds

Contact__c is a lookup relationship to contact. This returns all the Custom_Object__c records where the related Contact is in a list of Contact Ids

This works as expected unless we add null into listOfIds. If we do then every record is matched and it appears that null in an array of Ids queryed using and  'in' condition effectively breaks that condition as it is interpreted as any value.

Is this known behaviour? Is it intentional? Will it get fixed at some point? 

Hi All, I'm trying to package my release managed package, and i'm getting lot of failures related to the same error: 
"System.LimitException: Your runAllTests request is using too many DB resources." 

I was able to package before, but seems like we have a new limitation now.... 
I really need this package to go live ASAP and of course, this is a BLOCKER. 

Notice that ALL MY TEST CASES HAVE 0 FAILURES if i run them individually. 

Thanks in advance, 
J.

Hi

 

Run a partner demo environment - unlimited edition.

 

I've installed the demo CTI adaptor on my local machine, and set up the call center on the demo adaptor XML file.

 

The adaptor show in the system tray but on right click only offers Logging settings and About us.  In Salesforce, the left hand panel displays a Connect CTI adapter button.  On click, screen shows the status message of waiting for local host, but does not launch the softphone.

 

Any ideas on what I am missing would be appreciated.

With/without sharing allows us to write controllers and other classes that respect the sharing rules which is absolutely brilliant. But suppose we want to test whether a user has read or write permissions (example below)? There appears to be nothing in Apex which allows us to do that. We can query the CustomObject__Share table but that only gives us access to the raw sharing data: if a user has directly had a record shared with them their user Id will appear in the sharing table. But what if the user is a member of a group that has had the record shared with them. Or what if the user is in a sub-role of a role in the hierarchy that has had the record shared with 'Role and Subordinates'.

 

Clearly, with enough time and effort we could write something that crawls over the entire hierarchy of users, groups and roles and figures out which users a record has been shared in and whether the current user is in that list. But that's non-trivial and I can't believe no-one else has faced this problem before. Is their and Apex class or part of the API we're missing that does this (or at least helps to do this)? Is their a codeshare or other type of project that does some or all of this? Are we the only people facing this question?

 

The concrete example is that we want to determine whether a user is allowed to perform an action or not based on whether they have just read or read/write permissions on a record that isn't directly related to the action. So we have something called a Research Library which describes a set of Research, and Research Documents which relate to the Research Library. We only want people to be able to create Research Documents related to the Library if they have Read/Write permissions on the library record and not if they only have read (its easy if the library is not shared with them as they don't see it at all). Creating a Research Document doesn't alter the Library record at all so we can't catch a permissions exception and, besides, we don't want to offer the ability to create a Research Document if the user only has read permission for the library ... not tell them after they've entered a load of data that they never had permission to do so.

 

Any help gratefully received!

Singletrack System has been an ISV partner since 2009 and has an establshed Force.com product for the financial services. We're hiring experienced force.com developers based in Lonon, please see http://www.singletracksystems.com/tech-careers/ for more details.

We've migrated all our bespoke JSON handling code over to native. This all works fine in our development orgs but as soon as we try to package it we get lots of test failures; mostly just internal errors, sometimes JSONExceptions ("don't know the type of the Apex object to deserialize"). We're still somewhat baffled by this but have managed to at least recreate some of the problem.

 

With a smple class like:

 

public class JSONTest {
    public class JSONElement {
        public String one {get; set;}
        public List<String> two {get; set;}
        public List<JSONElement> three {get; set;}
    }
    
    public JSONTest() {
    }
    
    public String getJSON() {
        JSONElement e = new JSONElement();
        e.one = 'Test String';
        e.two = new String[] {'A', 'B'};
        
        JSONElement e1 = new JSONElement();
        JSONElement e2 = new JSONElement();
        e1.one = 'e1';
        e2.two = new String[] {'C', 'D', 'E'};
        
        e.three = new JSONElement[] {e1, e2};
        
        JSONElement[] es = new JSONElement[] {e, e1, e2};
        
        return System.JSON.serialize(es);
    }
}

 

and a test class (doesn't do any asserts, just exercises the behaviour):

 

@IsTest
private class JSONTestTest {
    public static testmethod void testGetJSON() {
        JSONTest t = new JSONTest();
        System.JSON.deserialize(t.getJSON(), JSONTest.JSONElement[].class);        
    }
}

 we get an internal salesforce error (Internal Salesforce Error: 807469011-10609 (503254483) (503254483)) in our packaging org but not in our development orgs. As far as we can tell the crucial but is trying to deserialise a collection, if getJSON() just returns a single JSONTest.JSONElement everything works fine (even though the JSONElement has a list of itself), make getJSON return a list of JSONTesst.JSONElements and it blows up. However it appears to be the deserialize only, if we don't deserialise and use debug to display the return value from getJSON:

 

[{"two":["A","B"],"three":[{"two":null,"three":null,"one":"e1"},{"two":["C","D","E"],"three":null,"one":null}],"one":"Test String"},{"two":null,"three":null,"one":"e1"},{"two":["C","D","E"],"three":null,"one":null}]

 which is valid JSON and looks correct for the code above.

 

Unfortunately we currently have so many tests failing we can't just comment them out and upload regardless.

 

Hi,

 

I am deseralizing the json string into an object which contains a list of another object, and getting this error:

 

Internal Salesforce Error: 17692538-4726 (1351590007) (1351590007) 



My code has been working up until this Wednesday. Was there any change that has been applied to cs2 env? This the test code I have:

 

public with sharing class JSONTest {
    public class InvoiceStatement {
        Long invoiceNumber;
        Datetime statementDate;
        Decimal totalPrice;
       
        public InvoiceStatement(Long i, Datetime dt, Decimal price)
        {
            invoiceNumber = i;
            statementDate = dt;
            totalPrice = price;
        }
    }
   
    public class InvoiceStatementResponse {
        Integer errorCode;
        List<InvoiceStatement> statements;
       
        public InvoiceStatementResponse(Integer errorCode) {
            this.errorCode = errorCode;
            statements = new List<InvoiceStatement>();
        }
    }
   
    public static void SerializeRoundtrip() {
        Datetime dt = Datetime.now();
        // Create a few invoices.
   
        InvoiceStatement inv1 = new InvoiceStatement(1,Datetime.valueOf(dt),1000);
        InvoiceStatement inv2 = new InvoiceStatement(2,Datetime.valueOf(dt),500);
        // Add the invoices to a list.
   
        List<InvoiceStatement> invoices = new List<InvoiceStatement>();
        invoices.add(inv1);
        invoices.add(inv2);
        
         InvoiceStatementResponse resp = new InvoiceStatementResponse(0);
         resp.statements = invoices;
                 
        String JSONString = JSON.serialize(resp);
        System.debug('Serialized list of invoices into JSON format: ' + JSONString);
       
        InvoiceStatementResponse dresp = (InvoiceStatementResponse)JSON.deserialize(JSONString, InvoiceStatementResponse.class);
        System.debug('dresp=' + dresp);
    }
   
    private static testmethod void mytest() {
        JSONTest.SerializeRoundtrip();
    }
   
}

 

Any help is appreciated.

 

 



All the examples of using the Bulk API show how to insert records (including the sample code). This works perfectly but we're also interested in using the API to delete all records of a particular type - basically we have a need to delete and recreate some reference data on a daily or weekly basis.

 

 

  • Do you need to provide a CSV file if you want to delete all records?
  • If you do, what format should the CSV be in (just the Id needed) and any hints on how to get the Ids of 100,000 records without hitting limits?
Thanks in advance for any help!

 

We have a bit of an odd situation with a package installed in a client org. We have a managed package - let's say the prefix is MPackage__ - and a custom field on Contact Custom_Field__c. The client also has a field on Contact called Custom_Field__c. If we want to query these from the system log the difference is obvious:

 

'select MPackage__Custom_Field__c from Contact' - for our packaged field

 

vs

 

'select Custom_Field__c from Contact' - for the 'local' field

 

How would we distinguish them from inside the package? If we use 'select Custom_Field__c from Contact' inside the package its automatically prefixed with the namespace MPackage__ and so refers to our packaged field, not the local field. Obviously, most of the time, this is exactly correct, but in this case we want to be able to distinguish between the two fields and treat them differently. We know there are two fields because the SObject method returns them differently in response to getName() but we can't work out how to query the local one.

 

Any ideas?

 

TIA

I created a new DE this morning and the default user created for that org has its language value set to '2'. If I try and save changes to that user I get an 'invalid value' error although if I then set it to 'English' everything saves fine.

 

However, if I then try and create a new user I get the following error:

 

Unable to Access Page
Invalid parameter value "Language: bad value for restricted picklist field: 2" for parameter "LanguageLocaleKey". 

Error: The value of the parameter specified above contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and re-submit. If the error still persists, please report it to our Customer Support team and provide the URL of the page you were requesting as well as any other related information. 


 

This happens whether I use the 'New User' button or the 'Add Multiple Users' button. I will raise a case but anyone got any ideas of how to work around this problem?

Simple question really but one that's difficult to test without messing with production systems! We have several Sites that use urls like www.mydomain1.com, www.mydomain2.com style but now need one that uses nonewww.mydomain3.com to sit alongside www.mydomain3.com (not served by force.com). Is this possible?

Can anyone explain the difference between High-Volume Customer Portal licenses (which are currently in pilot) and Authenticated Web User licenses (which are GA and described as a type of HVCP)? The specific use case we want to support, and have working with full Customer Portal licenses, is:

 

 

  • We have some Sites pages that should be visible by anyone and some that are only visible to logged in users
  • We model a page as a custom object
  • We use custom sharing rules to ensure that pages that are public are shared with both Sites (Guest) users and CP users and that pages that require login are only shared with CP users

 

 

We have a release that does exactly the same using HVCP and we want to take it into production but are being blocked because the licenses are not yet GA. What does it mean to use AWU instead?

I have a managed package that had 2 triggers on the same object.  There were fired on completely different operations by the CheckMarx scan kept saying that multiple triggers on the same object is a bad thing so as part of a maintenance release I decided to consolidate the two existing triggers into a single new trigger.  I was able to delete the old triggers from my org and build a new version of the package (beta build at the moment) that only contained a the new single trigger.  Install into a clean environment and the one and only trigger is installed and everything works great. 

 

So far, so good.  However, when I install the new version into an org with the old version it does not remove the old triggers.  Now I have 3 triggers instead of 2 and if all are firing then I am doing everything twice.  All 3 are listed as Active but I can't tell if all 3 are firing.

 

Anyone have a clue as to why if I was able to remove the triggers from my org/package the upgrade install will not remove the old triggers? 

 

Thanks,

 

Bob

  • August 24, 2010
  • Like
  • 0