-
ChatterFeed
-
3Best Answers
-
0Likes Received
-
0Likes Given
-
35Questions
-
27Replies
inputFile keeps adding the file again when refreshing the page
Anyone know how to fix this? I tried nulling the attachment out in the controller but it doesnt help :(
Here is the inputfile and command button in the VF page.
<apex:pageBlockButtons location="top"> <apex:inputFile styleClass="btn" value="{!anAttachment.Body}" fileName="{!anAttachment.Name}"/> <apex:commandButton id="saveButton" value="{!$Label.Save_Attachment}" action="{!saveAttachment}"/> </apex:pageBlockButtons>
Here is the save method in the controller
// save attachment to service case public void saveAttachment(){ // create bridge object for additional functionality Attachment__c bridge = new Attachment__c(); bridge.External__c = false; bridge.Restricted__c = false; bridge.Service_Case__c = theCase.York_Case__c; insert bridge; // create attachment and add it to the bridge object anAttachment.parentId = bridge.id; insert anAttachment; anAttachment = null; anAttachment = new Attachment(); }
Here is the end result with multiple copies of the same file being attached after I clicked refresh twice.
- TheCustomCloud
- September 08, 2014
- Like
- 0
- Continue reading or reply
Updating User's Email addresses Without needing them to reply
We loaded users with their emails scrambled. Now we need to correct them. The problem is we do not want all our users to have to confirm the email change. The business reason is it would be a logistics nightmare to get all users to properly accept the email change and that it looks unprofessional.
Anyone know a way to bypass this Salesforce limitation?
- TheCustomCloud
- September 13, 2013
- Like
- 0
- Continue reading or reply
Inserting a Share record with an inactive user
I am inserting share records on a custom object fine through dataloader.
I am trying to insert a share record in a trigger and I get errors when the user is currently inactive.
This is going to be a huge problem for my project, anyone know how to get around this?
thank you!!
- TheCustomCloud
- September 11, 2013
- Like
- 0
- Continue reading or reply
Aligning a button beside a lookup input
Anyone have luck with aligning a button to be beside a lookup input?
The HTML that the lookups generate is causing me issues with everything I try.
- TheCustomCloud
- June 04, 2013
- Like
- 0
- Continue reading or reply
Compiler Error? Wrapper classes with Lists
I believe I may have found a compiler issue. Anyone else run into the following:
I have one wrapper class called anObject.
I have a second wrapper class that contains the fields for each anObject wrapper.
public class anObject{ public Boolean isMaster { get; set; } public Id sId { get; set; } public aField[] fields { get; set; } public anObject(Id i, aField[] fl, Boolean m){ fields = fl; isMaster = m; sId = i; } } public class aField{ public Boolean checked { get; set; } // this is the problem variable public String value { get; set; } public String apiName { get; set; } public aField(String v, String a){ this.checked = true; this.value = v; this.apiName = a; } }
I translate the sObject into my custom anObject and put them into a list.
public List<anObject> theObjects { get; set; }
The problem comes when I call the list in a VF page.
<apex:repeat value="{!theObjects}" var="a"> {!a.isMaster}<br/> <apex:repeat value="{!a.fields}" var="f"> <input type="radio" name="{!f.apiName}" value="{!f.checked}"/> {!f.value} <br/> </apex:repeat> </apex:repeat>
Everything works except for the Boolean variable "checked". It throws me the following error:
Error: /apex/SMLeadMerge: Cannot coerce from class core.apexpages.el.adapters.RuntimeTypeMetadataELAdapter to class java.lang.Boolean
Interesting additional note, if I do the exact same thing but instead of using a list I use a map then the boolean works fine.
- TheCustomCloud
- March 28, 2013
- Like
- 0
- Continue reading or reply
A Trigger Error
I've been staring at this code too long and I think something obvious isn't jumping out at me. I have a recursive trigger causing me to hit the maximum trigger depth but I can't think of how to fix it. If anyone can help I am posting the trigger in it's entirety and the error.
THANKS!
The scenario is a user updates a custom revenue object. This fires a trigger to update the record with the "Prior Year Revenue" and also update the next year's "Prior Year Revenue".
trigger RollUpPriorYear_AIAU on Revenue__c (before insert, before update, after update, after insert){ Set<String> pastKeys = new Set<String>(); Set<String> futureKeys = new Set<String>(); Map<String, Revenue__c> currentRevs = new Map<String, Revenue__c>(); Map<String, Revenue__c> futureRevs = new Map<String, Revenue__c>(); // key: Internal id corrected to last year, total prior year amount Map<String, Integer> pastTotalPriors = new Map<String, Integer>(); List<Revenue__c> priorRevs = new List<Revenue__c>(); // revenue to be updated List<Revenue__c> futurePlaceHolders = new List<Revenue__c>(); List<Revenue__c> futureRevsToBeUpdated = new List<Revenue__c>(); for(Revenue__c r: trigger.new){ // gather the internal ids // current currentRevs.put(makeKey(r, 0), r); // past pastKeys.add(makeKey(r, -1)); // future futureKeys.add(makeKey(r, 1)); } // retrieve all the past total forecasted for(Revenue__c re: [SELECT Account__c,Team__c,User__c,Total_Forecast__c,Quarter__c,Fiscal_Year__c,Platform__c FROM Revenue__c WHERE InternalId__c IN : pastKeys]){ String reKey = makeKey(re, 0); if(pastTotalPriors.containsKey(reKey)){ Integer aTotal = pastTotalPriors.get(reKey); aTotal += Integer.ValueOf(re.Total_Forecast__c); pastTotalPriors.put(reKey,aTotal); } else{ pastTotalPriors.put(reKey,Integer.ValueOf(re.Total_Forecast__c)); } priorRevs.add(re); } // create placeholders if no current rev exists to hold prior rev for(Revenue__c pr : trigger.new){ if(!futureRevs.containsKey(makeKey(pr,0))){ Revenue__c ph = new Revenue__c(); ph.Account__c = pr.Account__c; ph.Team__c = pr.Team__c; ph.Platform__c = pr.Platform__c; ph.Fiscal_Year__c = String.ValueOf(Integer.ValueOf(pr.Fiscal_Year__c.substring(0, 4)) + 1); ph.Fiscal_Year__c += '-'; ph.Fiscal_Year__c += String.ValueOf(Integer.ValueOf(pr.Fiscal_Year__c.substring(5, 7)) + 1); ph.Quarter__c = pr.Quarter__c; ph.User__c = pr.User__c; ph.Date__c = pr.Date__c; futurePlaceHolders.add(ph); } } if(trigger.isBefore){ // this deals with updating past revenue records for(Revenue__c r: trigger.new){ system.debug('*** updating the following pastTotalPriors: ' + pastTotalPriors); r.Final_Prior_Year__c = pastTotalPriors.get(makeKey(r,-1)); } } if(trigger.isAfter){ // this deals with updating future revenue records - so they also fire this trigger for(Revenue__c rev: [SELECT id FROM Revenue__c WHERE InternalId__c IN : futureKeys]){ futureRevsToBeUpdated.add(rev); futureRevs.put(makeKey(rev,0),rev); } update futureRevsToBeUpdated; // this creates placeholders for prior year revenue values sitting on the current year revenue records // THIS IS GIVING ME THE ERRORS insert futurePlaceHolders; } // utility method private String makeKey(Revenue__c rev, Integer yrAdj){ //Account__c + Team__c + TEXT( Platform__c ) + Fiscal_Year__c + TEXT( Quarter__c ) + User__c String theKey = String.ValueOf(rev.Account__c).substring(0, 15); theKey += String.ValueOf(rev.Team__c).substring(0, 15); theKey += rev.Platform__c; theKey += Integer.ValueOf(rev.Fiscal_Year__c.substring(0, 4)) + yrAdj; theKey += '-'; theKey += Integer.ValueOf(rev.Fiscal_Year__c.substring(5, 7)) + yrAdj; theKey += rev.Quarter__c; theKey += String.ValueOf(rev.User__c).substring(0, 15); System.debug(' *** theKey: ' + theKey); return theKey; } }
Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger RollUpPriorYear_AIAU caused an unexpected exception, contact your administrator: RollUpPriorYear_AIAU: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, RollUpPriorYear_AIAU: maximum trigger depth exceeded Revenue trigger event AfterInsert for [a06c0000000Y7Ds] Revenue trigger event AfterInsert for [a06c0000000Y7Dt] Revenue trigger event AfterInsert for [a06c0000000Y7Du] Revenue trigger event AfterInsert for [a06c0000000Y7Dv] Revenue trigger event AfterInsert for [a06c0000000Y7Dw] Revenue trigger event AfterInsert for [a06c0000000Y7Dx] Revenue trigger event AfterInsert for [a06c0000000Y7Dy] Revenue trigger event AfterInsert for [a06c0000000Y7Dz] Revenue trigger event AfterInsert for [a06c0000000Y7E0] Revenue trigger event AfterInsert for [a06c0000000Y7E1] Revenue trigger event AfterInsert for [a06c0000000Y7E2] Revenue trigger event AfterInsert for [a06c0000000Y7E3] Revenue trigger event AfterInsert for [a06c0000000Y7E4] Revenue trigger event AfterInsert for [a06c0000000Y7E5] Revenue trigger event AfterInsert for [a06c0000000Y7E6] Revenue trigger event AfterInsert for [a06c0000000Y7E7]: []: Trigger.RollUpPriorYear_AIAU: line 79, column 1
- TheCustomCloud
- August 31, 2012
- Like
- 0
- Continue reading or reply
Chatter Message to Whole Company
If I want to message a particular user I can just use @Mark Benioff. Is there a way to message a whole organization?
- TheCustomCloud
- July 16, 2012
- Like
- 0
- Continue reading or reply
Accounts Teams or Groups as Account Record Owner?
My client wants to organize their accounts into teams for reporting purpose. The accounts are wide open (everyone can see, create etc) so they do not teams for sharing. They do need to manage the teams a bit (ex. adding and removing team members done by managers).
What would you suggest I use?
Thank you.
- TheCustomCloud
- May 29, 2012
- Like
- 0
- Continue reading or reply
Why did they change custom settings?
Old code is now throwing me an error.
They seem to no longer support retrieving a value directly in a custom setting as seen below. Anyone else had this problem after Saturday's release?
ex:
Id publicCalendarId = HardcodedIDs__c.getall().values().id__c;
- TheCustomCloud
- October 04, 2011
- Like
- 0
- Continue reading or reply
Formula fields not sorting in related list
Using the following formula field:
HYPERLINK( '/' + Contact__c , Contact__r.LastName & ', ' & Contact__r.FirstName,'_parent')
When I sort the a related list by this formula field it does not correctly sort. For example, Instead of Apple, Bob, Cat it sorts seemingly randomly like this.. Bob, Apple, Cat.
Anyone else encounter this?
- TheCustomCloud
- August 16, 2011
- Like
- 0
- Continue reading or reply
How come Rendered != null doesnt seem to work with date fields?
I am displaying two dates (a from and to date) like this, 8/8/2011 to 8/10/2011. If no to date is entered then I do not want to display the " to " text.
I am using a simple outputText like below but it does not work:
<apex:outputText value=" to " rendered="{!Account.To__c != null}"/>
I used the same code but with a text field and had no problems:
<apex:outputText value=", {!Account.Name}" rendered="{!Account.Name != null}"/>
Any ideas?
- TheCustomCloud
- July 26, 2011
- Like
- 0
- Continue reading or reply
How to Dynamically pull Org Instance?
<apex:image url="https://c.cs7.content.force.com/servlet/servlet.ImageServer?id={!TD_Logo}&oid={!$Organization.Id}"/>
I remove all hardcoding but this one is giving me problems. Is there a command to pull the org instance?
- TheCustomCloud
- July 15, 2011
- Like
- 0
- Continue reading or reply
Simple Trigger
Why doesnt this trigger work? It doesnt throw any errors it just doesnt populate the title field. Can I not use a reference like Contact__r.Contacts_Title__c in a trigger?
trigger AddTitleToAttendee_BI on Attendee__c (Before Insert) {
for(Attendee__c a : trigger.new){
a.Title__c = a.Contact__r.Contacts_Title__c;
}
}
- TheCustomCloud
- July 13, 2011
- Like
- 0
- Continue reading or reply
Anyway to dynamically populate a picklist on a standard edit page?
Is there anyway to dynamically populate a picklist on a standard edit page? The standard edit page is so restricted and the project doesnt have the budget timeframe to rewrite the whole standard page fully in VF just to add one custom field to the edit page.
Thank you.
- TheCustomCloud
- June 21, 2011
- Like
- 0
- Continue reading or reply
jQuery on a standard layout button
Has anyone been able to get jQuery to work in a custom button for a standard page layout? All the examples I can find are on custom VF pages :(
Example code or a link to example code would be very much appreciated.
Thank you.
- TheCustomCloud
- June 16, 2011
- Like
- 0
- Continue reading or reply
Removing an sObject from a List when the sObject has a required field
It is a pretty simple scenario so I will summarize it. I cannot find anything to explain this behaviour so I am hoping some of you Apex geniuses can tell me that I am just making a simple mistake.
The users enters input into a field and then clicks a button. The button calls the controller to create another sObject and it is displayed on the VF page using a repeat. Another button is suppose to delete the last item from the list. The field the user is inputting is a master-detail and therefore is a required field but why do I get the "Error: You must enter a value" when I am trying to just remove the last sObject from the list?
Here is the code.
<apex:repeat value="{!requests}" var="r">
<apex:pageBlockSection columns="1">
<apex:inputField value="{!r.Contact__c}"/>
</apex:pageBlockSection>
</apex:repeat>
public List<Attendee__c> requests {get; set;}
public void addAttendee() {
attendeesList.add(new Attendee__c(Meeting__c = meet.Id));
}
public void removeAttendee() {
if(attendeesList.size() > 0){
attendeesList.remove(requests.size()-1);
}
}
Thank you!
- TheCustomCloud
- June 15, 2011
- Like
- 0
- Continue reading or reply
Any way to click a button to print all of a record's attachments?
Any way to click a button to print all of a record's attachments?
Thanks.
- TheCustomCloud
- June 07, 2011
- Like
- 0
- Continue reading or reply
For Loop question
I am cloning a record and then using a for loop to change say half of the fields on the cloned record. Then I am updating the object. I dont want to write a line for every field I am updating so I wrote a for loop. Unfortunately, its not working.
public void setupMergedAccount(){ mergedAccount = toAccountObj.Clone(); List<String> fieldsToChange = new List<String>{'Phone','BillingCity'}; for(String f : fieldsToChange){ mergedAccount.[f] = fromAccountObj.[f]; // USING THE VARIABLE HERE DOESNT WORK } }
Anyone?
- TheCustomCloud
- May 13, 2010
- Like
- 0
- Continue reading or reply
Searchable phone numbers
Salesforce saves phone numbers like this (905) 123 - 1234
Agents type numbers in the search like this 9051231234
This works for standard account and contact objects but not for my client's custom objects.
There are hundreds of thousands of records so the addition of a hidden field that changes the phone format to be more searchable is not a valid option at this point since this field would only be updated if each record was opened and resaved.
The Salesforce support does not have any solutions for me so I am reaching out to you guys in the dev community. Please help!
- TheCustomCloud
- October 20, 2009
- Like
- 0
- Continue reading or reply
String Theory - A simple challenge - What is the best way to reformat a string?
A little challenge,
I have say 100 strings in a list that are in this format: 3 to 5 numbers, a space, a name.
Example 1: "1234 Product Name One"
Example 2: "12345 Product Name Two"
How do I most efficiently remove the 1234 and the space so I just have Product Name?
Result 1: "Product Name One"
Result 2: "Product Name Two "
- TheCustomCloud
- October 13, 2009
- Like
- 0
- Continue reading or reply
inputFile keeps adding the file again when refreshing the page
Anyone know how to fix this? I tried nulling the attachment out in the controller but it doesnt help :(
Here is the inputfile and command button in the VF page.
<apex:pageBlockButtons location="top"> <apex:inputFile styleClass="btn" value="{!anAttachment.Body}" fileName="{!anAttachment.Name}"/> <apex:commandButton id="saveButton" value="{!$Label.Save_Attachment}" action="{!saveAttachment}"/> </apex:pageBlockButtons>
Here is the save method in the controller
// save attachment to service case public void saveAttachment(){ // create bridge object for additional functionality Attachment__c bridge = new Attachment__c(); bridge.External__c = false; bridge.Restricted__c = false; bridge.Service_Case__c = theCase.York_Case__c; insert bridge; // create attachment and add it to the bridge object anAttachment.parentId = bridge.id; insert anAttachment; anAttachment = null; anAttachment = new Attachment(); }
Here is the end result with multiple copies of the same file being attached after I clicked refresh twice.
- TheCustomCloud
- September 08, 2014
- Like
- 0
- Continue reading or reply
Inserting a Share record with an inactive user
I am inserting share records on a custom object fine through dataloader.
I am trying to insert a share record in a trigger and I get errors when the user is currently inactive.
This is going to be a huge problem for my project, anyone know how to get around this?
thank you!!
- TheCustomCloud
- September 11, 2013
- Like
- 0
- Continue reading or reply
Chatter Message to Whole Company
If I want to message a particular user I can just use @Mark Benioff. Is there a way to message a whole organization?
- TheCustomCloud
- July 16, 2012
- Like
- 0
- Continue reading or reply
How to Dynamically pull Org Instance?
<apex:image url="https://c.cs7.content.force.com/servlet/servlet.ImageServer?id={!TD_Logo}&oid={!$Organization.Id}"/>
I remove all hardcoding but this one is giving me problems. Is there a command to pull the org instance?
- TheCustomCloud
- July 15, 2011
- Like
- 0
- Continue reading or reply
Simple Trigger
Why doesnt this trigger work? It doesnt throw any errors it just doesnt populate the title field. Can I not use a reference like Contact__r.Contacts_Title__c in a trigger?
trigger AddTitleToAttendee_BI on Attendee__c (Before Insert) {
for(Attendee__c a : trigger.new){
a.Title__c = a.Contact__r.Contacts_Title__c;
}
}
- TheCustomCloud
- July 13, 2011
- Like
- 0
- Continue reading or reply
jQuery on a standard layout button
Has anyone been able to get jQuery to work in a custom button for a standard page layout? All the examples I can find are on custom VF pages :(
Example code or a link to example code would be very much appreciated.
Thank you.
- TheCustomCloud
- June 16, 2011
- Like
- 0
- Continue reading or reply
Removing an sObject from a List when the sObject has a required field
It is a pretty simple scenario so I will summarize it. I cannot find anything to explain this behaviour so I am hoping some of you Apex geniuses can tell me that I am just making a simple mistake.
The users enters input into a field and then clicks a button. The button calls the controller to create another sObject and it is displayed on the VF page using a repeat. Another button is suppose to delete the last item from the list. The field the user is inputting is a master-detail and therefore is a required field but why do I get the "Error: You must enter a value" when I am trying to just remove the last sObject from the list?
Here is the code.
<apex:repeat value="{!requests}" var="r">
<apex:pageBlockSection columns="1">
<apex:inputField value="{!r.Contact__c}"/>
</apex:pageBlockSection>
</apex:repeat>
public List<Attendee__c> requests {get; set;}
public void addAttendee() {
attendeesList.add(new Attendee__c(Meeting__c = meet.Id));
}
public void removeAttendee() {
if(attendeesList.size() > 0){
attendeesList.remove(requests.size()-1);
}
}
Thank you!
- TheCustomCloud
- June 15, 2011
- Like
- 0
- Continue reading or reply
Printing attachments
Hi,
Any ideas how I can print an Attachment given I know the url to it? The url to an Attachment is something like:
https://na3.salesforce.com/servlet/servlet.FileDownload?file=00PA0000002Dlc5
The Documents.Open() method takes in a url, and the above url doesn't work.
- asadim
- October 01, 2010
- Like
- 0
- Continue reading or reply
Log in to Sandbox via Flex
Hi all,
I have a standalone Flex app, e.g. not embedded in a VF page.
I can log into a non-sandbox org, but I cannot seem to log into a sandbox org.
I have tried changing the LoginRequest.server_url property to "https://test.salesforce.com" and "http://cs2.salesforce.com" with no luck, and I also tried changing xmlns:salesforce= to both of these values as well.
How is this meant to be attained?
Thanks!
- dkccraig
- November 15, 2009
- Like
- 0
- Continue reading or reply
Searchable phone numbers
Salesforce saves phone numbers like this (905) 123 - 1234
Agents type numbers in the search like this 9051231234
This works for standard account and contact objects but not for my client's custom objects.
There are hundreds of thousands of records so the addition of a hidden field that changes the phone format to be more searchable is not a valid option at this point since this field would only be updated if each record was opened and resaved.
The Salesforce support does not have any solutions for me so I am reaching out to you guys in the dev community. Please help!
- TheCustomCloud
- October 20, 2009
- Like
- 0
- Continue reading or reply
SSO - Can an Org have both, SAML and Delegated Authentication enabled?
SAML for Web Access and Delegated Authentication for API (Web Service - desktop client) access.
Thanks.
- jps
- October 14, 2009
- Like
- 0
- Continue reading or reply
Retrieving a user inputted field before save
I have a button that when the user clicks it it is suppose to grab from the fields the user just filled in and say return them an alert message. I am having trouble tho because the object is not saved so the values do no exist in the db yet.
How do I retrieve values from the user's currently open page before they save those values?
- TheCustomCloud
- October 05, 2009
- Like
- 0
- Continue reading or reply
Apex generation from WSDL failed for Fedex shipping WSDL
Error: Unsupported WSDL. Operation 'deleteShipment' has more than one output element.
- aksm
- June 26, 2008
- Like
- 0
- Continue reading or reply