• cpeterson
  • NEWBIE
  • 55 Points
  • Member since 2009

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 19
    Replies
Hi ,
How can an admin get the total number of users who have installed the package created by him.
  • September 24, 2009
  • Like
  • 0

Hi all,

 

I think I already know the answer, that I have to disable API restrictions for this to work, but if there's any way I can avoid doing that I'd much prefer to.  

 

Anyways, I have a visualforce page that needs to query the CustomObject__Tag and TagDefinition objects from it's apex controller. The problem is that when I have any API restrictions at all the SELECT SOQL query fails with the error:  System.SObjectException: CustomObject__Tag.tagDefinitionId not accessible due to package restrictions

 

Is there a way to set more fine-grained API access restrictions? Or am I stuck disabling all API restrictions in order to access salesforce tagging? 

 

Also, I'm not able to find much developer documentation about salesforce's built-in tagging, is there any? Things like how to access the count of all tags like the tag manager page has would be invaluable.

Well this is easy in standard salesforce, mostly because it happens automatically.

 

What I want to do is make a summary popup window when a user hovers over a link in a visualforce page. Something like this (taken from standard salesforce):

 

 

 

There doesn't seem to be any standard or easy way to do this in visualforce. Is there? I'd like to avoid rewriting standard salesforce functionality if at all possible.

 

Anybody know how to do something like that? Also, what's the proper salesforce terminology for these popup windows?

 

Thanks! 

Hi all,

 

Is there any way to package a default value for a custom setting? I've tried setting the default value on the field, but when accessed I still get null rather than the default.

 

If there's no way to package a default value, why have an option for visibility of protected?

 

I'm pretty sure I'm missing something simple, help! 

Hi all,

 

I have a strange issue with SOSL where when I query SFDC standard objects like contacts I get back my results as expected, e.g.: 

 

//An anonymous block

List<List<SObject>> searchList = [FIND '*vic*' IN ALL FIELDS RETURNING Contact(id)];

contact[] contacts = ((List<contact>)searchlist[0]);

System.debug('Contacts: '+Contacts);

 

//Results

Anonymous execution was successful.

 

20090924185445.738:AnonymousBlock.itil: line 1, column 34: SOSL query with resulting 2 rows finished in 17 ms

20090924185445.738:AnonymousBlock.itil: line 3, column 1: Contacts: (Contact:{Id=0038000000iEdvtAAC}, Contact:{Id=0038000000dx3GGAAY})

But when I try the same thing on a custom object I can see it finding rows, but it doesn't actually return them:

 

//Anonymous block

List<List<SObject>> searchList = [FIND '*vic*' IN ALL FIELDS RETURNING Incident__c(id)];

Incident__c[] incidents = ((List<Incident__c>)searchlist[0]);

System.debug('Incidents: '+incidents);

 

//results

Anonymous execution was successful.

 

20090924185616.733:AnonymousBlock.itil: line 1, column 34: SOSL query with resulting 11 rows finished in 23 ms20090924185616.733:AnonymousBlock.itil: line 3, column 1: Incidents: ()

 The SOSL query resulted in 11 rows, but the array is empty. It seems to be finding the records, but not return any data on them.

 

I can get the records in a simple case like this via a SOQL query, so I know they're in the database and readable from the anonymous block.

 

Help! 

 

 

 

 

Message Edited by cpeterson on 09-24-2009 12:00 PM

So I have an interesting issue that seems to only manifest on sites/customer portal. As I'm only using portal for authentication and this code is all being run by custom controllers under sites this seemed like the appropriate place to post it.

 

I have a custom controller that looks something like this: 

public without sharing class Controller {


[irrelevant code cut out]

public List<Service_Availability_Link__c> getServiceList(){
List<Service_Availability_Link__c> ServiceList;
try {

ServiceList = [Select Name, Service__r.Name From Service_Availability_Link__c r
where Department__c = :myContact.Department__c and Service__c != null];

} catch (Exception e) {
System.debug('******Cought an exception! '+e);
}
System.debug('**# Service list looks something like this: '+ServiceList[0].Service__r.Name);
return ServiceList;
}

 And here's a especially simple VF page that I made to help illustrate the issue:

 

<apex:page controller="Controller" showHeader="false">
<apex:repeat value="{!serviceList}" var="s">
<apex:outputText >Data: {!s.Service__r.Name}<br /></apex:outputText>
</apex:repeat>
</apex:page>

 

This is the interesting part, the custom controller is running without sharing (to help debug this issue, I plan to enable sharing rules), and when I turn on debug logs I can see the "System.debug('**# Service list looks something like this: '+ServiceList[0].Service__r.Name);"  statement printing the data I want, but the data is not accessible on the VF page.

 

Here's what I get when I load the VF page.

In full salesforce (not using sites):

 

Data: Salesforce Account

Data: CEO Laptop Service

Data: New Laptop

Data: InSite Monitoring Seat License

 And when I run it under sites with a customer portal user I get this output:

 

Data:

Data:

Data:

Data:

 

Even stranger, if I change the VF page to print  {!s.Name} instead of {!s.Service__r.Name} it prints data (just not the data I want)! The issue seems to be only with traversing object relationships, and from the debugging statements I can see the data is being pulled correctly.

 

 

 

Is this a bug in visualforce under sites? I can't figure out any reason why it would behave like this. 

 

 

I've spent a good amount of time looking around trying to find whatever piece of semi-magical syntax I need to be able to get a PageReference to a tab of a standard controller.

 

On the forums I've found the reccomendation to just link to it's URL directly: https://salesforce_instance/001/o.

While that's the quick and easy way, it doesn't work with packages or code deployments, which the code I'm patching will someday be involved with.

 

So in short, I need a portable way of finding a pagereference to a standard controller, say the normal accounts tab. Anybody know an easy way?

I have a visualforce page that needs to be able to set the owner of a custom object to either a queue OR a user. The standard apex:inputField tag will only pull up users as it's a custom object and not a true case object.

 

I have the controller side fully working, when I pass in ownerType via a GET property in the URL everything works as I'd like it to, but I can't quite get it working without having to refresh the page.

 

Fundamentally, my issue is that I can't figure out how to reference the value of the Owner Type selectList.

Here's the relevant snippet of visualforce: 

 

 

              <apex:pageblockSection id="ownerList">

              <apex:pageblockSectionItem >

              <apex:outputText value="{!ownerType}" />

              <apex:selectList value="{!problem.ownerId}"  size="1">

              <apex:selectOptions value="{!owners}" />

              </apex:selectList>

              </apex:pageblockSectionItem>

              <apex:pageblockSectionItem >

              <apex:outputText value="Owner Type"/>

              <apex:selectList id="ownerType" value="{!ownerType}" size="1">

              <apex:actionSupport event="onchange" rerender="ownerList" immediate="true" status="status">

              <apex:param name="ownerType" value="{!$CurrentPage.parameters.ownerType}" assignTo="{!ownerType}" />

              </apex:actionSupport>

              <apex:selectOption itemValue="user" itemLabel="User"/>

              <apex:selectOption itemValue="group" itemLabel="Group"/>

              </apex:selectList>

              </apex:pageblockSectionItem>

              </apex:pageBlockSection>

 

I'm rather sure that the problem is in the apex:param tag, but I can't figure out what to set the value of the param tag to. I tried $CurrentPage.parameters.ownerType but it came back null when the ownerList pageblock was rerendered.

 

Thanks for the wonderful support community! 

 

 

I've just started working on a yet to be released force.com app that's using sites for a customer portal, as well as the traditional salesforce interface for users that have a seat license.

 

So there's an object with tab already defined that works in our salesforce interface. I need to not change the functionality of that exiting tab, but I also need to set the tab in the customer portal to a different visualforce page and not just the built-in standard controller interface.

 

In less abstract terms, tab X needs to be tied to visualforce1 in the force.com interface, and tied to visualforce2 in the customer portal/sites interface.

 

Is this possible? If so how would one go about setting it up? 

I feel like a total n00b asking this question as the concept of public, global, static keywords seems pretty basic but are there any negatives to declaring class variables as static?

 

I have an asynchronous method that needs to access variables in the class but the only way for this static @future method to see the variables is to make them static. Is this acceptable? Is there a better way? See example below.

 

public class EmailDomains {

//Only way for @future method can see these variables is to make then static
static List<Account> accountsToUpdate = new List<Account>();
static Set<String> currentEmailDomains;
static Set<String> emailDomainsAfterClean;

//Called from trigger, visualforce, etc
@future
public static void rescanAccounts(Set<Id> acctIDs){
//Do cool stuff
//need to access list variables above
}
}

 

I suppose when you are self taught you miss some programming basics.

 

Thanks,

Jason

Message Edited by TehNrd on 02-05-2010 01:08 PM
  • February 05, 2010
  • Like
  • 0

HI,

I'm trying to create a custom edit page using Apex class to retrieve the fields information and then display

the fields in vForce page. However I got the following error message in the process. Any help would be

appreciated. It's very helpful with some custom edit page sample codes. Thanks

 

Paul

 

System.NullPointerException: Attempt to de-reference a null object

 

 

 

 

 


  • September 29, 2009
  • Like
  • 0

Hello all,

 

What will be the Security audit process for submitting application to appexchange

 

for my salesforce application? Where I will get all information related to this?

 

 

Thanks

 

 

Hi all,

 

I have a strange issue with SOSL where when I query SFDC standard objects like contacts I get back my results as expected, e.g.: 

 

//An anonymous block

List<List<SObject>> searchList = [FIND '*vic*' IN ALL FIELDS RETURNING Contact(id)];

contact[] contacts = ((List<contact>)searchlist[0]);

System.debug('Contacts: '+Contacts);

 

//Results

Anonymous execution was successful.

 

20090924185445.738:AnonymousBlock.itil: line 1, column 34: SOSL query with resulting 2 rows finished in 17 ms

20090924185445.738:AnonymousBlock.itil: line 3, column 1: Contacts: (Contact:{Id=0038000000iEdvtAAC}, Contact:{Id=0038000000dx3GGAAY})

But when I try the same thing on a custom object I can see it finding rows, but it doesn't actually return them:

 

//Anonymous block

List<List<SObject>> searchList = [FIND '*vic*' IN ALL FIELDS RETURNING Incident__c(id)];

Incident__c[] incidents = ((List<Incident__c>)searchlist[0]);

System.debug('Incidents: '+incidents);

 

//results

Anonymous execution was successful.

 

20090924185616.733:AnonymousBlock.itil: line 1, column 34: SOSL query with resulting 11 rows finished in 23 ms20090924185616.733:AnonymousBlock.itil: line 3, column 1: Incidents: ()

 The SOSL query resulted in 11 rows, but the array is empty. It seems to be finding the records, but not return any data on them.

 

I can get the records in a simple case like this via a SOQL query, so I know they're in the database and readable from the anonymous block.

 

Help! 

 

 

 

 

Message Edited by cpeterson on 09-24-2009 12:00 PM
Hi ,
How can an admin get the total number of users who have installed the package created by him.
  • September 24, 2009
  • Like
  • 0

So I have an interesting issue that seems to only manifest on sites/customer portal. As I'm only using portal for authentication and this code is all being run by custom controllers under sites this seemed like the appropriate place to post it.

 

I have a custom controller that looks something like this: 

public without sharing class Controller {


[irrelevant code cut out]

public List<Service_Availability_Link__c> getServiceList(){
List<Service_Availability_Link__c> ServiceList;
try {

ServiceList = [Select Name, Service__r.Name From Service_Availability_Link__c r
where Department__c = :myContact.Department__c and Service__c != null];

} catch (Exception e) {
System.debug('******Cought an exception! '+e);
}
System.debug('**# Service list looks something like this: '+ServiceList[0].Service__r.Name);
return ServiceList;
}

 And here's a especially simple VF page that I made to help illustrate the issue:

 

<apex:page controller="Controller" showHeader="false">
<apex:repeat value="{!serviceList}" var="s">
<apex:outputText >Data: {!s.Service__r.Name}<br /></apex:outputText>
</apex:repeat>
</apex:page>

 

This is the interesting part, the custom controller is running without sharing (to help debug this issue, I plan to enable sharing rules), and when I turn on debug logs I can see the "System.debug('**# Service list looks something like this: '+ServiceList[0].Service__r.Name);"  statement printing the data I want, but the data is not accessible on the VF page.

 

Here's what I get when I load the VF page.

In full salesforce (not using sites):

 

Data: Salesforce Account

Data: CEO Laptop Service

Data: New Laptop

Data: InSite Monitoring Seat License

 And when I run it under sites with a customer portal user I get this output:

 

Data:

Data:

Data:

Data:

 

Even stranger, if I change the VF page to print  {!s.Name} instead of {!s.Service__r.Name} it prints data (just not the data I want)! The issue seems to be only with traversing object relationships, and from the debugging statements I can see the data is being pulled correctly.

 

 

 

Is this a bug in visualforce under sites? I can't figure out any reason why it would behave like this. 

 

 

Hi,

 

I am trying to find out if there is any way to remove an Email service, as I can see no obvious way to do so.

 

This has become an issue because I have created a package that contains an Apex class that handles email messages.

 

I install the package in a development environment and create an Email service that uses that Apex class.  Everything works ok until I want to uninstall the package.  I can't because the Apex class is being used by the Email service, but I can't delete the Email service.

 

Any ideas?

 

Carl

  • September 08, 2009
  • Like
  • 0

I like to include a link to my salesforce record in an outbound  Messaging.SingleEmailMessage email, but I don't want to include a hard code instance as outlined in the documentation. How do I get the salesforce instance na1, na2, na3,... that I am working on. Pagereference getURL() only returns a partial URL.

 

From the documentation:

 

 http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content%2Fapex_classes_email_outbound.htm|SkinName=webhelp

 

mail.setHtmlBody('Your case:<b> ' + case.Id +' </b>has been created<p>'+
' View case <a href=https://na1.salesforce.com/'+case.Id+'>click here</a>');

 

Thanks,

 

Matt

I wrote the following

 

 

Public Static String getEmailFromSubjecct(String Subject){ // First, instantiate a new Pattern object "MyPattern" String emailRegex = '(\\w+)@(\\w+\\.)(\\w+)(\\.\\w+)*'; Pattern MyPattern = Pattern.compile(emailRegex); // Then instantiate a new Matcher object "MyMatcher" Matcher MyMatcher = MyPattern.matcher(Subject); boolean hasMatch = MyMatcher.matches(); String match = MyMatcher.group(0); return match;

}

 the variable "hasMatches" returns "true" when I call this with

 

EmailTools.getEmailFromSubject('test@test.com is an email address');

 

but  the string "match" fails with "System.StringException: No match found"

 

I am lost here.  Why would the .matches() method return true if there are no matches?

 

I've spent a good amount of time looking around trying to find whatever piece of semi-magical syntax I need to be able to get a PageReference to a tab of a standard controller.

 

On the forums I've found the reccomendation to just link to it's URL directly: https://salesforce_instance/001/o.

While that's the quick and easy way, it doesn't work with packages or code deployments, which the code I'm patching will someday be involved with.

 

So in short, I need a portable way of finding a pagereference to a standard controller, say the normal accounts tab. Anybody know an easy way?

I have recruited a developer to implement Apex-based functionality on a Salesforce.com instance, and my experience so far is that although the creation of objects/fields/validation/reports/search is VERY fast compared to the likes of ASP.NET, when it comes to creating Visualforce pages and add-on functionality not supported by the primary platform it is very slow. 

 

As an example, recently my dev quoted several times the amount of time required to implement a specific feature than I know would be required to implement it in an ASP.NET app. He put this down to the cloud-based environment (yes, he's using Eclipse) and the fact that it's necessary to continually upload the code with all the tests on a regular basis.

 

It's a small app so we're not using the sandbox, instead deploying direct to production, the reasoning for that is the risks of this are quite tolerable, and overall it saves time.

 

I'm interested to hear if others generally find Apex development to be slower than other platforms.

 

I have a visualforce page that needs to be able to set the owner of a custom object to either a queue OR a user. The standard apex:inputField tag will only pull up users as it's a custom object and not a true case object.

 

I have the controller side fully working, when I pass in ownerType via a GET property in the URL everything works as I'd like it to, but I can't quite get it working without having to refresh the page.

 

Fundamentally, my issue is that I can't figure out how to reference the value of the Owner Type selectList.

Here's the relevant snippet of visualforce: 

 

 

              <apex:pageblockSection id="ownerList">

              <apex:pageblockSectionItem >

              <apex:outputText value="{!ownerType}" />

              <apex:selectList value="{!problem.ownerId}"  size="1">

              <apex:selectOptions value="{!owners}" />

              </apex:selectList>

              </apex:pageblockSectionItem>

              <apex:pageblockSectionItem >

              <apex:outputText value="Owner Type"/>

              <apex:selectList id="ownerType" value="{!ownerType}" size="1">

              <apex:actionSupport event="onchange" rerender="ownerList" immediate="true" status="status">

              <apex:param name="ownerType" value="{!$CurrentPage.parameters.ownerType}" assignTo="{!ownerType}" />

              </apex:actionSupport>

              <apex:selectOption itemValue="user" itemLabel="User"/>

              <apex:selectOption itemValue="group" itemLabel="Group"/>

              </apex:selectList>

              </apex:pageblockSectionItem>

              </apex:pageBlockSection>

 

I'm rather sure that the problem is in the apex:param tag, but I can't figure out what to set the value of the param tag to. I tried $CurrentPage.parameters.ownerType but it came back null when the ownerList pageblock was rerendered.

 

Thanks for the wonderful support community! 

 

 

I've just started working on a yet to be released force.com app that's using sites for a customer portal, as well as the traditional salesforce interface for users that have a seat license.

 

So there's an object with tab already defined that works in our salesforce interface. I need to not change the functionality of that exiting tab, but I also need to set the tab in the customer portal to a different visualforce page and not just the built-in standard controller interface.

 

In less abstract terms, tab X needs to be tied to visualforce1 in the force.com interface, and tied to visualforce2 in the customer portal/sites interface.

 

Is this possible? If so how would one go about setting it up? 

Hi,

Does anyone know a way to have an inputText field take the action of the commandbutton when the user presses enter?

I have a simple form with one inputtext and one commandbutton. The button just does the action piece. Can I bind an user press on the input text to that action?

Thanks!
  • January 19, 2009
  • 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?
Can we use SOSL in APEX?
Is there any way to force a Collapsible PageBlockSection to start in a collapsed mode, when the page is rendered?  I know with standard page layouts, this isn't possible, but Salesforce remembers what a user chooses and uses that in the future to determine the collapsible state when rendering a page.  So far, I have not seen this same behavior with Visualforce pages.  It would be nice to have a parameter on the PageBlockSection that controls the initial behavior of a collapsible PageBlockSection when it it first rendered.
 
Jon Keener


Message Edited by Jon Keener on 02-14-2008 01:06 PM