• dsh210@lehigh.edu
  • NEWBIE
  • 25 Points
  • Member since 2010

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

Hi All,

 

I am trying to figure out how to direct a chatter post at a user when it is created in Apex. Looking at existing posts, the Body just contains '@ Sample User'. However, simply adding that text to the body of a new Chatter post in Apex yields just plain text. When creating in the UI, the syntax @[Sample User] is used, but in Apex this generates the same plain text result.

 

Has anyone figured out how to successfully direct an Apex created FeedItem (Chatter Post) at another user?

 

Thanks,

DH

Hey All,

 

I have a custom visualforce page that allows users to edit data and create new records inline in a way that is very different from the way Salesforce supports with standard pages. I am trying to extend some ListView functionality into the page to make it easier for users to deal with having a lot of records (for example, only looking at records of a certain type, etc.). This also brings in pagination functionality.

 

I am aware of the <apex:listView> tag, but this does not help since I do not want the standard Salesforce view. What I am trying to do is leverage the functionality that the ListViews provide in Apex, then pass the record sets to my visualforce page and display them in the custom manner. Unfortunately, I have been unable to access the ListViews object in APEX.

 

Does anyone know how to utilize the ListView object (Salesforce ListView Object) inside of an Apex class? I would like to have the user define new aspects of a Listview then use it to filter the records and paginate them.

 

Thanks!

Derrek

Hey All,

 

I apologize if this has already been solved, but it is very difficult to search for since the term 'queue' is so frequent in other uses. 

 

I have a trigger that is creating and assigning cases based off Opportunity action. However, I would like to be able to select and assign the case to a queue. Apex tells me that the SObject Queue is not supported ( [SELECT Id FROM Queue] ), and Queues have no entry in the User Table. 

 

If I know that I want to assign the case to a queue called 'MyQueue', I would like to be able to code that in rather than hardcode the ID. This will ensure that the trigger will work in any org we place it in.

 

Any suggestions are appreciated!

-DH

Hey All,

 

I have a requirement that I change the style of certain options in picklists (or multiselects) based on certain criteria. I have been struggling with how to style these elements in visualforce. I tried injecting some html/css into the label part of the selectoption, but I discovered that the <option> tag in HTML cannot have child elements. Ideally I would like to add a class to that <option> tag that visualforce renders my selectoptions as. A few requirements I have:

 

I must use <apex:selectOptions> because I have a dynamic number of options.

I will also have a dynamic number of these selectLists, so using an id will not work.

 

Anyone have any suggestions on this area?

 

 

P.S. This is what I am shooting for:

SelectList

Hey All,

 

I have been beating myself up over this lately and am wondering if I am just doing something small incorrectly. I have a Visualforce Controller class that creates an instance of another Apex Class. While the page is loading, the methods in the instance run fine. However, when I try to print the state of the instance later, all of its variables have no value anymore, despite the fact that I have not cleared them. This results in me having to do a SOQL call again to repopulate them before running the methods again, which is costly and slow. Below is sample code of what I am doing:

 

 

public with sharing class myVisualForceCtrl {
	
	public ClassB myInstance;
	
	public myVisualForceCtrl() {
		myInstance = new ClassB();
		myInstance.printState();
	}
	
	public void showState() {
		myInstance.printState();
	}
}

public with sharing class ClassB {
	
	List<Account> testAccount;
	
	public ClassB() {
		testAccount = [SELECT Name FROM Account];
	}
	
	public void printState() {
		System.Debug('CURRENT INSTANCE STATE: ' + testAccount);
	}
}

 

 

During the initial page load, testAccount is correctly populated. However, I have a button on my visualForce page that runs the printState method again and does a reRender. This always shows the testAccount to be null.

 

Is this something I am doing incorrectly or is this the nature of Apex?

 

Thanks for any tips!

I have a very complex Salesforce application that requires pulling a large amount of data from the database. Because of this, my custom Visualforce page can take up to 10 seconds to load. Currently, the user is presented the white screen that is the blank.html screen provided by Visualforce.

 

I am wondering if anyone knows of a way I can override that page or using some other method, present a loading message. Having feedback that their information is being retrieved and set up would be far more useful than just that white page.

 

Thank you for your suggestions!

Derrek

 

P.S. I tried a javascript redirect where a loading page redirected to their custom page, but the second the redirect is initiated, blank.html is loaded up.

Hey all,

 

I just ran into an issue where in some cases I will need to insert more than 100 objects from a command button call on a visualforce page. I obviously cannot have 100+ insert calls, since that runs over the gov limit. However, can I get around this by inserting an array of objects or using some other method?

 

Thanks,

DH

Hey All,

 

I am wondering if it is possible to apply the new Salesforce tab style to an <apex:tabPanel> object.

 

Tab Style

 

I understand that I can apply custom css, but I was hoping that I could get access to the Salesforce styles.

 

Thanks for any help,

DH

Hey All,

 

I am trying to create a custom component that will be repeated many times on a page. However, I was looking to pass some parameters into the controller of this component. Is there any way I can have visualforce do this rather than just calling the standard controller? The issue I am trying to solve is rendering several pageblocks for different parts of a set of data. I want to be able to pass the list of data pieces into the constructor so I can use a pageblocktable to render it in the component.

 

Thanks for any suggestions,

DH

Hey all,

 

I am having an issue where a SELECT statement is only returning the first 20 records, despite the fact that I have not placed any limits on it. Is there a limit of 20 for what a SELECT can return?

 

If not, I can post my code to see if anyone can help me with why my query is being limited.

 

Thanks!

-Derrek

Hey,

 

I was looking to enhance user experience by providing some better error messages. The one I am trying to overload now, is where it does not have an ID it needs in the URL, so rather than saying 'List out of bounds', I would like to explain to users that they need to go back and select a new ID to continue. I tried the following:

LIST<Model_Definition__c> temp = [SELECT Name FROM Model_Definition__c WHERE Id = :ModelDefId LIMIT 1];
    try {
        return temp[0].Name;
    }
    catch(Exception e){
        ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error: No objects could be found. Most likely, you no longer have a model selected. Please return to the model selection screen'));
    }
    return null;

 

 

but I still get a blank page displaying just the list out of bounds error. Does anyone know the proper way to override those error pages/messages?

 

Thanks!

Hey all,

 

So I am using some command buttons to execute some page redirects via page references, but I was wondering how I could specify the target for the new window. I know that outputLink has the target attribute, but I would like to stick with the default Salesforce style on the buttons and not have to recreate it myself. Right now I have resorted to using javascript because I can specify "_parent", but does anyone know how to accomplish this with a PageReference?

 

Thanks!

Hey all,

 

I am trying to render an series of input boxes another color, to make them stand out. However, one of the boxes is a lookup, and it seems to be applying the css that I put on the inputfield to the little lookup image next to the field. Is there any way that I can get rid of that background behind the image? It looks pretty terrible.

 

 

Thanks,

DSH

Hey All,

 

So I am currently facing an issue here. I have a picklist that controls what attribute type a new attribute will be. Each attribute type has different parameters for the user to set. The way my page is currently set up, the user has to select a different type, then click an update button to get the page to refresh with the new options (by running an 'update' command in APEX). Is there any way I can get it to run the update using an "onChange" element? I tried several different ways but always got an error.

 

onChange="{!Updates}" with an Apex method getUpdates() gave a server crash.

onChange="updatesScript()" with the same Apex and a javascript method calling {!Updates} gave me a DML not supported error.

 

I read that I cannot use DML inside a getter. However, if I change the method to just Updates(), my visualforce page cannot see it and I get the error that the method doesn't exist in the controllers (it's obviously still looking for the get).

 

Does anyone know how I can get this page to update when I change that field?

 

Thanks!

Hey all,

 

What I am trying to do here is create dynamic columns based on some attributes. However, I am getting a complaint that <apex:column> needs to be the direct child of <apex:pageTable>. Is there any way I can get those columns to repeat through the object's attributes? I found one solution that uses standard HTML <table>'s, etc, but that loses all the SF formatting, which is very important on this project.

 

Here is what I was trying:

 

<apex:repeat value="{!AttrDefs}" var="attr">
  <apex:column>
    <apex:facet name="header">
<apex:outputLabel value="{!attr.Name}"/>
</apex:facet> <apex:inputText value="{!row.col1}" /> </apex:column> </apex:repeat>

Thanks for suggestions!

So earlier I was trying to hide/show elements to implement a filter system. However, it was brought to my attention that it would be far easier to rerun the query I used to get the elements in the first place, just use a WHERE clause with the filter. However, I am wondering how to get the page to update with these new results. I am storing the filter in a global Apex variable and running this constructor:

 

 

    public DefinitionSetCtrl(ApexPages.StandardSetController controller) {
        Database.QueryLocator ql;
        ID modelDefId = ApexPages.currentPage().getParameters().get('ModelDefId');
        if(Filter == null){
        ql = Database.getQueryLocator(
            [select Name, Attribute_Type__c, Is_Required__c, Default_Checkbox_Value__c,
                                 FROM Attribute_Definition__c
             WHERE My_Definition__c = :modelDefId             ]
        );}
        else {
        ql = Database.getQueryLocator(
            [select Name, Attribute_Type__c, Is_Required__c, Default_Checkbox_Value__c,
                                 FROM Attribute_Definition__c
             WHERE My_Definition__c = :modelDefId AND Attribute_Type__c = :Filter
             ]
        );}
        StdSetCtrl = new ApexPages.StandardSetController(ql);
        DefList = (Attribute_Definition__c[])StdSetCtrl.getRecords();
}

 The filter gets updated when the user selects a type to filter on, but I am wondering how to get the page to rerun that query and display the new selection. When it runs again it should see the new Filter value and jump into that else to display only the records of type Filter.

 

Any suggestions are much appreciated, thanks!

 

Hey, quick question...

 

I am attempting to implement a filtering system where I render certain elements based on their type. I am trying to use a javascript method to control the rendering, but it is always returning false, does anyone know what the issue might be?

 

 

<apex:inputText value="{!def.myDef.Name}" rendered="getFilter()" />
 <script>
  function getFilter(){
   var myBool = true;
   return myBool;
  }
 </script>

 This is simply not rendering the element, which leads me to believe the javascript is not being evaluated, but I am not sure why that would be the case.

 

Hey so I am wondering how I would accomplish the following:

 

I have a custom VF page with a list of custom objects on it. When a user clicks the title of a custom object, I want the user to be taken to the edit page for that custom object. I noticed that force.com titles the pages like https://na3.salesforce.com/a01A0000001aQoj. I am wondering where it is pulling that custom string from, so that I can create a string and append that to take the user to the correct edit page.

 

Thank you in advance for any help!

Hey all,

 

So I have done minimal work with SOQL/SOSL, so I thought the community might be able to help me out with this beginner question. I am trying to query a custom object I have for the name. I am running a custom visualforce page that looks up various attributes of the object. So in my case the instance of my Model Definition object is called "Model 1" (stored as Model Definition Name). I would like to print the name of the instance at the top of the page since that is a lot more user friendly. I am thinking I would construct a query along the lines of...

 

SELECT 'Model Definition Name' FROM Model_Definition__c WHERE Model_Definition__c = :modelDefId

 

I got the modelDefId from the current page using ApexPages.currentPage().

 

It doesn't like the format of that Model Definition Name though. If I try to use Model_Definition_Name__c, it says that field does not exist on the object. Any suggestions on how to reference it or if I am even setting up this query correctly?

 

Thanks!

I have a custom visualforce page that displays some fields that the user can edit the values of. When the user clicks my save button, it updates the values (just by running the command "update" on the object) and returns to a list of all the elements. The update was working fine, but then as I was editing, it simply stopped working. I undid all of the changes I had made since it was last working and no dice... 

 

Does anyone know what may block this update from taking place? I make my changes, save them, then they just retain their old values.

 

Thanks for any suggestions.

Hey All,

 

I apologize if this has already been solved, but it is very difficult to search for since the term 'queue' is so frequent in other uses. 

 

I have a trigger that is creating and assigning cases based off Opportunity action. However, I would like to be able to select and assign the case to a queue. Apex tells me that the SObject Queue is not supported ( [SELECT Id FROM Queue] ), and Queues have no entry in the User Table. 

 

If I know that I want to assign the case to a queue called 'MyQueue', I would like to be able to code that in rather than hardcode the ID. This will ensure that the trigger will work in any org we place it in.

 

Any suggestions are appreciated!

-DH

Hey All,

 

I have a requirement that I change the style of certain options in picklists (or multiselects) based on certain criteria. I have been struggling with how to style these elements in visualforce. I tried injecting some html/css into the label part of the selectoption, but I discovered that the <option> tag in HTML cannot have child elements. Ideally I would like to add a class to that <option> tag that visualforce renders my selectoptions as. A few requirements I have:

 

I must use <apex:selectOptions> because I have a dynamic number of options.

I will also have a dynamic number of these selectLists, so using an id will not work.

 

Anyone have any suggestions on this area?

 

 

P.S. This is what I am shooting for:

SelectList

Hey All,

 

I have been beating myself up over this lately and am wondering if I am just doing something small incorrectly. I have a Visualforce Controller class that creates an instance of another Apex Class. While the page is loading, the methods in the instance run fine. However, when I try to print the state of the instance later, all of its variables have no value anymore, despite the fact that I have not cleared them. This results in me having to do a SOQL call again to repopulate them before running the methods again, which is costly and slow. Below is sample code of what I am doing:

 

 

public with sharing class myVisualForceCtrl {
	
	public ClassB myInstance;
	
	public myVisualForceCtrl() {
		myInstance = new ClassB();
		myInstance.printState();
	}
	
	public void showState() {
		myInstance.printState();
	}
}

public with sharing class ClassB {
	
	List<Account> testAccount;
	
	public ClassB() {
		testAccount = [SELECT Name FROM Account];
	}
	
	public void printState() {
		System.Debug('CURRENT INSTANCE STATE: ' + testAccount);
	}
}

 

 

During the initial page load, testAccount is correctly populated. However, I have a button on my visualForce page that runs the printState method again and does a reRender. This always shows the testAccount to be null.

 

Is this something I am doing incorrectly or is this the nature of Apex?

 

Thanks for any tips!

In my Organization there are totally 4 triggers on Opportunity and 4 triggers on Account. Each trigger fires 2 or 3 SOQL statements. None of the triggers have SOQL statements inside For or If loop.

 

When i create a Opportunity, it fires all these 8 triggers and thus hitting Governer Limits.

 

Any suggestions on How to proceed from here?

 

 

  • January 27, 2011
  • Like
  • 0

Hey All,

 

I am wondering if it is possible to apply the new Salesforce tab style to an <apex:tabPanel> object.

 

Tab Style

 

I understand that I can apply custom css, but I was hoping that I could get access to the Salesforce styles.

 

Thanks for any help,

DH

Background - I have an Object in Salesforce called Shifts, where the user will enter a shift, they are required to enter:


Date

Start Time

End Time

Department

 

The Employee isn't always entered yet, because somebody has to be assigned, but a lot of times it's there. The reports from Salesforce are limited in how you can display them, it's a lot harder to see where the open shifts are and when people are free if you view these shifts in a list view. Prior to Salesforce, we used Excel and we had something like this (this is just a snippet, It's MUCH larger with many more departments and employees)

 

Schedule Snippet

 

I have all the things you see in this view available in Salesforce. I have a formula field that generages everything in the little boxes. I need some advice / help on how I can write in visualforce, to put the Shift summary formula field under a column based on that shift's Date value. Basically, from left to right I'd like them organized by date, with one day per column. From top to bottom I'd like them organized alphabetically.

 

Any ideas / suggestions?

 

Thanks!

Hey all,

 

I am having an issue where a SELECT statement is only returning the first 20 records, despite the fact that I have not placed any limits on it. Is there a limit of 20 for what a SELECT can return?

 

If not, I can post my code to see if anyone can help me with why my query is being limited.

 

Thanks!

-Derrek

Hey,

 

I was looking to enhance user experience by providing some better error messages. The one I am trying to overload now, is where it does not have an ID it needs in the URL, so rather than saying 'List out of bounds', I would like to explain to users that they need to go back and select a new ID to continue. I tried the following:

LIST<Model_Definition__c> temp = [SELECT Name FROM Model_Definition__c WHERE Id = :ModelDefId LIMIT 1];
    try {
        return temp[0].Name;
    }
    catch(Exception e){
        ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error: No objects could be found. Most likely, you no longer have a model selected. Please return to the model selection screen'));
    }
    return null;

 

 

but I still get a blank page displaying just the list out of bounds error. Does anyone know the proper way to override those error pages/messages?

 

Thanks!

I have a new work pc ((Windows 7 64 bit) and want to install Force.com IDE

 

I downloaded the standalone Windows 64 installation and after configuring proxy settings as per the advice of our Tech Services proceeded to install but the Pulse installation seems to freeze half way through.

 

Tried the same installation on my home PC but seems to stop installing half way through "Installing Force.com IDE: Fetching software - 44.9 MB remains

 

Are there any detailed installation instructions for standalone installation. Or any advice?

 

I previously used Force.com under Eclipse on my Windows XP PC but only need Eclipse for Salesforce.

 

Screen grab 

 

 

 

 

  • July 02, 2010
  • Like
  • 0

Hey all,

 

So I am using some command buttons to execute some page redirects via page references, but I was wondering how I could specify the target for the new window. I know that outputLink has the target attribute, but I would like to stick with the default Salesforce style on the buttons and not have to recreate it myself. Right now I have resorted to using javascript because I can specify "_parent", but does anyone know how to accomplish this with a PageReference?

 

Thanks!

Hey all,

 

I am trying to render an series of input boxes another color, to make them stand out. However, one of the boxes is a lookup, and it seems to be applying the css that I put on the inputfield to the little lookup image next to the field. Is there any way that I can get rid of that background behind the image? It looks pretty terrible.

 

 

Thanks,

DSH

Hey all,

 

What I am trying to do here is create dynamic columns based on some attributes. However, I am getting a complaint that <apex:column> needs to be the direct child of <apex:pageTable>. Is there any way I can get those columns to repeat through the object's attributes? I found one solution that uses standard HTML <table>'s, etc, but that loses all the SF formatting, which is very important on this project.

 

Here is what I was trying:

 

<apex:repeat value="{!AttrDefs}" var="attr">
  <apex:column>
    <apex:facet name="header">
<apex:outputLabel value="{!attr.Name}"/>
</apex:facet> <apex:inputText value="{!row.col1}" /> </apex:column> </apex:repeat>

Thanks for suggestions!

So earlier I was trying to hide/show elements to implement a filter system. However, it was brought to my attention that it would be far easier to rerun the query I used to get the elements in the first place, just use a WHERE clause with the filter. However, I am wondering how to get the page to update with these new results. I am storing the filter in a global Apex variable and running this constructor:

 

 

    public DefinitionSetCtrl(ApexPages.StandardSetController controller) {
        Database.QueryLocator ql;
        ID modelDefId = ApexPages.currentPage().getParameters().get('ModelDefId');
        if(Filter == null){
        ql = Database.getQueryLocator(
            [select Name, Attribute_Type__c, Is_Required__c, Default_Checkbox_Value__c,
                                 FROM Attribute_Definition__c
             WHERE My_Definition__c = :modelDefId             ]
        );}
        else {
        ql = Database.getQueryLocator(
            [select Name, Attribute_Type__c, Is_Required__c, Default_Checkbox_Value__c,
                                 FROM Attribute_Definition__c
             WHERE My_Definition__c = :modelDefId AND Attribute_Type__c = :Filter
             ]
        );}
        StdSetCtrl = new ApexPages.StandardSetController(ql);
        DefList = (Attribute_Definition__c[])StdSetCtrl.getRecords();
}

 The filter gets updated when the user selects a type to filter on, but I am wondering how to get the page to rerun that query and display the new selection. When it runs again it should see the new Filter value and jump into that else to display only the records of type Filter.

 

Any suggestions are much appreciated, thanks!

 

Is it possible to determine whether the current user has delete permissions (aka Full Access) for a particular record (custom object), without actually attempting to delete the record?

I'm creating some custom actions using VF/apex, and for some of them I want to limit who can perform the action to the same users who can delete the record.  The action does not involve deleting the record, but I want it to be more restrictive than who can perform an edit.

I looked into the sharing table (object_share) but that only lists the owner as Full Access.  Since anyone above the owner in the role hierarchy also has full access, and the hierarchy might be several levels tall, it seems like a tall order for my code to walk the entire hierarchy and determine if that applies.  Is there an easier way?

Thanks much!
  • August 04, 2008
  • Like
  • 0