• theitdeptrocks
  • NEWBIE
  • 50 Points
  • Member since 2009

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 59
    Questions
  • 86
    Replies

I am trying to move Custom objects, tabs and visual force pages form Develop Edition to Professional Edition using Force.com IDE embedded in eclipse.

 

The problem is that when i fully import the devleop edition in Eclipse (whn creating a new Force.com project, i chose to get all apex classes, components,...) and try to "Deploy to server" to my professional edition, it only displays the VisualForce pages which obvisouly returns an error since the custom objects did not yet load and it they are not listed (view image)..

 

This sounds like a dependency problem where i use the custom objects that i created in VisualForce pages.. can anyone plz detail how to fix this (i dperecate the use of unmanaged packages and the force.com migration tool seems to do the same thing as the force.com ide)

 

I would appreciate any advise

 

 

 

  • June 24, 2011
  • Like
  • 0

Hi all,

 

I am trying to create a matrix map that is referrenced to determine whether or not an apex:inputField should be rendered on a page or not.  The problem is that I am currently needed to create a new getter method for each inputField.

 

Ideally, I'd love to have one method that the field name is passed into, which then checks against my matrix, and returns true or false.

 

Here's a sample of what it looks like now:

 

Class:

public with sharing class dynLayout{
    public Map<String,boolean> Criteria_1 = new Map<String,boolean>{
        'Field_1__c' => true,
        'Field_2__c' => false,
        'Field_3__c' => true
    }
    public Map<String,boolean> Criteria_2 = new Map<String,boolean>{
        'Field_1__c' => false,
        'Field_2__c' => false,
        'Field_3__c' => true
    }
    public boolean visible(string a){
        if(Criteria_1.get(a) == true && Criteria_2.get(a) == true){
            return true;
        }
        else{
            return false;
        }
    }

//Here are the getter methods for each field    
    public boolean getField_1(){
        return visible('Field_1__c');
    }
    public boolean getField_2(){
        return visible('Field_2__c');
    }
    public boolean getField_3(){
        return visible('Field_3__c');
    }


}

 

 

VF:

<apex:inputField value="{!MyObject__c.Field_1__c}" rendered="{!Field_1}"/><br />
<apex:inputField value="{!MyObject__c.Field_2__c}" rendered="{!Field_2}"/><br />
<apex:inputField value="{!MyObject__c.Field_3__c}" rendered="{!Field_3}"/><br />

 

Now this works just fine, but I have about 100 fields to work with and would prefer not to creat 100 additional methods. 

 

Does anyone have any recommendations for a better approach?

 

Thanks in advance!

 

I have a standard page layout and within it, one section contains a VF page.  The VF page is fairly empty, except for a body onload javascript that creates a div and attempts to append it to the parent.

 

The section of the layout that contains the div is at the bottom of the page, but I'm trying to create the div so that it is fixed at the top of the page.

 

The div is created OK when you are just looking at the VF page alone, but trying it embedded within a layout results in that error message.

 

Does anyone have any ideas to fix that?

 

Thanks in advance!

 

<apex:page sidebar="false" showHeader="false" standardController="Opportunity">
<head>
<style type="text/css">
td.head{
    color: #4A4A56;
    font-weight:bold;
    text-align: right;
    padding-right: 10px;
    }
    
</style>
<script type="text/javascript" src="/soap/ajax/15.0/connection.js" > </script> 
<script type="text/javascript" src="/js/functions.js"></script> 
<script type="text/javascript">
function load()
{
try{
var newdiv = parent.document.createElement('div');
newdiv.setAttribute('id', "thepanel");
newdiv.style.width = "50px";
newdiv.style.height = "50px";
newdiv.style.position = "fixed"; 
newdiv.style.left = "220px";
newdiv.style.top = "0px";
newdiv.style.background = "#000000";
newdiv.style.border = "1px solid #000";
newdiv.style.zIndex = "9999";
newdiv.style.padding = "0px";
newdiv.innerHTML = "test"; 
parent.document.body.appendChild(newdiv);
}catch(error){
alert('error :'+error);
}
}
</script>
</head>
<html>
<body onload="load()">

</body>
</html>


</apex:page>

Hi all,

 

Within IE9, I have having a problem with the picklists within one of my VF pages.  The problem is affecting both standard <Select/> and <apex:selectList/> tags.

 

The fields appear, however they are not clickable - meaning they do not expand/drop down to display their options.  If you tab through the fields and land on one of the picklists, you can use the up and down arrow keys to scroll through the options.

 

Using compatibility mode, IE8, or FireFox remedies the issue.

 

<div align="left">
    <apex:outputPanel id="controls">
        Size:&nbsp;&nbsp;    
            <select id="resizevalue" onchange="resize();">
                <option value="100%">100%</option>
                <option value="75%">75%</option>
                <option value="50%">50%</option>
                <option value="25%">25%</option>
                <option value="10%">10%</option>
            </select>
        <br />
        Form:  &nbsp;
            <apex:selectList id="form" value="{!form}"
                size="1" required="true">
                <apex:selectOptions value="{!forms}"/>
                <apex:actionSupport event="onchange" reRender="results" action="{!thelist}" oncomplete="preload();"  />   
            </apex:selectList>          
    </apex:outputPanel>
</div>

 Has anyone else experienced this or have a fix for it?

 

Thanks!

Hi,

 

Would it be possible to retrieve the criteria that triggers a workflow rule from within an Apex Class?  I'm wanting to display a string similar to what you see on the WF pages on a VF page:

 

(Plan Process: Plan Stage Name equals Implementation) and (Plan Process: 1st Payroll Upload Date not equal to null)

 




 

 

Hi all,

 

I'm using the following case statement to within a VF page to adjust some language.  Within one of the options is an apostrophe and I'm having difficulty escaping it.

 

Here's what I have:

{!case(MyOBJ__c.MyField__c,
'Any time',' at any time.',
'Based on Employer policy',' based on your employer\'s policy.',
'MERGE ERROR')}

 Doing this results in "based on your employer\'s policy" being displayed on the page.

 

Using \\'s results in a nasty looking Error: EL Expression Unbalanced: ...

 

And for grins, using \\\'s results in "based on your employer\\'s policy"

Hi all,


I was wondering if anyone could help me out with this error message.  The ultimate end goal is a getter method that could be passed a field's API name, check against two maps to determine if it should be rendered or not.

 

I'm currently caught up with this:  Error: Unknown property 'Photo__cStandardController.render'

 

public with sharing class test3 {
    public map<string,integer> st = new map<string,integer>();
    public map<string,integer> rt = new map<string,integer>();
   
    private final Photo__c p;
    public boolean getrender(string a){
    
        integer x;
        integer y;
        
             x = rt.get(a);
             y = st.get(a);
             if(x*y==0){
                 return false;
             }
             else{
                 return true;
             }
        

    } 

    public test3(ApexPages.StandardController controller) {
        this.p = (Photo__c)controller.getRecord();
        st = new map<string,integer>();
        rt = new map<string,integer>();
        if(p.Pose__c == 'Service Type 1'){
            this.st.put('Collection__c',1);
            this.st.put('Location__c',0);
        }
        if(p.Collection__c == 'Record Type 1'){
            this.rt.put('Collection__c',1);
            this.rt.put('Location__c',0);
        }
    }
}


<apex:inputField value="{!Photo__c.Collection__c}" rendered="{!render['Collection__c']}" />

I would greatly appreciate any help you could provide with this.  Thanks in advance!

Hey all,

 

Would it be possible to do something like this:

    public map<string,integer> field1 = new map<string,integer>();
    public map<string,integer> field2 = new map<string,integer>();

    public test3(ApexPages.StandardController controller) {
        this.field1.put('a',1);
        this.field2.put('b',2);
    }
    
    public integer getx(string x){
        return field2.get(x);
    }

 I'm just looking to be able to have something on the VF side like {!x[a]} to return 1.  Possible?

 

Thanks!

Hey all,

 

I'm still looking for a way to develop a vf layout that looks at two parent record fields to determine the visibility of fields on this layout.

 

What I'm stuck on is:

<apex:outputtext value="{!Plan_Process__c.Received_Plan_Document_Fee__c}" rendered="{!showme}">
    <apex:param assignTo="{!currentfield}" value="Received_Plan_Document_Fee__c"/>
</apex:outputtext>

currentfield is never being set and consequently is null. 

What I'd like is for {!showme} to reference the currentfield variable and determine if that field should be displayed:

private String currentfield;
public String getcurrentfield() { 
return currentfield; }
public void setcurrentfield(String a) {
currentfield = a; 


public boolean getshowme(){
if(req_rt.contains(currentfield) && req_st.contains(currentfield){
return true;
}
else{
return false;
}
}

 req_rt and req_st are two sets that may contain the fields API name.  If they both do, then the field should be displayed and if not, it shouldn't be.

 

Further background:  The two parent fields are recordtypeid and a picklist called "Service Type."  The sets will be setup as follows (example is abbreviated):

if(rt=='0126000000055SkAAI'){
req_rt.add('Received_Plan_Document_Fee__c');
	req_rt.add('Received_Conversion_Fee__c');
}
		
if(st=='Fully-Bundled - Conversion'){
	req_st.add('Received_Conversion_Fee__c');
}
if(st=='Participant-level Recordkeeping - Startup'){
req_st.add('Received_Plan_Document_Fee__c');
}	

 

Can anyone help me out?

Hi all,


I'm working on simplifying a page layout for our Sales and New Business teams.  The page has about 50 total fields on it. The owner wants it so that only the relevent fields are displayed and ultimately there are no blanks.

 

The fields that are relevent depend on the Opportunity's record type and a field named "Service Type."  Both of these have about 12 options (12 RTs and 12 STs).

 

The page itself has the fields split up into three different sections, the first two include the required fields and the third are the optional fields.  When all of the required fields are filled in, he wants a custom button to appear at the top of the page.

 

My thinking so far was to have a "render={!...}" formula for each of these fields to show/hide as applicable.  However, this seems messy and leads to an even bigger mess for determining when/how that custom button will appear at the top of the page.

 

Any ideas?


Thanks in advance!

Hi all,

 

Is there a URL trick that will prevent the VF dev editor from appearing on VF pages? 

 

I'm working with a limited height frame with a VF page in an iframe.  Due to the short height, I can't click the editor's minimize button to view the page's content within the frame.

 

Thanks!

Hi all,


I need to develop a Visualforce page with three sections to it and I'm not sure the best way to work with three page "sections."

 

--------------------
|              |   |
|              |   |
|       1      | 2 |
|              |   |
|              |   |
--------------------
|                  |
|        3         |
--------------------

Section 1 will be the main body, where there will be fields to populate

Section 2 will be a reminders section - fields that are missing or marked as a "need to be completed later" type field

Section 3 will be a help section - basically the procedure for that step of the process

 

Within Section 1, which will have "Previous" and "Next" buttons, changes to that page as well as page advancements may need to update sections 2 and 3.

 

I've thought about a parent page, with an HTML table laid out with the above using <apex:include, but wanted to get some feedback.

 

I'm not sure what the best way to do this is.  Any suggestions?  

 

Thanks in advance!

Hi all,

 

I'm working on a project where I am sending a handful of messages, using an email template, from a VF page.  Each message is for a different client and because of the template, each message is customized for that client.  The VF portion of the project is a series of pages, very similar to the "Mass Email Contacts" wizard, with the exception of the select your template page.

 

I basically have a list<messaging.singleemailmessage> named "mailbag" that each individual message is being added to and at the end of the process, this entire list is being sent with a Messaging.SendEmailResult [] r = Messaging.sendEmail(mailbag);

 

Ideally, what I would like to do is capture the individual IsSuccess() of each message and display a new VF page, with a list of all of the emails and their captured successes.

 

list<Plan_Process__c> PlansForEmail = [my soql statement]; 
List<messaging.singleemailmessage> mailbag= new List<messaging.singleemailmessage>();  
    for(Plan_Process__c pp :PlansForEmail){  
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        ... all of my mail.parameters
        mailbag.add(mail);
    } 
    Messaging.SendEmailResult [] r = Messaging.sendEmail(mailbag);
    for(Messaging.SendEmailResult rr:r){
        System.debug('Email result ' + rr.IsSuccess());
    } 

 So at this point, I'm seeing all of my IsSuccess() messagse, but by having all of the messages in a list, I've lost who they are for.  If I have 10 total messages in the mailbag and one fails, I don't have a way to match the failure to a message...do I?

 

I understand it is probably a better practice to send all of these messages at once, but I can see that if I send the message after each is created, scrapping the list idea, I could then create a message to success map to be used for the VF page.

 

Is there any way to retain the list idea and capture each messages' success or does it really not matter if I'm sending these messages individually as opposed to all at once.

 

Also, if I do send them individually and a failure is experienced, will the code stop in its tracks, preventing all of the remaining messages from their attempts at being sent?

 

Thanks in advance!

 

 

SObject row was retrieved via SOQL without querying the requested field: Plan_Process__c.Advisor_Meeting_Call__c

 

I am receiving the above error message within a VF email template where the relatedTo is set to "Plan_Process__c." 

 

Usually when I see this error message, I've forgotten to include a field in a SOQL statement, but this is a little bit different as it is just an email template, no Apex and no SOQL.

 

Has anyone seen this and what can I do to resolve it?

 

Thanks in advance!

Hi all,

 

I have a summary report with three custom formulas.  Is it possible to limit the results to the top 10 of one of these formula fields?

 

My ultimate goal is to sort the report by one of the formula fields in descending order, but I understand that this is currently a limitation.  The recommended solution was to create a dashboard, but in doing so, I'm getting all 1,000+ results.  The resulting chart is humorus to look at, as it tries to squeeze all 1,000+ into about 3 inches of space.

 

Anyone have a recommendation on how to tackle this?

Hi all,

 

I'm working on a simple proof of concept project to help me understand web services better.

 

On the Salesforce Site side, I have the following web service:

 

global class helloWorld  
{  
    WebService public static String GetMessage()  
    {  
        return 'Hello world';  
    }  
}

The corresponding site is http://mydomain.sandboxname.cs1.force.com/webservice.

The site's Active Site Home Page is set to a nearly blank page called test and I have enabled the above class within the site's Public Access Settings

 

On the VisualForce page side that I'm trying to make the call from, I have the following:

 

public string getContent(){
	Http h = new http();
	HttpRequest req = new HttpRequest();
//req.setEndpoint('http://mydomain.sandboxname.cs1.force.com/services/Soap/class/helloWorld');
	req.setEndpoint('http://mydomain.sandboxname.cs1.force.com/webservice');
	req.setMethod('POST');
	req.setHeader('Content-Type', 'text/xml;charset=utf-8'); 
	req.setHeader('Content-Length', '18'); 
	req.setHeader('soapAction', 'https://cs1-api.salesforce.com/services/Soap/class/helloWorld');
	HttpResponse res = h.send(req);
		system.debug('Body was:  '+ res);
		system.debug('String was:' + res.getBody());
		return res.getBody();
	}

This is the portion I'm not sure of.  Really just winging it.  As it stands, I'm currently receiving this error:

System.CalloutException:  Read timed out

 

I'm not sure what to put as my endpoint, nor am I sure about the header information.  Previously, without the Content-Length, it complained.  

 

Within the WSDL for the class, I see "http://soap.sforce.com/schemas/class/helloWorld" and "https://cs1-api.salesforce.com/services/Soap/class/helloWorld" but not sure if those come into play.

 

I've successfuly called out to an externally hosted web service and had a much more complex request body, but was able to put it together using another example on the web.  

 

Can any of you school me on what I'm doing wrong or point me in the direction of  good example?

 

Thanks!

 

 

 

Hi all,

 

I have a scenario where I have about 50 users on a single Exchange 2003 server.  All of the users use Salesforce and we have been scrappign along with the provided SF Outlook integration.

 

Rather than upgrade our Exchange environment (hardware, software, licensing, pain, time, etc), we've began exploring hosted mail options like Google's Business email. 

 

Whichever service is used, integration is our SF environment (Unlimited Ed.) is essential.

 

Has anyone else made a plunge like this? 

 

I'll probably install VCS Smart Email for Enterprise & Unlimited Edition in a sandbox today, but I was just curious if any other members of the community have done anythign similar.

 

http://appexchange.salesforce.com/listingDetail?listingId=a0N300000016ciJEAQ

 

Thanks in advance!

 

In some areas of our site, we’re being killed by a delay that comes from querying Salesforce.  Does anyone have any recommendations, tricks, or advice on how to reduce that delay?

 

1)  When querying data directly from Salesforce, particularly when doing a JOIN, how can you be certain you’re using an “indexed” field?

2)  Are certain fields automatically indexed?

3)  Can you create indexes?

 

Hi all,

 

Off of our Opportunity object, we have a related object named "Distributions."  I am building a trigger so that as each Distribution record reaches a certain stage, it can be added to a count on the related Plan object.  I have it to the point where if manually triggered, the count increases correctly.  Originally I was having issues with bulk updates, but have that most of the way worked out except for this issue.

 

In my test file, I have 299 Distribution records for the same Opportunity.  Prior to updating them, that Opportunity's count is set to 0.  Upon uploading the update through data loader, I would expect my final count to be 299.  However, it is returning 595.

 

It looks like when it grabs the existing Diagnostic Count from the Opportunity, it isn't seeing 0, but is seeing 398.0.

 

Here is the first few records' output from the debug log:

15:54:00.465|USER_DEBUG|[33]|DEBUG|Was an update!!!
15:54:00.465|METHOD_EXIT|[33]|System.debug(ANY)
15:54:00.465|METHOD_ENTRY|[35]|MAP.get(ANY)
15:54:00.466|METHOD_EXIT|[35]|MAP.get(ANY)
15:54:00.466|METHOD_ENTRY|[44]|System.debug(ANY)
15:54:00.466|USER_DEBUG|[44]|DEBUG|Met the criteria!!!
15:54:00.466|METHOD_EXIT|[44]|System.debug(ANY)
15:54:00.466|METHOD_ENTRY|[46]|System.debug(ANY)
15:54:00.466|USER_DEBUG|[46]|DEBUG|The current plan id is:  0066000000FO4sDAAT
15:54:00.466|METHOD_EXIT|[46]|System.debug(ANY)
15:54:00.466|METHOD_ENTRY|[50]|MAP.containsKey(ANY)
15:54:00.466|METHOD_EXIT|[50]|MAP.containsKey(ANY)
15:54:00.467|METHOD_ENTRY|[56]|MAP.containsKey(ANY)
15:54:00.467|METHOD_EXIT|[56]|MAP.containsKey(ANY)
15:54:00.467|METHOD_ENTRY|[57]|System.debug(ANY)
15:54:00.467|USER_DEBUG|[57]|DEBUG|Key was not found and the Plans QDC is:  398.0
15:54:00.467|METHOD_EXIT|[57]|System.debug(ANY)
15:54:00.467|METHOD_ENTRY|[59]|System.debug(ANY)
15:54:00.467|USER_DEBUG|[59]|DEBUG|Before the if/else, the current count is:  398.0
15:54:00.467|METHOD_EXIT|[59]|System.debug(ANY)
15:54:00.467|METHOD_ENTRY|[69]|MAP.put(ANY, ANY)
15:54:00.467|METHOD_EXIT|[69]|MAP.put(ANY, ANY)
15:54:00.467|METHOD_ENTRY|[70]|System.debug(ANY)
15:54:00.467|USER_DEBUG|[70]|DEBUG|Went the route of plan count not 0 or null and was 398.0
15:54:00.467|METHOD_EXIT|[70]|System.debug(ANY)
15:54:00.467|METHOD_ENTRY|[71]|System.debug(ANY)
15:54:00.468|METHOD_ENTRY|[71]|MAP.get(ANY)
15:54:00.468|METHOD_EXIT|[71]|MAP.get(ANY)
15:54:00.468|USER_DEBUG|[71]|DEBUG|399.0
15:54:00.468|METHOD_EXIT|[71]|System.debug(ANY)
15:54:00.468|METHOD_ENTRY|[35]|MAP.get(ANY)
15:54:00.468|METHOD_EXIT|[35]|MAP.get(ANY)
15:54:00.468|METHOD_ENTRY|[44]|System.debug(ANY)
15:54:00.468|USER_DEBUG|[44]|DEBUG|Met the criteria!!!
15:54:00.468|METHOD_EXIT|[44]|System.debug(ANY)
15:54:00.468|METHOD_ENTRY|[46]|System.debug(ANY)
15:54:00.469|USER_DEBUG|[46]|DEBUG|The current plan id is:  0066000000FO4sDAAT
15:54:00.469|METHOD_EXIT|[46]|System.debug(ANY)
15:54:00.469|METHOD_ENTRY|[50]|MAP.containsKey(ANY)
15:54:00.469|METHOD_EXIT|[50]|MAP.containsKey(ANY)
15:54:00.469|METHOD_ENTRY|[52]|System.debug(ANY)
15:54:00.469|USER_DEBUG|[52]|DEBUG|Key was already found
15:54:00.469|METHOD_EXIT|[52]|System.debug(ANY)
15:54:00.469|METHOD_ENTRY|[53]|MAP.put(ANY, ANY)
15:54:00.469|METHOD_ENTRY|[53]|MAP.get(ANY)
15:54:00.469|METHOD_EXIT|[53]|MAP.get(ANY)
15:54:00.469|METHOD_EXIT|[53]|MAP.put(ANY, ANY)
15:54:00.469|METHOD_ENTRY|[54]|System.debug(ANY)
15:54:00.469|METHOD_ENTRY|[54]|MAP.get(ANY)
15:54:00.469|METHOD_EXIT|[54]|MAP.get(ANY)
15:54:00.469|USER_DEBUG|[54]|DEBUG|Current count at:  400.0
15:54:00.469|METHOD_EXIT|[54]|System.debug(ANY)
15:54:00.469|METHOD_ENTRY|[35]|MAP.get(ANY)
15:54:00.470|METHOD_EXIT|[35]|MAP.get(ANY)
15:54:00.470|METHOD_ENTRY|[44]|System.debug(ANY)
15:54:00.470|USER_DEBUG|[44]|DEBUG|Met the criteria!!!
15:54:00.470|METHOD_EXIT|[44]|System.debug(ANY)
15:54:00.470|METHOD_ENTRY|[46]|System.debug(ANY)
15:54:00.470|USER_DEBUG|[46]|DEBUG|The current plan id is:  0066000000FO4sDAAT
15:54:00.470|METHOD_EXIT|[46]|System.debug(ANY)
15:54:00.470|METHOD_ENTRY|[50]|MAP.containsKey(ANY)
15:54:00.470|METHOD_EXIT|[50]|MAP.containsKey(ANY)
15:54:00.470|METHOD_ENTRY|[52]|System.debug(ANY)
15:54:00.470|USER_DEBUG|[52]|DEBUG|Key was already found
15:54:00.470|METHOD_EXIT|[52]|System.debug(ANY)
15:54:00.470|METHOD_ENTRY|[53]|MAP.put(ANY, ANY)
15:54:00.470|METHOD_ENTRY|[53]|MAP.get(ANY)
15:54:00.471|METHOD_EXIT|[53]|MAP.get(ANY)
15:54:00.471|METHOD_EXIT|[53]|MAP.put(ANY, ANY)
15:54:00.471|METHOD_ENTRY|[54]|System.debug(ANY)
15:54:00.471|METHOD_ENTRY|[54]|MAP.get(ANY)
15:54:00.471|METHOD_EXIT|[54]|MAP.get(ANY)
15:54:00.471|USER_DEBUG|[54]|DEBUG|Current count at:  401.0
...
This continues to 497.0.  The final count on the field is 595?

 Here is the code:

...
map<string,decimal> OppIDsMap = new map<string, decimal>();
if(trigger.isUpdate){
    system.debug('Was an update!!!');
    for(Distribution_Tracking__c d:trigger.new){
        Distribution_Tracking__c beforeUpdate = System.Trigger.oldMap.get(d.Id);
            if(beforeUpdate.Status__c != 'Check Requested' && 
	       d.Status__c == 'Check Requested' && 
	       d.Do_Not_Bill__c == false && 
	       d.Count_on_Invoice__c == false &&
	       (
                    d.Distribution_Check_Type__c == 'Beneficiary/Deceased' || 
                    d.Distribution_Check_Type__c == 'Hardship' || 
		 d.Distribution_Check_Type__c == 'Loan' || 
		 d.Distribution_Check_Type__c == 'Termination')){
		    system.debug('Met the criteria!!!');
		    string currentplanid = d.Plan__c;
		    system.debug('The current plan id is:  ' + d.Plan__c);
			   		
                    if(OppIDsMap.containsKey(d.Plan__c)==true){
                    system.debug('Key was already found');
                    OppIDsMap.put(d.Plan__c,OppIDsMap.get(d.Plan__c) +1);
                    system.debug('Current count at:  ' + OppIdsMap.get(d.Plan__c));
                    }
                    
                    else if(OppIDsMap.containsKey(d.Plan__c) != true){
                    system.debug('Key was not found and the Plans QDC is:  ' +
                     d.Plan_s_Current_Quarterly_Dist_Count__c);
		decimal currentcount = d.Plan_s_Current_Quarterly_Dist_Count__c;
		system.debug('Before the if/else, the current count is:  ' + currentcount);
		if(currentcount == 0 || currentcount == null){
		    system.debug(d.Plan__c);
		    system.debug(d.Plan_s_Current_Quarterly_Dist_Count__c);
		    OppIDsMap.put(d.Plan__c,1);
		    system.debug('Went the route of plan count = 0 or null:' + currentcount);
		}
			   			
                    else if(currentcount >= 1){
                        OppIDsMap.put(d.Plan__c,currentcount+1);
                        system.debug('Went the route of plan count not 0 or null and was ' + currentcount);
                        system.debug(OppIDsMap.get(d.Plan__c));
                    }
			   			
                    d.Count_on_Invoice__c = true;
}
}
}
		
		Set <String> planSet = new Set<String>();
		planSet = OppIDsMap.keySet();
		list<Opportunity> theAffectedPlans = new list<Opportunity>([Select Id, Quarterly_Distribution_Count__c From Opportunity where ID in :planSet]);
		
		for(Opportunity o:theAffectedPlans){	
			o.Quarterly_Distribution_Count__c = OppIDsMap.get(o.ID);
		}
		update theAffectedPlans;
		system.debug('Plans updated!!!');
}

 

Does anyone see where I went wrong? 

 

 I created a formula field, d.Plan_s_Current_Quarterly_Dist_Count__c, because d.Plan__r.Quarterly_Distribution_Count__c was returning null.

The formula is 'Plan__r.Quarterly_Distribution_Count__c' and is set to a number with 2 decimal places.  The Opportunity's Quarterly_Distribution_Count__c field is a number with 0 decimal places.  Could this be it?  I'll change the formula to 0 decimal places and see what happens in the mean time, but does anyone have any ideas of where I went wrong?


Thanks!

Hi all,


I am having a problem with rich text fields on my VF page.  If the rich text field has a value in it, I want to display the language, "below." and if it does not contain a value I want to display the language, "in the attached spreadsheet."

 

 

{!IF(not(Administrative_Task__c.Compensation_Term_Date_Data_Rich__c=""), 'below.','in the attached spreadsheet.')} 

 When I leave the field blank and refresh the VF page, the "below" language is used.  When I fill in the field, save the record, and refresh the VF page, the "below" language is still used correctly.

 

Then I tried the NOT(ISNULL( approach:

 

{!IF(NOT(ISBLANK(Administrative_Task__c.Compensation_Term_Date_Data_Rich__c)), 'below.','in the attached spreadsheet.')}  

 

 

With the field blank, it used the "below" language.  With the field populated, it still displayed "below," but it should have in this scenario.

 

Lastly I tried the NOT(ISNULL( approach:

 

{!IF(NOT(ISNULL(Administrative_Task__c.Compensation_Term_Date_Data_Rich__c)), 'below.','in the attached spreadsheet.')}  

 

 

Same results as above.

 

 

Does anyone have a way to solve this?

 

Thanks in advance!

Hi all,

Off of our Opportunity object, we have a related object named "Distributions."  I am building a trigger so that as each Distribution record reaches a certain stage, it can be added to a count on the related Plan object.

 

The trigger seems to be working fine for Distribution records that are manually being updated one at a time.  When testing it out with a .csv of 299 records, I am noticing that my count is only going up by 3, not the expected 299. 

 

I need to ensure that when we perform a mass update on our Distribution records, all that meet the criteria increase their Opportunity's count by one.  Note, it is entirely possible that within one mass update there will be several Distribution records for one Opportunity.

 

 

...
list<Id> OppIDs= new list<Id>();

if(trigger.isUpdate){
		system.debug('Was an update!!!');
		for(Distribution_Tracking__c d:trigger.new){
			Distribution_Tracking__c beforeUpdate = System.Trigger.oldMap.get(d.Id);
			
			if(beforeUpdate.Status__c != 'Check Requested' && d.Status__c == 'Check Requested' && 
			   d.Do_Not_Bill__c == false && d.Count_on_Invoice__c == false &&
			   (
			   d.Distribution_Check_Type__c == 'Beneficiary/Deceased' || 
			   d.Distribution_Check_Type__c == 'Hardship' || 
			   d.Distribution_Check_Type__c == 'Loan' || 
			   d.Distribution_Check_Type__c == 'Termination')){
			   		system.debug('Met the criteria!!!');
			   		OppIDs.add(d.Plan__c);
			   		
			   		d.Count_on_Invoice__c = true;
			}

list<Opportunity> theAffectedPlans = new list<Opportunity>([Select Id, Quarterly_Distribution_Count__c From Opportunity where ID in :OppIDs]);

for(Opportunity o:theAffectedPlans){
			decimal currentcount = o.Quarterly_Distribution_Count__c;
			system.debug('Current Count is:  ' + currentcount);
			system.debug('Quarterly_Distribution_Count__c is:  ' + o.Quarterly_Distribution_Count__c);
			o.Quarterly_Distribution_Count__c = currentcount +1;
			system.debug('Should have increased the count!!!');
		}

		update theAffectedPlans;
}

 Does anyone see what would cause that?


Thanks in advance!

 

Hi all,

 

I am trying to create a matrix map that is referrenced to determine whether or not an apex:inputField should be rendered on a page or not.  The problem is that I am currently needed to create a new getter method for each inputField.

 

Ideally, I'd love to have one method that the field name is passed into, which then checks against my matrix, and returns true or false.

 

Here's a sample of what it looks like now:

 

Class:

public with sharing class dynLayout{
    public Map<String,boolean> Criteria_1 = new Map<String,boolean>{
        'Field_1__c' => true,
        'Field_2__c' => false,
        'Field_3__c' => true
    }
    public Map<String,boolean> Criteria_2 = new Map<String,boolean>{
        'Field_1__c' => false,
        'Field_2__c' => false,
        'Field_3__c' => true
    }
    public boolean visible(string a){
        if(Criteria_1.get(a) == true && Criteria_2.get(a) == true){
            return true;
        }
        else{
            return false;
        }
    }

//Here are the getter methods for each field    
    public boolean getField_1(){
        return visible('Field_1__c');
    }
    public boolean getField_2(){
        return visible('Field_2__c');
    }
    public boolean getField_3(){
        return visible('Field_3__c');
    }


}

 

 

VF:

<apex:inputField value="{!MyObject__c.Field_1__c}" rendered="{!Field_1}"/><br />
<apex:inputField value="{!MyObject__c.Field_2__c}" rendered="{!Field_2}"/><br />
<apex:inputField value="{!MyObject__c.Field_3__c}" rendered="{!Field_3}"/><br />

 

Now this works just fine, but I have about 100 fields to work with and would prefer not to creat 100 additional methods. 

 

Does anyone have any recommendations for a better approach?

 

Thanks in advance!

 

Hi all,

 

Within IE9, I have having a problem with the picklists within one of my VF pages.  The problem is affecting both standard <Select/> and <apex:selectList/> tags.

 

The fields appear, however they are not clickable - meaning they do not expand/drop down to display their options.  If you tab through the fields and land on one of the picklists, you can use the up and down arrow keys to scroll through the options.

 

Using compatibility mode, IE8, or FireFox remedies the issue.

 

<div align="left">
    <apex:outputPanel id="controls">
        Size:&nbsp;&nbsp;    
            <select id="resizevalue" onchange="resize();">
                <option value="100%">100%</option>
                <option value="75%">75%</option>
                <option value="50%">50%</option>
                <option value="25%">25%</option>
                <option value="10%">10%</option>
            </select>
        <br />
        Form:  &nbsp;
            <apex:selectList id="form" value="{!form}"
                size="1" required="true">
                <apex:selectOptions value="{!forms}"/>
                <apex:actionSupport event="onchange" reRender="results" action="{!thelist}" oncomplete="preload();"  />   
            </apex:selectList>          
    </apex:outputPanel>
</div>

 Has anyone else experienced this or have a fix for it?

 

Thanks!

Hi,

 

Would it be possible to retrieve the criteria that triggers a workflow rule from within an Apex Class?  I'm wanting to display a string similar to what you see on the WF pages on a VF page:

 

(Plan Process: Plan Stage Name equals Implementation) and (Plan Process: 1st Payroll Upload Date not equal to null)

 




 

 

Hi all,

 

I'm using the following case statement to within a VF page to adjust some language.  Within one of the options is an apostrophe and I'm having difficulty escaping it.

 

Here's what I have:

{!case(MyOBJ__c.MyField__c,
'Any time',' at any time.',
'Based on Employer policy',' based on your employer\'s policy.',
'MERGE ERROR')}

 Doing this results in "based on your employer\'s policy" being displayed on the page.

 

Using \\'s results in a nasty looking Error: EL Expression Unbalanced: ...

 

And for grins, using \\\'s results in "based on your employer\\'s policy"

Hi all,


I was wondering if anyone could help me out with this error message.  The ultimate end goal is a getter method that could be passed a field's API name, check against two maps to determine if it should be rendered or not.

 

I'm currently caught up with this:  Error: Unknown property 'Photo__cStandardController.render'

 

public with sharing class test3 {
    public map<string,integer> st = new map<string,integer>();
    public map<string,integer> rt = new map<string,integer>();
   
    private final Photo__c p;
    public boolean getrender(string a){
    
        integer x;
        integer y;
        
             x = rt.get(a);
             y = st.get(a);
             if(x*y==0){
                 return false;
             }
             else{
                 return true;
             }
        

    } 

    public test3(ApexPages.StandardController controller) {
        this.p = (Photo__c)controller.getRecord();
        st = new map<string,integer>();
        rt = new map<string,integer>();
        if(p.Pose__c == 'Service Type 1'){
            this.st.put('Collection__c',1);
            this.st.put('Location__c',0);
        }
        if(p.Collection__c == 'Record Type 1'){
            this.rt.put('Collection__c',1);
            this.rt.put('Location__c',0);
        }
    }
}


<apex:inputField value="{!Photo__c.Collection__c}" rendered="{!render['Collection__c']}" />

I would greatly appreciate any help you could provide with this.  Thanks in advance!

Hey all,

 

Would it be possible to do something like this:

    public map<string,integer> field1 = new map<string,integer>();
    public map<string,integer> field2 = new map<string,integer>();

    public test3(ApexPages.StandardController controller) {
        this.field1.put('a',1);
        this.field2.put('b',2);
    }
    
    public integer getx(string x){
        return field2.get(x);
    }

 I'm just looking to be able to have something on the VF side like {!x[a]} to return 1.  Possible?

 

Thanks!

Hi all,

 

Is there a URL trick that will prevent the VF dev editor from appearing on VF pages? 

 

I'm working with a limited height frame with a VF page in an iframe.  Due to the short height, I can't click the editor's minimize button to view the page's content within the frame.

 

Thanks!

Hi all,

 

I'm working on a project where I am sending a handful of messages, using an email template, from a VF page.  Each message is for a different client and because of the template, each message is customized for that client.  The VF portion of the project is a series of pages, very similar to the "Mass Email Contacts" wizard, with the exception of the select your template page.

 

I basically have a list<messaging.singleemailmessage> named "mailbag" that each individual message is being added to and at the end of the process, this entire list is being sent with a Messaging.SendEmailResult [] r = Messaging.sendEmail(mailbag);

 

Ideally, what I would like to do is capture the individual IsSuccess() of each message and display a new VF page, with a list of all of the emails and their captured successes.

 

list<Plan_Process__c> PlansForEmail = [my soql statement]; 
List<messaging.singleemailmessage> mailbag= new List<messaging.singleemailmessage>();  
    for(Plan_Process__c pp :PlansForEmail){  
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        ... all of my mail.parameters
        mailbag.add(mail);
    } 
    Messaging.SendEmailResult [] r = Messaging.sendEmail(mailbag);
    for(Messaging.SendEmailResult rr:r){
        System.debug('Email result ' + rr.IsSuccess());
    } 

 So at this point, I'm seeing all of my IsSuccess() messagse, but by having all of the messages in a list, I've lost who they are for.  If I have 10 total messages in the mailbag and one fails, I don't have a way to match the failure to a message...do I?

 

I understand it is probably a better practice to send all of these messages at once, but I can see that if I send the message after each is created, scrapping the list idea, I could then create a message to success map to be used for the VF page.

 

Is there any way to retain the list idea and capture each messages' success or does it really not matter if I'm sending these messages individually as opposed to all at once.

 

Also, if I do send them individually and a failure is experienced, will the code stop in its tracks, preventing all of the remaining messages from their attempts at being sent?

 

Thanks in advance!

 

 

I am trying to move Custom objects, tabs and visual force pages form Develop Edition to Professional Edition using Force.com IDE embedded in eclipse.

 

The problem is that when i fully import the devleop edition in Eclipse (whn creating a new Force.com project, i chose to get all apex classes, components,...) and try to "Deploy to server" to my professional edition, it only displays the VisualForce pages which obvisouly returns an error since the custom objects did not yet load and it they are not listed (view image)..

 

This sounds like a dependency problem where i use the custom objects that i created in VisualForce pages.. can anyone plz detail how to fix this (i dperecate the use of unmanaged packages and the force.com migration tool seems to do the same thing as the force.com ide)

 

I would appreciate any advise

 

 

 

  • June 24, 2011
  • Like
  • 0

SObject row was retrieved via SOQL without querying the requested field: Plan_Process__c.Advisor_Meeting_Call__c

 

I am receiving the above error message within a VF email template where the relatedTo is set to "Plan_Process__c." 

 

Usually when I see this error message, I've forgotten to include a field in a SOQL statement, but this is a little bit different as it is just an email template, no Apex and no SOQL.

 

Has anyone seen this and what can I do to resolve it?

 

Thanks in advance!

Hello Gurus,

 

I am new to Vf and looking for help to get this done quickly. The requirement is display company logo on header, then Opportunity Detail (layout as how it appears in salesforce) and the list of products. Has anyone done anything similar that i can leverage on? can i use apex tag?

 

Thanks in advance

Deepak

I have a custom object with a "Set Default" Checkbox to indicate that that record is the default record for another process.  Obviously I only want one default record at a time.  I am writing a trigger to set all the other records checkbox to false when a new or updated records checkbox is set to true.  Here is my Code:

 

 

trigger SetDefault on Workflow_Types__c (before insert, before update) {
    
    List<Workflow_Types__c> wt = new List<Workflow_Types__c>([Select id, default__c from Workflow_Types__c]);
    Integer size = wt.size();
    for (Workflow_Types__c w: Trigger.new){
        if (w.Default__c == True){
            for (Integer i = 0; i < wt.size(); i++){
                if (wt[i].id != w.id){
                    wt[i].Default__c = False;
                    //update wt[i];
                }else{
                    Workflow_Types__c temp = wt.remove(i);
                    system.assertEquals(w.id, temp.id);
                    system.assertEquals(wt.size(), size-1);
                }
            }
        }
    }
    update wt;
    
}

 The problem is that even though I am trying to remove the record that calls the trigger and the assertions are passed for some reason it is still trying to recursively update the calling record when I call update wt, and gives me an error.  If I uncomment the line //update wt[i]; and comment the other update it does work, but I am afraid of possibly hitting governor limits by putting the DML statement in the for loops.  Any ideas would be appreciated.

 

Thanks

 

Edit: I have determined that the behaviour I described only happens when there are only two records in the object.  If I add more objects I have no problems

 

Hi all,

 

I'm working on a simple proof of concept project to help me understand web services better.

 

On the Salesforce Site side, I have the following web service:

 

global class helloWorld  
{  
    WebService public static String GetMessage()  
    {  
        return 'Hello world';  
    }  
}

The corresponding site is http://mydomain.sandboxname.cs1.force.com/webservice.

The site's Active Site Home Page is set to a nearly blank page called test and I have enabled the above class within the site's Public Access Settings

 

On the VisualForce page side that I'm trying to make the call from, I have the following:

 

public string getContent(){
	Http h = new http();
	HttpRequest req = new HttpRequest();
//req.setEndpoint('http://mydomain.sandboxname.cs1.force.com/services/Soap/class/helloWorld');
	req.setEndpoint('http://mydomain.sandboxname.cs1.force.com/webservice');
	req.setMethod('POST');
	req.setHeader('Content-Type', 'text/xml;charset=utf-8'); 
	req.setHeader('Content-Length', '18'); 
	req.setHeader('soapAction', 'https://cs1-api.salesforce.com/services/Soap/class/helloWorld');
	HttpResponse res = h.send(req);
		system.debug('Body was:  '+ res);
		system.debug('String was:' + res.getBody());
		return res.getBody();
	}

This is the portion I'm not sure of.  Really just winging it.  As it stands, I'm currently receiving this error:

System.CalloutException:  Read timed out

 

I'm not sure what to put as my endpoint, nor am I sure about the header information.  Previously, without the Content-Length, it complained.  

 

Within the WSDL for the class, I see "http://soap.sforce.com/schemas/class/helloWorld" and "https://cs1-api.salesforce.com/services/Soap/class/helloWorld" but not sure if those come into play.

 

I've successfuly called out to an externally hosted web service and had a much more complex request body, but was able to put it together using another example on the web.  

 

Can any of you school me on what I'm doing wrong or point me in the direction of  good example?

 

Thanks!