-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
27Questions
-
45Replies
Missing Records
On Friday night, over 400 records were deleted from Salesforce at the exact same time. Using SOQLXplorer, I can see the records when querying for deleted records and they all were deleted at the same time by the same username after hours. However they did not delete anything.
This occurred on a production install for a client and their recycling bin has not been emptied but the records do not show up in the recycling bin.
Is there any way to revert these deleted records? Apex undelete() doesn't work because they are not visible in the recycling bin.
I've put in a case with Salesforce but have not yet received a reply. The records deleted in question are used for tracking individuals and their health insurance, which as of Friday, the system believes they do not have insurance so this is a very important issue.
I have used SOQLXplorer to export the records to a csv, so that if i can't undelete them, I can at least reimport them. This will however cause the records to have new salesforce IDs, which I want to avoid if possible.
Any suggestions or alternatives?
Thank you.
- Colin Loretz
- November 03, 2010
- Like
- 0
- Continue reading or reply
Issue sending variables to a controller
I'm using javascript to set a value in an apex:inputHidden field. That value is not passed on to the controller even though it is bound to a variable in the controller.
Javascript:
document.getElementById('timeEntry:j_id82:0:j_id86:j_id88:j_id89:selectedDay').value = currentDate;
Visualforce:
<apex:inputHidden id="selectedDay" value="{!selectedDay}" />
APEX:
public String selectedDay { get; set; }
I used javascript alert() statements to check the value of the apex:inputHidden field and the value of currentDate is being set properly. However, when using selectedDay in my controller, it is null. The inputField has the value but the controller is not aware of the field's contents.
Am I missing a step in here somewhere that allows this to happen?
Thanks.
- Colin Loretz
- March 17, 2009
- Like
- 0
- Continue reading or reply
Multiple Dependent SelectLists
I've implemented dependent selectLists in the interface below. The issue I'm having is that the lists only work when only 1 set exists. IE: 1 row for time entry in this case. When I add a row to the interface, it creates a new timeEntry instance and the selectLists in the bottom-most row work properly, but any above that do not work.
Is there a way to dynamically rerender a row in a table or some VF component? Ideally, each row or each outputPanel would have a different ID but I can't seem to set the rerender="" attribute dynamically.
<apex:actionRegion > <apex:selectList value="{!selectedProject}" size="1"> <apex:selectOptions value="{!ProjectOptions}" /> <apex:actionSupport event="onchange" rerender="mondayTask" status="loading" /> </apex:selectList> </apex:actionRegion> <apex:outputPanel id="mondayTask"> <apex:selectList value="{!taskId}" size="1" multiselect="false"> <apex:selectOptions value="{!taskItems}"/> </apex:selectList> </apex:outputPanel>
Here is the code for the VF section:
<apex:outputPanel id="mondayTable"> <apex:form > <table cellpadding = "0" cellspacing = "0"> <tr class = "header"> <td>Projects</td> <td>Tasks</td> <td>Description</td> <td width = "50">Time</td> </tr> <apex:repeat value="{!mondayTime}" var="t"> <tr> <td> <apex:actionRegion > <apex:selectList value="{!selectedProject}" size="1"> <apex:selectOptions value="{!ProjectOptions}" /> <apex:actionSupport event="onchange" rerender="mondayTask" status="loading" /> </apex:selectList> </apex:actionRegion> </td> <td> <apex:outputPanel id="mondayTask"> <apex:selectList value="{!taskId}" size="1" multiselect="false"> <apex:selectOptions value="{!taskItems}"/> </apex:selectList> </apex:outputPanel> </td> <td><apex:inputText value="{!t.description}" /></td> <td><apex:inputText value="{!t.hours}" /></td> </tr> </apex:repeat> <tr> <td> </td> <td> </td> <td> </td> <td><apex:commandButton action="{!addEntry}" value="add row" rerender="mondayTable" status="loading"/></td> <td><apex:commandButton action="{!saveMondayTime}" value="save" /></td> </tr> </table> </apex:form> </apex:outputPanel>
- Colin Loretz
- December 29, 2009
- Like
- 0
- Continue reading or reply
Parent-to-child relationship query
Object: Partner_Sent__c (object used for Many-to-Many)
Fields: CVB_Partner__c (Lookup to CVB_Partner__c object), Opportunity__c (Lookup to Opportunity object)
Object: Opportunity
Fields: Id, Name, Partner_Selected__c (Lookup to CVB_Partner__c)
Object: CVB_Partner__c
Fields: Id, Name
I want to do a query that gives me all CVB_Partner__c objects with the related Partner_Sent__c where the Partner_Selected__c is equal to the parent partner.
The code is much easier to understand:
Select Id, Name, (Select Id, Name, Opportunity__r.Partner_Selected__c from Partner_Sent__c where Opportunity__r.Partner_Selected__c = CVB_Partner__r.Id) from CVB_Partner__c
Unfortunately, I'm getting an error that states CVB_Partner__r.Id is not a valid field.
Am I doing something wrong or is this even possible?
Thanks!
- Colin Loretz
- December 03, 2008
- Like
- 0
- Continue reading or reply
How to write 'in' statement in dynamic apex
partnerResults = [Select Id, Name,
(Select Id, Name, Opportunity__c, Opportunity__r.StageName from Partners_Sent__r
where Opportunity__c != null AND Opportunity__r.CloseDate = THIS_YEAR)
from CVB_Partner__c where Id in :partnerList];
I'm having an issue writing this dynamically. I would like to do so and substitute THIS_YEAR with a date picklist. However, when I write it as a query String, I get an error from the colon (:) in front of partnerList.
How might I do an 'IN' statement within a dynamic apex query?
Thanks.
Colin
- Colin Loretz
- November 17, 2008
- Like
- 0
- Continue reading or reply
Tree/List with unknown levels
I'm trying to build a tree component and am able to go down two levels but I'm not sure how (or if) it would be possible to continue adding levels.
I'm already building the above tree with the following code:
public ProjectTask__c [] getTasks() { return [Select Id, Name, (Select Id, Name from Tasks__r) from ProjectTask__c where Project__c = :projectId]; }
<ul id ="tree" class="treeview"> <apex:repeat value="{!tasks}" var="t"> <li><span class = "file"><a href = "/{!t.id}">{!t.name}</a></span> <ul> <apex:repeat value="{!t.Tasks__r}" var="st"> <li><span class = "file"><a href = "/{!st.Id}" />{!st.name}</a></span></li> </apex:repeat> </ul> </li> </apex:repeat> </ul>
If I have any items below 1.1 or 2.1, such as 1.1.1, 1.1.1.1, etc. what would be the best way to build a list of this nature?
Thanks,
Colin
- Colin Loretz
- October 24, 2008
- Like
- 0
- Continue reading or reply
Product records - Price does not follow Org decimal places
When that value is entered, the record is saved as $0.00. Our organization is setup to handle up to 4 decimal places in values. It does not even attempt to round the value to $0.01, it just drops the last two decimals.
As a test, I created my own Product and Pricebook objects, entered the price of $0.0085 in a currency field and the value is maintained perfectly. I would prefer to keep everything in the standard Products object because of the existing functionality that exists for them.
Has anyone else encountered this or know a work around?
- Colin Loretz
- October 16, 2008
- Like
- 0
- Continue reading or reply
Map truncation
I have a map consisting of:
Map<ID, CVB_Contact__c> m = new Map<Id, CVB_Contact__c>();
Everything works fine when I run some logic and add records to the map, I can see in my log that the data is being added to the map. However, if I try to output the map to the log file I get:
{Id:{record}, Id:{record}, Id:{record}, Id:{record},
Id:{record}, Id:{record}, Id:{record}, Id:{record}, Id:{record}, Id:{record}, ...}
Basically, it's truncating it after 10 map records.
I'm passing this map to a php script using an external callout and need to fix the truncation. Is there a limit to the size of a map? If so, what other options do I have?
I have tried sending the map in both GET and POST but neither affect the truncation as I can see that it is truncated in the log, before I even send it.
Message Edited by Colin Loretz on 08-25-2008 09:38 AM
- Colin Loretz
- August 25, 2008
- Like
- 0
- Continue reading or reply
Visualforce button only works in development mode
Opportunity (standardObject)
||
Custom button (to reviewRFP)
||
reviewRFP (visualforce page - standard Opportunity controller with controller extension)
||
CommandButton (<apex:CommandButton value="Select Recipient Partners" onclick="window.parent.location.href='/apex/selectPartners?oppId={!Opportunity.Id}';" />)
||
selectPartners (visualforce page - custom controller)
This whole process works perfectly for me when I am in Development Mode.
The CommandButton (in green) will only refresh the page when Development Mode is turned off.
I've checked the profiles by going to Setup > Manager Users > Profiles. I checked each profile's Enabled Apex Class Access and Enabled Visualforce Page Access and have added all the relevant items.
I encountered this problem with CommandButtons not showing up on a visualforce page powered by a standard controller. The solution was to create an empty controller extension and voila! In this case, I'm already using a controller extension and nothing is happening. The last issue can be found here: http://community.salesforce.com/sforce/board/message?board.id=Visualforce&message.id=3416#M3416
Can anyone help me out with this one?
Edited:
Another note: I can navigate straight to the visualforce page and everything works fine. It appears as though the button is the only misfunctioning part of this puzzle.
Message Edited by Colin Loretz on 07-31-2008 03:48 PM
Message Edited by Colin Loretz on 07-31-2008 03:53 PM
- Colin Loretz
- July 31, 2008
- Like
- 0
- Continue reading or reply
Apex Rollup Summary Fields
I wrote the following code (replaced object/field names for simplicity) to handle rollup summary fields in Apex. It works pretty well but I frequently get errors when operating on bulk records or if no records exist (out of bounds, etc).
ParentObject__c :has_many Objects__c
Can anyone provide input as to whether or not I'm handling this type of task properly?
trigger rollupTrigger on Object__c (after insert, after update, after delete) { double totalSum = 0; Object__c myObjects = trigger.new; if(Trigger.isUpdate || Trigger.isInsert) { for(Object__c object : myObjects) //assume more than 1 record in trigger.new { for(ParentObject__c parent : [select Id, Name from ParentObject__c where Id = :object.Parent_Object__c]) //get the parent object { for(Object__c childObject : [select Id, Name, Number__c where Parent_Object__c = :parent.Id]) //get all the objects that belong to the parent object { totalSum += childObject.Number__c; //sum the field of choice } parent.Total__c = totalSum; //set the total in the parent update parent // update the parent } } } else if(Trigger.isDelete) { Object__c [] oldObjects = Trigger.old; for(Object__c oldObject :oldObjects) //assume deletion of more than 1 record { for (ParentObject__c parentObject : [select id, Name, Number__c, Total__c where Id = :oldObject.Parent_Object__c]) //get the parent object(s) { for (Object__c childObject : [select id, Name, Number__c from Object__c where Parent_Object__c = :parentObject.id]) //get the records that belong to the parent { totalSum += childObject.Number__c; //sum the fields after a record has been deleted } parentObject.Total__c = totalSum; //set new total in parent update parentObject; //update parent } } //end oldObject for loop } //end else if } //end trigger
Thanks!
- Colin Loretz
- July 23, 2008
- Like
- 0
- Continue reading or reply
Upgrading a package
When I install it, will it only update the items that have been changed or give it a new fresh install?
I'm trying not to lose my tab, search, and page layouts as well as a few custom buttons I added after the first installation.
- Colin Loretz
- July 23, 2008
- Like
- 0
- Continue reading or reply
Visualforce override is not going to correct URL
The url for the view is composed of the salesforce url with the object Id
https://ssl.salesforce.com/a0M000000004KAT
If I go to
https://ssl.salesforce.com/apex/viewProject?id=a0M000000004KAT
The commandButtons show up. I'm not sure what is going on because the override should "transparently" allow for this connection to be made.
I also overrode the edit functionality and the Save/Cancel buttons do show up. It only seems to be a problem on the view.
My suspicion is in permissions but the profiles have access to edit/delete/save/view on all the objects and I can do all of those actions with a standard view.
Can anyone offer some insight on this? Thanks!
- Colin Loretz
- July 16, 2008
- Like
- 0
- Continue reading or reply
Apex tests pass but fail on deploy
I'm having some issues deploying a large amount of Apex code to my production org. I have spent the last week writing Apex test methods and the average coverage is well above 75% for all the code. I run the Apex Code Test Runner in Eclipse and it mentions that most of my triggers at are 100%, a few just below.
I go to the project > Force.com > Deploy to Server
Once I enter the destination information, select the actions to act on, and hit "validate deployment", it returns saying that it has failed.
The reason for the failure being that the average coverage for my code is only 27%. I know this to be false so I'm not sure why the tests work (with 0 failures) when developing in Eclipse or even in the Sandbox UI but not when deploying to a production.
Do tests get run differently in a production instance?
Message Edited by Colin Loretz on 07-11-2008 01:21 AM
Message Edited by Colin Loretz on 07-11-2008 01:21 AM
- Colin Loretz
- July 11, 2008
- Like
- 0
- Continue reading or reply
Query string in Apex
string qstring = "select Id, Field from Object where x = 'y' or x = 'z' and z = 'x' or z = 'y'";
List<Object> objects = new List<Object>(qstring);
Is there a way to do this? I need to build the query string because, based on a multiselect field, there could be anywhere from 1 to 10 OR statements for each field
- Colin Loretz
- June 13, 2008
- Like
- 0
- Continue reading or reply
Querying Multiselect picklist fields
I found this documentation on querying multiselect fields.
When you do a query like:
MSP1__c includes ('AAA;BBB', 'CCC')
the query filters on values in the MSP1__c field that contains either of these values:
* AAA and BBB selected
* CCC selected.
So the ';' represents AND.
If we break it up:
MSP1__c includes ('AAA', 'BBB', 'CCC')
represents AAA or BBB or CCC.
Is there a way to query using OR instead?
I'm passing my variable, lets say CategoryOptions to a class. The code becomes
MSP1__c includes (CategoryOptions)
The problem with this is that it will only return values that match the selected Categories exactly. I need any records that has any single 1 of the options in the multiselect field.
My idea is to just parse the variable CategoryOptions and build a query, seperating all the values with commas.
MSP1__c includes (Cat1, Cat2, Cat3, etc).
Is that the best and/or only way to do this?
- Colin Loretz
- June 12, 2008
- Like
- 0
- Continue reading or reply
Unable to deploy Apex Triggers
I've been working with Apex triggers in a development environment but I'm unable to deploy them to a production environment. I have been able to deploy Apex classes with their respective testMethods but am unable to deploy the Triggers.
I created a trigger on an Opportunity and created a testMethod in an Apex class, however it does not appear as though the test is working.
I've even tried to deploy the LeadDupeTrigger from the Apex Cookbook - and the tests don't appear to be running. (Again the tests with just Apex Classes work fine).
The Code Coverage Results say:
myTriggerTester (Class) - 0 Lines not tested, 100% covered
However, the debug log (set to max verbosity) displays the following:
Debug Log: Cumulative profiling information: No profiling information for SOQL operations. No profiling information for SOSL operations. No profiling information for DML operations. No profiling information for method invocations.
I created a simple trigger to test deployment, it is below:
trigger populateDates on Opportunity (before insert, before update) { Opportunity [] opp = Trigger.new; for (Integer i = 0; i < opp.size(); i++) { opp[i].Arrival_Date__c = date.today(); } }
And the testMethod:
public class myTriggerTester { static testMethod void TEST_populateDates() { Account testAccount = new Account ( Name = 'Testing' ); insert testAccount; Opportunity firstOpp = new Opportunity ( Name = 'Test', Account = testAccount, CloseDate = date.today(), StageName = 'Strong Potential', Proposal_Deadline__c = date.today() ); System.assertEquals(null, firstOpp.Arrival_Date__c); insert firstOpp; System.assertEquals(date.today(), firstOpp.Arrival_Date__c); } }
- Colin Loretz
- June 04, 2008
- Like
- 0
- Continue reading or reply
Product Pricebooks - More than 2 decimals in the price
- Colin Loretz
- May 14, 2008
- Like
- 0
- Continue reading or reply
Updating a price based on lookup field
I have two objects:
AccountPriceBookEntry__c and TimeSheetEntry__c
- AccountPriceBookEntry__c has a Price__c field that stores the price of an Employee's rate for that particular account
- TimeSheetEntry__c has a Rate__c field that should store the price from the AccountPriceBookEntry__c
- TimeSheetEntry__c is where an employee fills out a time sheet and selects an AccountPriceBookEntry__c from a lookup field
- I need the Time Sheet Entry's Rate__c field to be updated based on the Price__c field in the other object
trigger updateRate on TimeSheetEntry__c (after insert, after update) { List<String> TimeRate = new List<String>(); for (Integer i = 0; i < Trigger.new.size(); i++) { TimeRate.add(Trigger.new[i].Account_Price_Book_Entry__c); } List<AccountPriceBookEntry__c> rateList = new List<AccountPriceBookEntry__c>([Select Price__c from AccountPriceBookEntry__c where Id in :TimeRate]); for (Integer i = 0; i < Trigger.new.size(); i++) { if (Trigger.new[i].Account_Price_Book_Entry__c != null) { Trigger.new[i].Rate__c = rateList[i].Price__c; } } }
Am I way off base here?
I get an exception error that says
Error:Apex trigger updateRate caused an unexpected exception, contact your administrator: updateRate: execution of AfterUpdate caused by: System.Exception: Record is read-only: Trigger.updateRate: line 16, column 28
Cheers!
- Colin Loretz
- March 19, 2008
- Like
- 0
- Continue reading or reply
Deploying Apex using Force IDE or 'ant deploy'
I've tried using both the Force.com IDE and Apache Ant/CMD line methods for deployment and I can't deploy to a live production environment.
When I run "ant deploy" with my connection info setup for a developer account, the build is successful. When I change the connection info to represent a live environment, I get the following error:
BUILD FAILED C:\Documents and Settings\cloretz\Desktop\salesforce_ant\sample\build.xml:12: Fa iled: testcase in class 'compileAndTest' method 't1' failure:System.DmlException: Inse rt failed. First exception on row 0; first error: INVALID_FIELD_FOR_INSERT_UPDAT E, Account: bad field names on insert/update call: Name: [Name] stack-trace: Class.compileAndTest.t1: line 7, column 9 Code coverage error on phoneSetter: Test coverage of selected Apex Trigger is 0% , at least 1% test coverage is required Code coverage error: Test coverage of selected Apex Class and Trigger is 25%, at least 75% test coverage is required
- Colin Loretz
- January 29, 2008
- Like
- 0
- Continue reading or reply
S-Control button to move Opportunity Amount to new a custom object
I have a button that is running javascript and passes the Opp Amount over to this custom object. However, it does not pass just the amount of 4,000.00, but USD 4,000.00. It will not accept the value with the alpha characters. Is there a way to pass just the numeric value?
00N00000006ysxb={!Opportunity.Amount}
- Colin Loretz
- January 23, 2008
- Like
- 0
- Continue reading or reply
Multiple Dependent SelectLists
I've implemented dependent selectLists in the interface below. The issue I'm having is that the lists only work when only 1 set exists. IE: 1 row for time entry in this case. When I add a row to the interface, it creates a new timeEntry instance and the selectLists in the bottom-most row work properly, but any above that do not work.
Is there a way to dynamically rerender a row in a table or some VF component? Ideally, each row or each outputPanel would have a different ID but I can't seem to set the rerender="" attribute dynamically.
<apex:actionRegion > <apex:selectList value="{!selectedProject}" size="1"> <apex:selectOptions value="{!ProjectOptions}" /> <apex:actionSupport event="onchange" rerender="mondayTask" status="loading" /> </apex:selectList> </apex:actionRegion> <apex:outputPanel id="mondayTask"> <apex:selectList value="{!taskId}" size="1" multiselect="false"> <apex:selectOptions value="{!taskItems}"/> </apex:selectList> </apex:outputPanel>
Here is the code for the VF section:
<apex:outputPanel id="mondayTable"> <apex:form > <table cellpadding = "0" cellspacing = "0"> <tr class = "header"> <td>Projects</td> <td>Tasks</td> <td>Description</td> <td width = "50">Time</td> </tr> <apex:repeat value="{!mondayTime}" var="t"> <tr> <td> <apex:actionRegion > <apex:selectList value="{!selectedProject}" size="1"> <apex:selectOptions value="{!ProjectOptions}" /> <apex:actionSupport event="onchange" rerender="mondayTask" status="loading" /> </apex:selectList> </apex:actionRegion> </td> <td> <apex:outputPanel id="mondayTask"> <apex:selectList value="{!taskId}" size="1" multiselect="false"> <apex:selectOptions value="{!taskItems}"/> </apex:selectList> </apex:outputPanel> </td> <td><apex:inputText value="{!t.description}" /></td> <td><apex:inputText value="{!t.hours}" /></td> </tr> </apex:repeat> <tr> <td> </td> <td> </td> <td> </td> <td><apex:commandButton action="{!addEntry}" value="add row" rerender="mondayTable" status="loading"/></td> <td><apex:commandButton action="{!saveMondayTime}" value="save" /></td> </tr> </table> </apex:form> </apex:outputPanel>
- Colin Loretz
- December 29, 2009
- Like
- 0
- Continue reading or reply
inputText not binding to my wrapper class
I received a new requirement to add a String field into the wrapper and to add an inputText field onto the VF page. So I added a new "public String problemDescription {get; set;}" property into the wrapper class. I then added an inputText field with a value attribute of that field, allowing the user to enter a value, process the records and use that input value in the Apex method.
For some reason, that field in the wrapper class is not picking up the value entered into the VF page. If I hardcode a value as a default in the wrapper class constructor, that value will appear in my VF page. However, if I overwrite that value in the page, the controller will not pick up on the new value. It only uses the initial value.
The strange thing is that I have an inputCheckbox on my page bound to the selected property of the wrapper class and the controller picks up the value set on the page. For some reason, it won't pickup my new value. Ideas?
I can post the code if my explanation doesn't make sense, but I thought I'd keep it as simple as possible and ask people to start with that example on the wiki and try to add a String to the wrapper class and get the controller to read the values submitted from the page.
- hemm
- December 19, 2008
- Like
- 0
- Continue reading or reply
Parent-to-child relationship query
Object: Partner_Sent__c (object used for Many-to-Many)
Fields: CVB_Partner__c (Lookup to CVB_Partner__c object), Opportunity__c (Lookup to Opportunity object)
Object: Opportunity
Fields: Id, Name, Partner_Selected__c (Lookup to CVB_Partner__c)
Object: CVB_Partner__c
Fields: Id, Name
I want to do a query that gives me all CVB_Partner__c objects with the related Partner_Sent__c where the Partner_Selected__c is equal to the parent partner.
The code is much easier to understand:
Select Id, Name, (Select Id, Name, Opportunity__r.Partner_Selected__c from Partner_Sent__c where Opportunity__r.Partner_Selected__c = CVB_Partner__r.Id) from CVB_Partner__c
Unfortunately, I'm getting an error that states CVB_Partner__r.Id is not a valid field.
Am I doing something wrong or is this even possible?
Thanks!
- Colin Loretz
- December 03, 2008
- Like
- 0
- Continue reading or reply
Apex Unit Tests
To view test coverage:
Eclipse -> Project- > src -> unpackaged -> classes -> Force.com -> run tests.
Under Failures and warnings and under general warnings it was showing 64% completed but 75 % test coverage is required.
Then I added one more test in a class as I am trying to reach for at least 85% test coverage but now when I right click to run tests I am seeing few failures and warnings but not seeing the the general warnings tab as before.
What does it mean? How can I see what percentage I have covered?
thanks,
kathyani
- kathyani
- November 21, 2008
- Like
- 0
- Continue reading or reply
How to write 'in' statement in dynamic apex
partnerResults = [Select Id, Name,
(Select Id, Name, Opportunity__c, Opportunity__r.StageName from Partners_Sent__r
where Opportunity__c != null AND Opportunity__r.CloseDate = THIS_YEAR)
from CVB_Partner__c where Id in :partnerList];
I'm having an issue writing this dynamically. I would like to do so and substitute THIS_YEAR with a date picklist. However, when I write it as a query String, I get an error from the colon (:) in front of partnerList.
How might I do an 'IN' statement within a dynamic apex query?
Thanks.
Colin
- Colin Loretz
- November 17, 2008
- Like
- 0
- Continue reading or reply
Tree/List with unknown levels
I'm trying to build a tree component and am able to go down two levels but I'm not sure how (or if) it would be possible to continue adding levels.
I'm already building the above tree with the following code:
public ProjectTask__c [] getTasks() { return [Select Id, Name, (Select Id, Name from Tasks__r) from ProjectTask__c where Project__c = :projectId]; }
<ul id ="tree" class="treeview"> <apex:repeat value="{!tasks}" var="t"> <li><span class = "file"><a href = "/{!t.id}">{!t.name}</a></span> <ul> <apex:repeat value="{!t.Tasks__r}" var="st"> <li><span class = "file"><a href = "/{!st.Id}" />{!st.name}</a></span></li> </apex:repeat> </ul> </li> </apex:repeat> </ul>
If I have any items below 1.1 or 2.1, such as 1.1.1, 1.1.1.1, etc. what would be the best way to build a list of this nature?
Thanks,
Colin
- Colin Loretz
- October 24, 2008
- Like
- 0
- Continue reading or reply
Product records - Price does not follow Org decimal places
When that value is entered, the record is saved as $0.00. Our organization is setup to handle up to 4 decimal places in values. It does not even attempt to round the value to $0.01, it just drops the last two decimals.
As a test, I created my own Product and Pricebook objects, entered the price of $0.0085 in a currency field and the value is maintained perfectly. I would prefer to keep everything in the standard Products object because of the existing functionality that exists for them.
Has anyone else encountered this or know a work around?
- Colin Loretz
- October 16, 2008
- Like
- 0
- Continue reading or reply
Record types in managed package in Winter '09
Symptoms:
1. In the dev org, doing a "Run all Tests" reports 0 failures.
2. If I take the managed package install link to another org and install, I get a bunch of unit test failures like this:
ut_calculations_modelvalidator.SimplestTestCase() | Apex Classes(01p800000008jBO) | System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, record type missing for: Support Program (ENT_2) ; |
---|
Here's the source code for this test:
static testMethod void SimplestTestCase() { ENT_2__Support_Program__c sp = new ENT_2__Support_Program__c( Name='TestSP', P1__c = 'xyz' ); insert sp; }
static testMethod void SimplestTestCase() { ENT_2__Support_Program__c sp = new ENT_2__Support_Program__c( Name='TestSP', P1__c = 'xyz' ); sp.RecordTypeId = '012300000009x0G'; insert sp; }
System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, Record Type ID: id value not valid for the users profile: 012300000009x0GAAQ: [RecordTypeId]
(ENT_2)
Any idea what I am doing wrong?
- MikeGoelzer
- October 16, 2008
- Like
- 0
- Continue reading or reply
create graphic diagram
- scriptagent
- October 10, 2008
- Like
- 0
- Continue reading or reply
How to create Ajax enabled Visualforce pages?
I am creating a customize version of new lead page using Visualforce and I want to add Ajax which allows users to edit the field by directly double clicking on it. They do not need to click on "edit" button to re-load the entire page in edit mode..
Please suggest how I should start implementing Ajax with visualforce pages?
Any help in solving this problem would be highly appreciated.
Thank You,
Vishal
- Vishal Dedaniya
- October 03, 2008
- Like
- 0
- Continue reading or reply
Map truncation
I have a map consisting of:
Map<ID, CVB_Contact__c> m = new Map<Id, CVB_Contact__c>();
Everything works fine when I run some logic and add records to the map, I can see in my log that the data is being added to the map. However, if I try to output the map to the log file I get:
{Id:{record}, Id:{record}, Id:{record}, Id:{record},
Id:{record}, Id:{record}, Id:{record}, Id:{record}, Id:{record}, Id:{record}, ...}
Basically, it's truncating it after 10 map records.
I'm passing this map to a php script using an external callout and need to fix the truncation. Is there a limit to the size of a map? If so, what other options do I have?
I have tried sending the map in both GET and POST but neither affect the truncation as I can see that it is truncated in the log, before I even send it.
Message Edited by Colin Loretz on 08-25-2008 09:38 AM
- Colin Loretz
- August 25, 2008
- Like
- 0
- Continue reading or reply
What day does a week start on?
- sissyphus
- August 20, 2008
- Like
- 0
- Continue reading or reply
Apex Rollup Summary Fields
I wrote the following code (replaced object/field names for simplicity) to handle rollup summary fields in Apex. It works pretty well but I frequently get errors when operating on bulk records or if no records exist (out of bounds, etc).
ParentObject__c :has_many Objects__c
Can anyone provide input as to whether or not I'm handling this type of task properly?
trigger rollupTrigger on Object__c (after insert, after update, after delete) { double totalSum = 0; Object__c myObjects = trigger.new; if(Trigger.isUpdate || Trigger.isInsert) { for(Object__c object : myObjects) //assume more than 1 record in trigger.new { for(ParentObject__c parent : [select Id, Name from ParentObject__c where Id = :object.Parent_Object__c]) //get the parent object { for(Object__c childObject : [select Id, Name, Number__c where Parent_Object__c = :parent.Id]) //get all the objects that belong to the parent object { totalSum += childObject.Number__c; //sum the field of choice } parent.Total__c = totalSum; //set the total in the parent update parent // update the parent } } } else if(Trigger.isDelete) { Object__c [] oldObjects = Trigger.old; for(Object__c oldObject :oldObjects) //assume deletion of more than 1 record { for (ParentObject__c parentObject : [select id, Name, Number__c, Total__c where Id = :oldObject.Parent_Object__c]) //get the parent object(s) { for (Object__c childObject : [select id, Name, Number__c from Object__c where Parent_Object__c = :parentObject.id]) //get the records that belong to the parent { totalSum += childObject.Number__c; //sum the fields after a record has been deleted } parentObject.Total__c = totalSum; //set new total in parent update parentObject; //update parent } } //end oldObject for loop } //end else if } //end trigger
Thanks!
- Colin Loretz
- July 23, 2008
- Like
- 0
- Continue reading or reply