-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
8Questions
-
5Replies
how to allow customizable css file in managed package?
I have a managed package that includes a css file that I want to allow the user to be able to modify, in order to change the styling of my visualforce page, when they host it on their website through Sites.
Originally, I made my css file a static resource, but found that it was locked down in a managed package. So I then came up with the following hack...
in my controller class:
// the instance specific url to the css that can be modified by the user.
public string strURLtoCSSFile {
get {
if (strURLtoCSSFile == null) {
list<Document> listDocs = [SELECT Name, Id From Document WHERE Name = 'MyCSS.css' LIMIT 1 ];
if (listDocs.size() > 0) {
Document doc = listDocs[0];
string imageid = doc.id;
imageid = imageid.substring(0,15);
strURLToCSSFile = '/servlet/servlet.FileDownload?file=' + imageid;
}
}
return strURLtoCSSFile;
}
set;
}
in my visualforce page:
<apex:stylesheet value="{!strURLtoCSSFile}" />
This seemed to work great when testing the visualforce page directly. But when the visualforce page was being surfaced through Sites, I found that I had to enable Read permissions on the Documents standard object in the Site's Public Access Settings.
Unfortunately, this seems to open up all documents as readable to the Site. I found no way to set this either per directory or per actual file.
Any ideas on how to correctly set the permissions, or a better way to do this?
Thanks!
Dave
-
- DavidHabib.ax407
- January 18, 2011
- Like
- 0
- Continue reading or reply
How Sets handle sObjects
I was using a set of sObjects, assuming that the set would prevent me from putting the same sObject in the set multiple times. Unfortunately, I found that if I modified one of the fields of the sObject between additions to the set, then the sObject would get put on multiple times. Is this expected behavior or a bug?
Here is a sample test routine which asserts, exposing the problem:
static testmethod void SetSobjectBug() {
Account acc = new Account(name='Individual');
insert acc;
Contact con = new Contact(Lastname='Testy', AccountId=acc.Id);
insert con;
Campaign cmp = new Campaign(name='Test Campaign');
insert cmp;
CampaignMember cm = new CampaignMember(CampaignId=cmp.Id, ContactId=con.Id, Status='Sent');
Set<CampaignMember> setCM = new Set<CampaignMember>();
system.assert(setCM.add(cm));
cm.Status = 'Responded';
system.assert(setCM.add(cm) == false); // THIS ASSERTS. If cm.Status is not changed, it won't assert.
}
I was assuming the set was holding onto a reference to the object, but given this assert, I wonder if the set is make a full copy of the object, and doing a full compare to test membership?
Thanks,
Dave
-
- DavidHabib.ax407
- January 05, 2011
- Like
- 0
- Continue reading or reply
Opportunity Picklist not filtering by record type
I have a VisualForce page which is bound to an Opportunity I've created of a specific record type. Unfortunately, the Stage picklist shows all stages defined in this salesforce instance, rather than just the stages defined on the sales process for this opportunity record type.
How come the stage picklist is not filtering? Is there a way to fix this?
I could use my own picklist to show just the stages I expect, but I'd rather not do this extra work.
Thanks,
Dave
-
- DavidHabib.ax407
- December 07, 2009
- Like
- 0
- Continue reading or reply
API to Campaign object's CampaignMemberRecordType field
Campaign object's now have a CampaignMemberRecordType field which is the record type to create CampaignMember records with.
Unfortunately, I can't set it in Apex code. Eclipse complains with "Invalid field CampaignMemberRecordType for SObject Campaign".
I also tried using CampaignMemberType, but also got an Eclipse error.
What do I need to do to be able to set this programmatically?
Thanks,
Dave
-
- DavidHabib.ax407
- October 14, 2009
- Like
- 0
- Continue reading or reply
How to enable Sites on older developer account?
I've got a ~6 month old developer account that I'd like to enable Sites on. I've tried some of the older links I found on the discussion board, but they didn't seem to do anything.
Thanks for any help,
Dave
-
- DavidHabib.ax407
- October 05, 2009
- Like
- 0
- Continue reading or reply
Can't login to Sandbox from Data Loader or Force Eclipse IDE
I have a sandbox on a production system that I've been able to successfully use with the Apex Data Loader and the Eclipse Force IDE for several months.
Today, I can no longer login to my sandbox account with either tool. I reset my security token, but I still cannot login. I am able to login to the production system without problems with these tools. I can also login to the sandbox from the Browser without problems.
Please help!
Thanks,
Dave
-
- DavidHabib.ax407
- February 23, 2009
- Like
- 0
- Continue reading or reply
fields in Contact object in Trigger are all null?
for (Contact c:Trigger.new) {
system.assert(c != null);
system.assert(c.Id != null);
system.assert(c.Name != null);
}
}
-
- DavidHabib.ax407
- December 08, 2008
- Like
- 0
- Continue reading or reply
How Sets handle sObjects
I was using a set of sObjects, assuming that the set would prevent me from putting the same sObject in the set multiple times. Unfortunately, I found that if I modified one of the fields of the sObject between additions to the set, then the sObject would get put on multiple times. Is this expected behavior or a bug?
Here is a sample test routine which asserts, exposing the problem:
static testmethod void SetSobjectBug() {
Account acc = new Account(name='Individual');
insert acc;
Contact con = new Contact(Lastname='Testy', AccountId=acc.Id);
insert con;
Campaign cmp = new Campaign(name='Test Campaign');
insert cmp;
CampaignMember cm = new CampaignMember(CampaignId=cmp.Id, ContactId=con.Id, Status='Sent');
Set<CampaignMember> setCM = new Set<CampaignMember>();
system.assert(setCM.add(cm));
cm.Status = 'Responded';
system.assert(setCM.add(cm) == false); // THIS ASSERTS. If cm.Status is not changed, it won't assert.
}
I was assuming the set was holding onto a reference to the object, but given this assert, I wonder if the set is make a full copy of the object, and doing a full compare to test membership?
Thanks,
Dave
- DavidHabib.ax407
- January 05, 2011
- Like
- 0
- Continue reading or reply
API to Campaign object's CampaignMemberRecordType field
Campaign object's now have a CampaignMemberRecordType field which is the record type to create CampaignMember records with.
Unfortunately, I can't set it in Apex code. Eclipse complains with "Invalid field CampaignMemberRecordType for SObject Campaign".
I also tried using CampaignMemberType, but also got an Eclipse error.
What do I need to do to be able to set this programmatically?
Thanks,
Dave
- DavidHabib.ax407
- October 14, 2009
- Like
- 0
- Continue reading or reply
fields in Contact object in Trigger are all null?
for (Contact c:Trigger.new) {
system.assert(c != null);
system.assert(c.Id != null);
system.assert(c.Name != null);
}
}
- DavidHabib.ax407
- December 08, 2008
- Like
- 0
- Continue reading or reply