• ToddKruse
  • NEWBIE
  • 50 Points
  • Member since 2009

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 29
    Questions
  • 41
    Replies

Currently in our system, a user adds Assignments to a project.  They do this by going into the project and clicking the "New Assignment" button which takes them to a new screen where they enter in the required information.  When they click the save button, the required record(s) are created in the system and redirects the page to a different location showing them the records they created.

 

What they would like to have happen is, once the user clicks the save button on the Assignment screen, to redirect the user back to the Projects screen.

 

Is this possible?

 

Thanks

 

--Todd Kruse

 

 

I have to retrieve possibly more than 10,000 rows in an SOQL query.  I thought what I could do was create multple SOQL queries that would return parts of the data and then take each of those lists and combine it into one big list since the Spring 10 release has removed the limits on list objects.

 

I have created a master list, and then did for each loops with different soql queries to populate that master list, but was hoping there was a cleaner way of doing it.

 

Thanks

 

--Todd Kruse

 

I have VF page using a <table> with a <repeat> tag in it that is displaying information returned from an apex Class in the form of a <list> object.

 

The problem is, I am having to convert my decimal values to a string, format it with a dollar sign, put in the commas, etc.  Well, with the govenors in salesforce, this is getting taxing on the system.  Is there anyway to take a decimal and display it as currenty in the VF page?

 

 

 

So I am returning a list object,  and below is a sample of the <repeat> tag within the <table> tag.

 

<apex:repeat value="{!ReportValues}" var="RV">

                    <tr> 

 

                        <td width = "70px" align="right">

                            <apex:outputLabel value="{!RV.totApril}" />

                        </td>

                        <td width = "70px" align="right">

                            <apex:outputLabel value="{!RV.totMay}" />

                        </td>

 

    </tr>

</apex:repeat>

 

 

Thanks for any help you can give me.

 

--Todd Kruse

 

We have two tables Assignments and Schedules.

 

An assignment can have 1 to many schedules.  A schedule can only have 1 assignment.

 

Due to how we have our reports set up, there is NO WAY we can have a foreign key back from Schedule back to Assignment. 

 

What we have is in the Schedule is a lookup field that points back to the Assignment table. When we delete the Assignment, that lookup field in the schedule table goes away.  

 

We have a trigger on the Assignment with a "BEFORE DELETE".  We fire off a class that attempts to delete all of the Schedule entries that are tied to it.  the code for that is below:

 

public class deleteScheduleRows 

{

@future

    public static void deleteRows(ID assignmentID)

    {

     Integer iCount;

     iCount = [SELECT count() FROM SFDC_Schedule__c WHERE Assignment__c =: assignmentID];

     while (iCount > 0)

     {

     List<SFDC_Schedule__c> newList = [SELECT id FROM SFDC_Schedule__c WHERE Assignment__c =: assignmentID LIMIT 900];

     delete newList;

     iCount = iCount - 900;

     }

    }

}

 

However, it seems that the Assignment is being deleted first, and its removing the lookup field value in the Schedule table so there is no way to remove the old rows.

 

I tried removing the "@future" from the class, but then when I attempt to create the list it throws an error about hitting the 1001 limit.

 

Any ideas?

 

Thanks

 

--Todd Kruse

 

 

I have the following piece of code in an apex class:

 

     // Convert the Date object to a DateTime object

DateTime checkDate = Datetime.newInstance(compDate.year(), compDate.month(), compDate.day(), 0,0,0);

// Assign the day (monday, tuesday, etc) to a string 

String dayOfWeek = checkDate.format('EEEE');

 

I am noticing that when I do a large number of calls to this, I am hitting the heap limit of 200,000.

 

All I am looking to do is check the day (monday, tuesday, etc) of a date.  But for some reason, I have to convert it to a DateTime to do this.  Is there a better way?

 

Thanks

 

--Todd Kruse 

I have an issue where a user has created a report in a reporting folder.  He went to delete it, and is receiving this error message:

 

Insufficient Privileges

You do not have the level of access necessary to perform the operation you requested.  Please contact the owner of the record or your administrator if access is necessary.

 

 

What doesn't make sense is, he created the report, and he can click on "delete" link.  So whats up with the permissions?

 

Thanks

 

--Todd Kruse

 

I have the code below working in our staging environment.  When we push this to production, the highlighted/bolded section needs to change because the value is different between the two environments.  My question is, is there a way to dynamically grab this piece of code so we don't risk issues when pushing changes in this object up from our staging environment to production at a later date.  It looks like the section in question is the unique id of the object we are trying to open when the user clicks on the button.

 

Thank you

 

CODE:

window.parent.location.href="{! urlFor( $Action.Billing_Event__c.New)}&CF00NT00000018p8L_lkid={!SFDC_Projects__c.Id}&CF00NT00000018p8L={!SFDC_Projects__c.Name}"; 

I have created a list of lists.  What I need to do now is to loop through each of the inner loops.

 

Here is my code so far:

 

List<List<SFDC_Schedule__c>> allSchedules = new List<List<SFDC_Schedule__c>>();

List<SFDC_Schedule__c> tempList = new List<SFDC_Schedule__c>();

for (SFDC_Schedule__c item : [Select id, name, Assigned_Name__c, ServiceDate__c, Total__c, Project__c

From SFDC_Schedule__c 

Where ServiceDate__c >: startDate

And ServiceDate__c <: endDate

And Project__c <> null

Order By Assigned_Name__c, ServiceDate__c]) 

{

tempList.add(item);

if (tempList.size() == 10) 

{

allSchedules.add(tempList);

tempList.clear();

}

}

 

if (tempList.size() > 0) 

{

allSchedules.add(tempList);

tempList.clear();

 

 

Then trying to loop through the lists inside the master list:

 

       list<sfdc_schedule__c> LoopList = new list<SFDC_Schedule__c>();

      

       system.debug('helloworld1 ' + allSchedules.size());  

for(integer i = 0; i < allSchedules.size(); i++)

{

system.debug('helloworld2  ' + i);

LoopList = new list<SFDC_Schedule__c>();

LoopList = allSchedules[i];

system.debug('helloworld3  ' + LoopList.size());

for(integer v = 0; i < LoopList.size(); v++)

    {

    system.debug('helloworld4 ' + LoopList[v].Project__c);

    }

 

helloworld1 is showing 11 (which means there are 12 lists inside the master list

helloworld2 is displaying the numbers 0 thru 11 

helloworld3 is always displaying 0.

helloworld4 is NEVER being hit. 

 

I know I am missing something very basic here.  Any help would be great.

 

Thanks

 

--Todd Kruse

 

HELP!

 

I have a problem with a class.  I have create a list object of all the projects that fit a criteria.  Then i am looping through that list to build some report data.

 

Within this loop, I have 1 SOQL select statement that is grabbing all associated schedules for the project that is current in the loop.  This SOQL statement is just returning those values into a list object.

 

I am hitting that 101 SOQL max.  Is there anyway to filter down a List object?  Figure I can move the one SOQL statement out of the loop, but I still need to filter it down to get the totals i need for the report?

 

Any help would be great,  I am really in need of a solution on this one fast.

 

Thanks

 

--Todd Kruse 

We have a custom page called "Project".  In the page for Project, we have different related lists (Assignments and Billing Events).

 

What we need to do is, when the user clicks the "New Assignment" button in one of the related lists, we check a value on the Project page to see if they should be clicking that button or not.  If they are not supposed to, display a message stating this, or if they can click the button, allow them to go to the new screen.

 

Another idea we had was to disable the "New Assignment" button in the related list on page load.  Any ideas how to do either?

 

Thanks

 

--Todd Kruse

 

 

Message Edited by ToddKruse on 02-15-2010 10:16 AM

I have code now that when using apex:detail subject="{!project}".  It displays the "Project" object just fine.  In that Project pay layout is a section for assignments.  There can be anywhere from 1 to many assignments per project.

 

The current page layout allows me to click the "Create New Assignment" and it takes me to a different page.

 

My boss would like to have it all stay on the same page.  So when the user clicks that "create new assignment" button, we don't leave the project page, but the assignment creation/edit screen displays on that screen.

 

Is this even possible? And if so, any good samples?

 

Thanks

 

--Todd Kruse

 

Is there a different discussion board section for Flex development? 

 

I am trying to create a flex component that basically does the exact same thing as a VF tag "<apex:detail>"

 

Thanks

 

--Todd Kruse 

I have a VF page that I want to use to overwrite the standard page the user sees when they click the "Projects" tab.  Currently, clicking the tab brings you to the layout that we defined in house, and all is pretty.

 

However, when I overwrite the "Standard Buttons and Links" "Tab" option with my code that I will show below, it loads fine to begin with.  Then when the user selects a project from a selectList dropdown and clicks the "Search" button, they are pulled away from my new custom page and brought right back to the original "Projects" page.

 

Here is my VF code:

 

 

<apex:page controller="VFProjectClass" sidebar="false" showHeader="true">

 <apex:pageBlock title="My Projects">  

  <apex:form > 

   

   <apex:pageBlockSection id="meetSelectionSection2" >

 <apex:selectList id="selectId" value="{!selectId}" multiselect="false"  size="1">

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

 </apex:selectList>  

 

  <apex:commandButton action="{!search2}" value="Search" id="searchBtn" >

 

  </apex:commandButton>

 

    <apex:outputPanel id="OP2" layout="block">

    <div style="width:1000px">

   <apex:detail />

   </div>

   </apex:outputPanel>

   </apex:pageBlockSection>

  </apex:form> 

 </apex:pageBlock>

</apex:page> 

 

And here is the Class code dealing with the "search2" code of the commandButton:

 

public String selectId

{

get;

set;

}

   

public PageReference search2() 

{

Id newValue = selectId;

 

SFDC_Projects__c acc = [Select Id From SFDC_Projects__c Where id =: newValue Limit 1];

 

PageReference next = new PageReference('/'+ acc.id);

   next.setRedirect(true);

    return next;

 

 

}

 

Any help would be great on this.  I want to prevent moving away from this page.  I just want the lower section of code, the "<apex:detail />" to refresh with the information that was selected in the dropdown list.

 

Thanks

 

--Todd Kruse 

 

 

I have a class that builds a complex listobject.  This class is called from a VF page.  Everything is displaying correctly EXPECT for what looks to be an empty table row before the table data and then another one immediately after the table data.  Below is a  sample of what I am doing with the apex:repeat tag:

 

                <apex:repeat value="{!ReportValues}" var="RV">

                    <tr> 

                        <td width = "90px">

                            <apex:outputLabel value="{!RV.strStage}" />

                        </td>

                        <td width = "210px">

                            <apex:outputLabel value="{!RV.strAccount}" />

                        </td>

                        <td width = "210px">

                            <apex:outputLabel value="{!RV.strProject}" />

                        </td>

                        <td width = "210px">

                            <apex:outputLabel value="{!RV.strRole}" />

                        </td>

                    </tr>

                </apex:repeat> 

 

Any ideas as to WHY this would be attempting to insert an empty table row before and after the data?  Another interesting tidbit.  In Google Chrome we only see one empty cell under the first column.  In FireFox we see two empty cells covering the first two columns.

 

Thanks

 

--Todd Kruse

 

Here is the code I am using in my swf file.  I am clicking the "debug" button.  The error message is after the code.  The username/password I am using (not what you are seeing) is what I use to log into one of our sandboxes as if I was a user logging into salesforce.  Any help would be greatly appreciated.

 

Thanks

 

<?xml version="1.0" encoding="utf-8"?>

<mx:Application creationComplete="login(event)" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:salesforce="http://www.salesforce.com/">

<salesforce:Connection id="apex" serverUrl="https://www.salesforce.com/services/Soap/u/9.0" />

 

<mx:Script>

<![CDATA[

import mx.collections.ArrayCollection;

import com.salesforce.results.QueryResult;

import mx.utils.ObjectUtil;

import mx.controls.Alert;

import com.salesforce.AsyncResponder;

import com.salesforce.objects.LoginRequest;

private function login(event:Event):void {

var lr:LoginRequest = new LoginRequest();

lr.username = "xxxxxx";

lr.password = "xxx";

lr.callback = new AsyncResponder(loadData, handleFault);

apex.login(lr);

}

 

[Bindable]

private var accountList:ArrayCollection = new ArrayCollection();

private function handleFault(fault:Object):void {

Alert.show(ObjectUtil.toString(fault));

}

private function loadData(lr:Object):void {

apex.query("Select Name, Phone, Type From Account", new AsyncResponder(

function(qr:QueryResult):void {

if (qr.size > 0) {

accountList = qr.records;

}

}, 

handleFault)

);

}

]]>

</mx:Script>

<mx:DataGrid dataProvider="{accountList}" left="10" right="10" top="10" bottom="10">

<mx:columns>

<mx:DataGridColumn dataField="Name"/>

<mx:DataGridColumn dataField="Phone"/>

<mx:DataGridColumn dataField="Type"/>

</mx:columns>

</mx:DataGrid>

</mx:Application>

 

here is the error message:

 

 (com.salesforce.results::Fault)#0

  context = (null)

  detail = (Object)#1

    LoginFault = (Object)#2

      exceptionCode = "INVALID_LOGIN"

      exceptionMessage = "Invalid username, password, security token; or user locked out."

      xsi:type = "sf:LoginFault"

  faultcode = "INVALID_LOGIN"

  faultstring = "INVALID_LOGIN: Invalid username, password, security token; or user locked out."

Hello all.

 

I am working on a "phase 2" requirement where I am going to be creating a custom VF page with information from the SFDC_Proejcts__c object.  

 

A little background.  When the user is on the Projects tab and they want to add a resource (person) to be assigned to the project, they click the "add resource" button and it brings you to a different page where you enter in the information.  Works great.  

 

However, the powers that be would like all of this to happen on one page.  So when they go to the new Projects page, they can add the reference (person) to the project without being redirected to a different page.  

 

So the question is, can you have a VF page that contains your custom information that also displays in-page another page?

 

Thanks

 

--Todd Kruse 

We have a number of classes/triggers that are brand spankin' new to the salesforce site.  Many of the fields that they are using are not currently in production.  I have created the test cases for each and every class and trigger, and when running those tests against our staging environment, they work just fine.

 

However, when I attempt to "validate" the changes to move to prod, many of these classes/triggers are failing with this error message:

 

System.QueryExpression: List has no rows for assignment to SObject.

 Class.createProjectTestClass.myUnitTest: line 27, column 21 External entry point

 

Looking at the test case, the reason is, the "select" statement isn't bringing anything back since the data to support the test case doesn't exist in production.

 

Help!

 

--Todd Kruse

 

I have a question regarding page layouts and how to combine items into one "page".  We have two custom objects (Projects & Assignments).  Currently, the Projects page has a section at the bottom which contains a list of all assignments that are related to the project.  An assignment for example would be a tech lead, or project manager, etc...

 

When the user clicks the "New Assignment" button, they are routed to a new page where they enter in the new assignment detail.

 

What we would like, is for this new assignment screen to be in the SAME page as the Project.  This way, they are not redirected to a different page, and can see the assignments they have already created.

 

Is this possible?

 

Thanks

 

Todd Kruse

 

Good afternoon everyone.  I have a question regarding the redirection of a page via a VisualForce page.  If the user has a certain user right, I want the view on my object to default to a certain view.  I have this working with this code:

 

<apex:Page tabStyle="SFDC_Projects__c" >

<script src="/soap/ajax/15.0/connection.js"></script>

<script type="text/javascript" />

<script>

     window.onload = function() {

 

     sforce.connection.sessionId = '{!$Api.Session_ID}';

 

     var describeSObjectResult = sforce.connection.describeSObject("sfdc_projects__c");

     var prefix = describeSObjectResult.keyPrefix;

 

     // Determine the View based on the Role of the User

     var cView;

     switch ( "{!$Profile.Name}" ) 

     {

         case "Program Manager": 

             cView = "00BT0000001WNN8"; 

             break ;

         case "System Administrator": 

             cView = "00BT0000001WNN8"; 

             break;

         default: 

             cView = "00BT0000001WUWh"; 

             break;

     }

 

     // Change the whole window to point to this location

     parent.document.location.href = "/" + prefix + "?fcf=" + cView ;

}

</script>

</apex:page>

 

however, when I switch environments, the value i am assigning in the cView = ... is different in each environment.  Is there a way to capture this value dynamically in the environment the code is located?

 

Thanks 

I have found multiple posts on how to edit the apex:page line so that when the VF page is activated, it saves itself to an excel file:

 

<apex:page cache="true" contentType="application/vnd.ms-excel#test.xls" controller="StoreController" language="english">

 

But what I need to do is display the VF page with the panelGrid.  Then the user can click a button or link that will export the grid to excel.

 

I was thinking of just creating a second visualforce page that contains the above apex:page line, but I don't know how to add that logic to a button/link.

 

Thanks

 

Todd 

Currently in our system, a user adds Assignments to a project.  They do this by going into the project and clicking the "New Assignment" button which takes them to a new screen where they enter in the required information.  When they click the save button, the required record(s) are created in the system and redirects the page to a different location showing them the records they created.

 

What they would like to have happen is, once the user clicks the save button on the Assignment screen, to redirect the user back to the Projects screen.

 

Is this possible?

 

Thanks

 

--Todd Kruse

 

 

I have to retrieve possibly more than 10,000 rows in an SOQL query.  I thought what I could do was create multple SOQL queries that would return parts of the data and then take each of those lists and combine it into one big list since the Spring 10 release has removed the limits on list objects.

 

I have created a master list, and then did for each loops with different soql queries to populate that master list, but was hoping there was a cleaner way of doing it.

 

Thanks

 

--Todd Kruse

 

I have VF page using a <table> with a <repeat> tag in it that is displaying information returned from an apex Class in the form of a <list> object.

 

The problem is, I am having to convert my decimal values to a string, format it with a dollar sign, put in the commas, etc.  Well, with the govenors in salesforce, this is getting taxing on the system.  Is there anyway to take a decimal and display it as currenty in the VF page?

 

 

 

So I am returning a list object,  and below is a sample of the <repeat> tag within the <table> tag.

 

<apex:repeat value="{!ReportValues}" var="RV">

                    <tr> 

 

                        <td width = "70px" align="right">

                            <apex:outputLabel value="{!RV.totApril}" />

                        </td>

                        <td width = "70px" align="right">

                            <apex:outputLabel value="{!RV.totMay}" />

                        </td>

 

    </tr>

</apex:repeat>

 

 

Thanks for any help you can give me.

 

--Todd Kruse

 

We have two tables Assignments and Schedules.

 

An assignment can have 1 to many schedules.  A schedule can only have 1 assignment.

 

Due to how we have our reports set up, there is NO WAY we can have a foreign key back from Schedule back to Assignment. 

 

What we have is in the Schedule is a lookup field that points back to the Assignment table. When we delete the Assignment, that lookup field in the schedule table goes away.  

 

We have a trigger on the Assignment with a "BEFORE DELETE".  We fire off a class that attempts to delete all of the Schedule entries that are tied to it.  the code for that is below:

 

public class deleteScheduleRows 

{

@future

    public static void deleteRows(ID assignmentID)

    {

     Integer iCount;

     iCount = [SELECT count() FROM SFDC_Schedule__c WHERE Assignment__c =: assignmentID];

     while (iCount > 0)

     {

     List<SFDC_Schedule__c> newList = [SELECT id FROM SFDC_Schedule__c WHERE Assignment__c =: assignmentID LIMIT 900];

     delete newList;

     iCount = iCount - 900;

     }

    }

}

 

However, it seems that the Assignment is being deleted first, and its removing the lookup field value in the Schedule table so there is no way to remove the old rows.

 

I tried removing the "@future" from the class, but then when I attempt to create the list it throws an error about hitting the 1001 limit.

 

Any ideas?

 

Thanks

 

--Todd Kruse

 

 

I have the following piece of code in an apex class:

 

     // Convert the Date object to a DateTime object

DateTime checkDate = Datetime.newInstance(compDate.year(), compDate.month(), compDate.day(), 0,0,0);

// Assign the day (monday, tuesday, etc) to a string 

String dayOfWeek = checkDate.format('EEEE');

 

I am noticing that when I do a large number of calls to this, I am hitting the heap limit of 200,000.

 

All I am looking to do is check the day (monday, tuesday, etc) of a date.  But for some reason, I have to convert it to a DateTime to do this.  Is there a better way?

 

Thanks

 

--Todd Kruse 

I have created a list of lists.  What I need to do now is to loop through each of the inner loops.

 

Here is my code so far:

 

List<List<SFDC_Schedule__c>> allSchedules = new List<List<SFDC_Schedule__c>>();

List<SFDC_Schedule__c> tempList = new List<SFDC_Schedule__c>();

for (SFDC_Schedule__c item : [Select id, name, Assigned_Name__c, ServiceDate__c, Total__c, Project__c

From SFDC_Schedule__c 

Where ServiceDate__c >: startDate

And ServiceDate__c <: endDate

And Project__c <> null

Order By Assigned_Name__c, ServiceDate__c]) 

{

tempList.add(item);

if (tempList.size() == 10) 

{

allSchedules.add(tempList);

tempList.clear();

}

}

 

if (tempList.size() > 0) 

{

allSchedules.add(tempList);

tempList.clear();

 

 

Then trying to loop through the lists inside the master list:

 

       list<sfdc_schedule__c> LoopList = new list<SFDC_Schedule__c>();

      

       system.debug('helloworld1 ' + allSchedules.size());  

for(integer i = 0; i < allSchedules.size(); i++)

{

system.debug('helloworld2  ' + i);

LoopList = new list<SFDC_Schedule__c>();

LoopList = allSchedules[i];

system.debug('helloworld3  ' + LoopList.size());

for(integer v = 0; i < LoopList.size(); v++)

    {

    system.debug('helloworld4 ' + LoopList[v].Project__c);

    }

 

helloworld1 is showing 11 (which means there are 12 lists inside the master list

helloworld2 is displaying the numbers 0 thru 11 

helloworld3 is always displaying 0.

helloworld4 is NEVER being hit. 

 

I know I am missing something very basic here.  Any help would be great.

 

Thanks

 

--Todd Kruse

 

HELP!

 

I have a problem with a class.  I have create a list object of all the projects that fit a criteria.  Then i am looping through that list to build some report data.

 

Within this loop, I have 1 SOQL select statement that is grabbing all associated schedules for the project that is current in the loop.  This SOQL statement is just returning those values into a list object.

 

I am hitting that 101 SOQL max.  Is there anyway to filter down a List object?  Figure I can move the one SOQL statement out of the loop, but I still need to filter it down to get the totals i need for the report?

 

Any help would be great,  I am really in need of a solution on this one fast.

 

Thanks

 

--Todd Kruse 

I have a VF page that I want to use to overwrite the standard page the user sees when they click the "Projects" tab.  Currently, clicking the tab brings you to the layout that we defined in house, and all is pretty.

 

However, when I overwrite the "Standard Buttons and Links" "Tab" option with my code that I will show below, it loads fine to begin with.  Then when the user selects a project from a selectList dropdown and clicks the "Search" button, they are pulled away from my new custom page and brought right back to the original "Projects" page.

 

Here is my VF code:

 

 

<apex:page controller="VFProjectClass" sidebar="false" showHeader="true">

 <apex:pageBlock title="My Projects">  

  <apex:form > 

   

   <apex:pageBlockSection id="meetSelectionSection2" >

 <apex:selectList id="selectId" value="{!selectId}" multiselect="false"  size="1">

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

 </apex:selectList>  

 

  <apex:commandButton action="{!search2}" value="Search" id="searchBtn" >

 

  </apex:commandButton>

 

    <apex:outputPanel id="OP2" layout="block">

    <div style="width:1000px">

   <apex:detail />

   </div>

   </apex:outputPanel>

   </apex:pageBlockSection>

  </apex:form> 

 </apex:pageBlock>

</apex:page> 

 

And here is the Class code dealing with the "search2" code of the commandButton:

 

public String selectId

{

get;

set;

}

   

public PageReference search2() 

{

Id newValue = selectId;

 

SFDC_Projects__c acc = [Select Id From SFDC_Projects__c Where id =: newValue Limit 1];

 

PageReference next = new PageReference('/'+ acc.id);

   next.setRedirect(true);

    return next;

 

 

}

 

Any help would be great on this.  I want to prevent moving away from this page.  I just want the lower section of code, the "<apex:detail />" to refresh with the information that was selected in the dropdown list.

 

Thanks

 

--Todd Kruse 

 

 

I have a class that builds a complex listobject.  This class is called from a VF page.  Everything is displaying correctly EXPECT for what looks to be an empty table row before the table data and then another one immediately after the table data.  Below is a  sample of what I am doing with the apex:repeat tag:

 

                <apex:repeat value="{!ReportValues}" var="RV">

                    <tr> 

                        <td width = "90px">

                            <apex:outputLabel value="{!RV.strStage}" />

                        </td>

                        <td width = "210px">

                            <apex:outputLabel value="{!RV.strAccount}" />

                        </td>

                        <td width = "210px">

                            <apex:outputLabel value="{!RV.strProject}" />

                        </td>

                        <td width = "210px">

                            <apex:outputLabel value="{!RV.strRole}" />

                        </td>

                    </tr>

                </apex:repeat> 

 

Any ideas as to WHY this would be attempting to insert an empty table row before and after the data?  Another interesting tidbit.  In Google Chrome we only see one empty cell under the first column.  In FireFox we see two empty cells covering the first two columns.

 

Thanks

 

--Todd Kruse

 

Here is the code I am using in my swf file.  I am clicking the "debug" button.  The error message is after the code.  The username/password I am using (not what you are seeing) is what I use to log into one of our sandboxes as if I was a user logging into salesforce.  Any help would be greatly appreciated.

 

Thanks

 

<?xml version="1.0" encoding="utf-8"?>

<mx:Application creationComplete="login(event)" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:salesforce="http://www.salesforce.com/">

<salesforce:Connection id="apex" serverUrl="https://www.salesforce.com/services/Soap/u/9.0" />

 

<mx:Script>

<![CDATA[

import mx.collections.ArrayCollection;

import com.salesforce.results.QueryResult;

import mx.utils.ObjectUtil;

import mx.controls.Alert;

import com.salesforce.AsyncResponder;

import com.salesforce.objects.LoginRequest;

private function login(event:Event):void {

var lr:LoginRequest = new LoginRequest();

lr.username = "xxxxxx";

lr.password = "xxx";

lr.callback = new AsyncResponder(loadData, handleFault);

apex.login(lr);

}

 

[Bindable]

private var accountList:ArrayCollection = new ArrayCollection();

private function handleFault(fault:Object):void {

Alert.show(ObjectUtil.toString(fault));

}

private function loadData(lr:Object):void {

apex.query("Select Name, Phone, Type From Account", new AsyncResponder(

function(qr:QueryResult):void {

if (qr.size > 0) {

accountList = qr.records;

}

}, 

handleFault)

);

}

]]>

</mx:Script>

<mx:DataGrid dataProvider="{accountList}" left="10" right="10" top="10" bottom="10">

<mx:columns>

<mx:DataGridColumn dataField="Name"/>

<mx:DataGridColumn dataField="Phone"/>

<mx:DataGridColumn dataField="Type"/>

</mx:columns>

</mx:DataGrid>

</mx:Application>

 

here is the error message:

 

 (com.salesforce.results::Fault)#0

  context = (null)

  detail = (Object)#1

    LoginFault = (Object)#2

      exceptionCode = "INVALID_LOGIN"

      exceptionMessage = "Invalid username, password, security token; or user locked out."

      xsi:type = "sf:LoginFault"

  faultcode = "INVALID_LOGIN"

  faultstring = "INVALID_LOGIN: Invalid username, password, security token; or user locked out."

Good afternoon everyone.  I have a question regarding the redirection of a page via a VisualForce page.  If the user has a certain user right, I want the view on my object to default to a certain view.  I have this working with this code:

 

<apex:Page tabStyle="SFDC_Projects__c" >

<script src="/soap/ajax/15.0/connection.js"></script>

<script type="text/javascript" />

<script>

     window.onload = function() {

 

     sforce.connection.sessionId = '{!$Api.Session_ID}';

 

     var describeSObjectResult = sforce.connection.describeSObject("sfdc_projects__c");

     var prefix = describeSObjectResult.keyPrefix;

 

     // Determine the View based on the Role of the User

     var cView;

     switch ( "{!$Profile.Name}" ) 

     {

         case "Program Manager": 

             cView = "00BT0000001WNN8"; 

             break ;

         case "System Administrator": 

             cView = "00BT0000001WNN8"; 

             break;

         default: 

             cView = "00BT0000001WUWh"; 

             break;

     }

 

     // Change the whole window to point to this location

     parent.document.location.href = "/" + prefix + "?fcf=" + cView ;

}

</script>

</apex:page>

 

however, when I switch environments, the value i am assigning in the cView = ... is different in each environment.  Is there a way to capture this value dynamically in the environment the code is located?

 

Thanks 

Hi All,

 

I am trying to query 10000 records and using a for loop o fetch them all. I know we can get these records in a list but can we get them in a map?

 

When i try :

 

 

for(Map<Id,Account> aMap : new Map<Id,Account>([Select Id,Name from Account])){}

 

 I am getting this error: Loop must iterate over a collection type: MAP:Id,SOBJECT:Account
 
Please advise. 

 

  • October 19, 2009
  • Like
  • 0
I'm looking to make my search function pull up the first found result.  I've gotten it to work except that the link that is delivered has a bunch of extra characters I can't seem to get rid of:  https://na6.salesforce.com/(Account:%7BId=0018000000NbMUIAA3%7D).  I know I am missing something very simple here.  Can anyone point me in the right direction?
 
I can't figure out how to get just the ID from the getResult() function...
 
Page:
Code:
<apex:page id="salesPartner" controller="AccountController" tabStyle="Account" > 
 <apex:pageBlock title="Search Accounts">  
  <apex:form >   
   <apex:inputText id="searchBox" value="{!searchText}"/>   
   <apex:commandButton action="{!search2}" value="Search" id="searchBtn"/>   
   <apex:dataTable value="{!result}" var="acc" id="data" >    
    <apex:column >     
     <apex:facet name="header"><b>Name</b></apex:facet>      {!acc.id}    
    </apex:column>   
   </apex:dataTable> 
  </apex:form> 
 </apex:pageBlock>
</apex:page>

 
Controller
Code:
public class AccountController{

public String getSearchText() {

return null;

}

private List<Account> result = new List<Account>();

private String searchText;

public AccountController(){

}

public List<Account> getResult() {return result;}

public void setSearchText(String searchText)

{ this.searchText = searchText; }



public void search()
{
result = [select id from Account Where Name like :searchText LIMIT 1];}


public PageReference search2() {


    PageReference next = new PageReference('/'+getResult());
    next.setRedirect(true);
    return next;


  }




}