You need to sign in to do that
Don't have an account?
Fetching SObject Type in test class referring object of managed package
I have a strange problem, let me explain you the scenario :
1) I have installed a managed package with namespace (ankit), it includes a object name Sling and two recordtypes "test1" and "test2".
2) Now I have done some custom development on my personal org where I have installed that package. I have created a test class which looks something like this :
@isTest private class MyTestClass { private static testmethod void testM() { ankit__Sling__c s = [select id from ankit__Sling__c limit 1] ; System.debug('s :::::: ' + s) ; List<RecordType> rt = [select id from recordtype where sobjectType = 'ankit__Sling__c'] ; System.debug('rt ::::: ' + rt) ; List<RecordType> rt2 = [select id from recordtype] ; System.debug('rt2 ::::: ' + rt2) ; System.assertEquals(rt.size() , 2) ; } }
3) Now I simply create another package which is unmanaged and include this test class in it, automatically package object sling and its record types are included. Now I have created a package(Unmanaged), and its done successfully. Now I am checking the debugs it gives me proper data (two record types are returned in test class and assert is passed).
Note : Till now I have not create a namespace for my organization.
4) Now what I have done is created a namespace on my organization and try to upload the same package(unmanaged) again. This time my test class get failed and the problem is no record type is returned whose sobjecttype is 'ankit_sling__c'.
My second debug
System.debug('rt2 ::::: ' + rt2) ;
returns two record type which is expected, just wondering why these record types are not returned when I am putting where clause condition "where sobjecttype = 'ankit_sling__c' "
Is this is a bug??? I have tried this on multiple orgs and faced same problem everywhere.
Any directions over this will be great.
I do have same problem, please let me know the solution.
Yes, this seems to be a problem as I have faced this in one of my earlier projects. I could not make much out of it at that time and implemented work arounds to upload my package (managed). As you are facing it in your unmanaged package as well, I guess this qualifies as a bug now. Can someone from Salesforce please confirm this?
I have a critical release next week and after completing the development I have come across same issue.
I tried createing a managed package(beta/relase) and both have same probelm. Some others are also facing this so I am reporting a Support case on this.
Any help/workaround will be much appreciated.
Thank you,
Amit
I haven't really done 'packaged' code too much, but can you include content from a Managed Package you've installed in an Unmanaged Package you create yourself? I would've thought that wouldn't work ?
Unless I've not got this right.
We can use components which are referring the components in managed package. We just need to make sure that where we are going to install our new package that organization should have that managed package.
But the problem is, error is not occurring while uploading the package when there is no namespace on my organization. Error is coming as soon as I create the namespace on my organization, just wondering how is this related as I am creating an unmanaged package.
As I understand it, when one package is dependent on another (as seems to be the case here) then package two is considered an extension of package one, and can only be installed when package one is present.
When that is in place, you can then upload a package that is dependent on another package (I've several extensions that rely on the previous one in the chain, and they work fine)
What I don't know is if an unmanaged package can be an extension to a managed package?
I have tried uploading managed package, that too failed.
If that is the case then why I am able to upload the package when there is no namespace on my organization, and why it is giving error by just creating a namespace. Something is fishy.
Someone from Salesforce should step in now and give an official word on whether it's a bug or an obvious thing being overlooked in the entire scenario.
This smells like a bug - file a case and if support can reproduce it, they will escalate to the packaging team.
This issue has been quitely resolved. I raised a ticket 15 days back. Yesterday when I check it again, I was no longer facing this issue.