• cloudmania
  • NEWBIE
  • 134 Points
  • Member since 2011
  • Senior Salesforce Developer
  • eBay


  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 118
    Replies

I have created a Visualforce page and am using it through a site. When I right click on the browser and click on view source I am able to see the entire code of my controller class. Is there any way to hide that.

Hi,

 

I want to fetch the list of label names for all the fields of an Object....I got some code to get field labels of an Object 

 

i.e. <apex:column title=”{!$ObjectType.OpportunityLineItem.fields.Quantity.label}” headerValue=”{!$ObjectType.OpportunityLineItem.fields.Quantity.label}” width=”50px”>

 

But I want to get the list of all field labels by Apex..

I got the API name of all fields like this 

 

 String type='Account';

Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
Schema.SObjectType leadSchema = schemaMap.get(type);
Map<String, Schema.SObjectField> fieldMap = leadSchema.getDescribe().fields.getMap();


for (String fieldName: fieldMap.keySet()) {

System.debug('##Field API Name='+fieldName);// list of all field API name
}

 

 

 

But I need to get the label name..

 

Please help

  • January 20, 2012
  • Like
  • 1

Hi, 

 

I am trying to create an "onclick" event handler for the <apex:commandbutton> tag. For some reason, it is not working properly. Here is my code: 

 

<apex:commandbutton action="{!delete}" value="Delete" immediate="true" onclick="dislayErr()"/>

function displayErr(){
   if({!Account.name != 'Test User'}){
      alert("You are not allowed to delete this credit card entry");
   }
}
                

 Please help. Thank you. 

 

Hi,

 

I want to check if this is even possible.

 

I have created a stand alone Visuaforce page based on a  custom controller pulling campaign members onto a single page that I want to be visible from the Account page.

 

Of course it seems to link a visualforce page by adding it as a section on the Account page, it needs to be powered by the Account standard controller.

 

Is it possible to write a visualforce page from the standard controller that can get data from as low down as Account>Contact>CampaignMember>Campaign so I can get all my fields?

 

Or alternatively is there a way to put a customer controller powered visualforce page on the Account page? Does the controller need to be 'Account' and add the following class as an extension?

 

I know this is basic stuff but after trawling the internet for an hour I'm alittle stuck.

 

Here's my current code for the stand alone page I have working;

 

public class myCampaignMembers {

 /// Create a list
 /// <OBJECT_NAME>
 List<CampaignMember> rqs;

 /// getReq() - Reffer to the list in the
 /// visualforce page with "Req" minus the "get" from
 /// controller name.
 public List<CampaignMember> getReq() {

  /// Get the data for the list
  rqs = [select id, Campaign.Name, CreatedDate, Contact.ID, Contact.Title, Contact.FirstName, Contact.LastName, Contact.AccountID, Status FROM CampaignMember];
  return  rqs;
 }
}

 

And my Visualforce Page....

 

<apex:page showHeader="false" sidebar="false" controller="myCampaignMembers" tabStyle="Contact">
 <apex:pageBlock title="Campaign Members" id="CamMem">
  <apex:dataTable value="{!Req}" var="CampaignMembers" cellPadding="4" border="1">
   <apex:column >
    <apex:facet name="header">Created Date</apex:facet>
    <apex:outputField value="{!CampaignMembers.CreatedDate}"/>
   </apex:column>
   <apex:column >
    <apex:facet name="header">Campaign Name</apex:facet>
    <apex:outputField value="{!CampaignMembers.Campaign.Name}"/>
   </apex:column>
   <apex:column >
    <apex:facet name="header">Status</apex:facet>
    <apex:outputField value="{!CampaignMembers.Status}"/>
   </apex:column>
      <apex:column >
    <apex:facet name="header">First Name</apex:facet>
    <apex:outputField value="{!CampaignMembers.Contact.FirstName}"/>
   </apex:column>
   <apex:column >
    <apex:facet name="header">Last Name</apex:facet>
    <apex:outputLink value="{!CampaignMembers.Contact.LastName}">{!CampaignMembers.Contact.LastName}</apex:outputLink>
   </apex:column>
   <apex:column >
    <apex:facet name="header">Title</apex:facet>
    <apex:outputField value="{!CampaignMembers.Contact.Title}"/>
   </apex:column>
   <apex:column >
    <apex:facet name="header">Account</apex:facet>
    <apex:outputField value="{!CampaignMembers.Contact.AccountID}"/>
   </apex:column>
  </apex:dataTable>
 </apex:pageBlock>
 
</apex:page>


 

Hello , I was trying to complete all challenge about lightining, i was able to pass all of them except "Using Javascript Controller with Components" challenge. I was not able to figure out why trailhead gives the  error below  :

User-added image

Here is my component :
 
<aura:component > 

    <ui:inputNumber aura:id="inputOne" onError='{!c.handleError}' /> <br />
    <ui:inputNumber aura:id="inputTwo" onError='{!c.handleError}' /> <br/> 
    <ui:inputNumber aura:id="inputThree" onError='{!c.handleError}' /> <br/>
       
    <ui:outputNumber aura:id="totalValue" value="" /><br/>
	 <ui:button label="Calculate"  press="{!c.calculate}"/>  
    
</aura:component>

and here is my js controler :
 
({
	calculate : function(component, event, helper) {
		var inputFirst = component.find("inputOne").get("v.value");
        var inputSecond = component.find("inputTwo").get("v.value");
        var inputThird = component.find("inputThree").get("v.value");
        var total = parseInt(inputFirst) + parseInt(inputSecond) - parseInt(inputThird);
        component.find("totalValue").set("v.value",total);
	}
})

Thanks.

 
Hello , I was trying to complete all challenge about lightining, i was able to pass all of them except "Using Javascript Controller with Components" challenge. I was not able to figure out why trailhead gives the  error below  :

User-added image

Here is my component :
 
<aura:component > 

    <ui:inputNumber aura:id="inputOne" onError='{!c.handleError}' /> <br />
    <ui:inputNumber aura:id="inputTwo" onError='{!c.handleError}' /> <br/> 
    <ui:inputNumber aura:id="inputThree" onError='{!c.handleError}' /> <br/>
       
    <ui:outputNumber aura:id="totalValue" value="" /><br/>
	 <ui:button label="Calculate"  press="{!c.calculate}"/>  
    
</aura:component>

and here is my js controler :
 
({
	calculate : function(component, event, helper) {
		var inputFirst = component.find("inputOne").get("v.value");
        var inputSecond = component.find("inputTwo").get("v.value");
        var inputThird = component.find("inputThree").get("v.value");
        var total = parseInt(inputFirst) + parseInt(inputSecond) - parseInt(inputThird);
        component.find("totalValue").set("v.value",total);
	}
})

Thanks.

 

Hi all,

I am trying to download the documents of public folder rfom force.com site. I am using following approach for this.

 

value="{!URLFOR($Action.Document.Download, document.id)}"

 

But It opens the document in new tab and URL is shown in address bar. I want to download this instead of showing in new tab, because I don't want to show URL of the document.

could anyone please help me out.

I keep gettign this internal SF error.

 

we are keeping getting an error(Internal Salesforce Error: 1070496590-596 (2082893627) (2082893627) when we are trying to run our test classes

 

Any idea why i'm getting this?

i have custom vf page..

which has i input filed assigned with picklist..

and it is dependent on other picklist value..

i have the value of picklist which to set default but how to set it ???

 

<apex:inputField value="{!item.Category__c}">

           

</apex:inputField>

 

is it possible ??

  • March 05, 2013
  • Like
  • 0

Hi,

 

Actually my requirement is like,

I have a list of records around 500 and i have sorted all those and inserted into object.

I have to prepare a report in such a way that the order of inserted records has to be displayed in the report(in the same order of inserted). How can i do it.

 

It is very urgent.

 

Thanks In advance,

Bujji

  • May 03, 2012
  • Like
  • 0

Hi,

 

I am currently trying to create a form with a section that contains 10 children. The section has six fields, my problem is that when displayed the next child (first field) does not start from the left hand magin.

 

The code I'm using is below:

 

<apex:pageBlockSection id="section02child" showHeader="true" title="Account specifications" columns="3">
                     <apex:repeat value="{!newFormChilds}" var="newFormChild">
                     	<apex:inputField styleclass="{!IF(newFormChild.TF_Position__c==0, 'required', '')}" value="{!newFormChild.Account_number__c}"/>
                		<apex:inputField styleclass="{!IF(newFormChild.TF_Position__c==0, 'required', '')}" value="{!newFormChild.Full_Legal_Name__c}"/>
                		<apex:inputField styleclass="{!IF(newFormChild.TF_Position__c==0, 'required', '')}" value="{!newFormChild.Account_Designation__c}"/>
                		<apex:inputField styleclass="{!IF(newFormChild.TF_Position__c==0, 'required', '')}" value="{!newFormChild.Legal_Address__c}"/>
                		<apex:inputField styleclass="{!IF(newFormChild.TF_Position__c==0, 'required', '')}" value="{!newFormChild.Dividend_Policy__c}"/>
                		<apex:inputField styleclass="{!IF(newFormChild.TF_Position__c==0, 'required', '')}" value="{!newFormChild.Participant_Account_Reference__c}"/>

......

 

Any ideas?

 

Thanks

 

Chris

HI All,

 

    I have HelpText attributes in <apex:pageblocksectionitem> in visualforce pages. When I keep mouse on ? symbol, it displaying helptext well till yesterday. Today I am unable to see help text when I keep mouse on? symbol. This is happening in all visualforce pages and all fields.

 

   What is the problem here. And how to resolve this.

 

Thanks,

Naresh B

Hi,

 

i've Registration object from which i want to send an email template to the Contact related to the Registration.

My email needs to be in the language of the Contact (French, Dutch, English) so i use this

 

<messaging:emailTemplate subject="Confirmation Registration" recipientType="Contact" relatedToType="Registration__c" language="{!recipient.language_email__c}">

<messaging:htmlEmailBody >
<html>
<body height="100%" width="100%">
{!$Label.Dear}<br /><br />

...

 

My $Labels are translated in the 3 needed languages.

 

The email is sent based on a change of status of the Registration.

If i use the "Send Test and Verify Merge Fields" button of the EmailTemplate with the corresponding Registration and Contact, it works fine.

However if change this status in Apex or on the Registration record itself, the mail is always sent in English. 

 

Any idea why it doesn't work otherwise ?

 

Thanks for your help

  • February 22, 2012
  • Like
  • 0

Hi ,

 

I really aprreciate your help. I have already spend 3 days looking around and can't find answer anywhere.

I have a custom object ' Sample Tracking'. I want to create a send email button and send the related list' products' to the associated customer. I created the botton with following no problem,

location.replace('/email/author/emailauthor.jsp?retURL=/{!Sample_Tracking__c.Id}&rtype=003&p2_lkid={!  Sample_Tracking__c.Recipient_ContactId__c }&template_id=00XJ0000000QD2e')

 

This is working fine. and triggering the email window. Now I created the email template with the following code. My question is, when I click on send email, the sampletracking ID is not passed to the email template. How do I do that. On the other hand when I want to test email template, it is asking for entering 'related to record' .What should I enter there.  Please help me in right direction. All i want is when I am on sample tracking page, and click the send an email, the same tracking no. should be pass to email template. and it should list out the products associated with that sample tracking no.

 

<messaging:emailTemplate subject="Testing Visualforce Email Template" recipientType="Contact" relatedToType="Sample_Tracking__c"> <messaging:HtmlEmailBody > <html>     <body>      <STYLE type="text/css">            TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center }            TD  {font-size: 11px; font-face: verdana }            TABLE {border: solid #CCCCCC; border-width: 1}            TR {border: solid #CCCCCC; border-width: 1}      </STYLE>          <font face="arial" size="2">

  <p>Dear {!recipient.name},</p>       <p>Below is a list of Products and Product Descriptions cases related to the Sample Request: {!relatedTo.name}.</p> <table border="0" >         <tr >             <th>Product</th><th>Product description</th><th>Send Quantity</th><th>Cost</th>          </tr> <apex:repeat var="cx" value="{!relatedTo.Product_Samples__r}">    <tr>        <td><a href="https://na1.salesforce.com/{!cx.id}">View</a> |         <a href="https://na1.salesforce.com/{!cx.id}/e">Edit</a></td>        <td>{!cx.name}</td>                 </tr> </apex:repeat>       </table>       <p /> </font>        </body>    </html>

</messaging:htmlEmailBody> </messaging:emailTemplate>

Hi Guys,

 

I have a visual force page which display the  snecha(Extj3.0) table with one button bottom of the table .

 

When i click on the button it will create a contact, case and opens a newly create case window.

 

The table will display the create contact details if I do ctr+f5 .

 

But i need this value to be in the table when i click on button.

 

I means when i click on button snecha(extj3.0) table has to reload or refresh with newly create contact and opee a new window.

 

I was bale to open a newly created case window with the help of javascript. but I am unable to reload the data into the table.

 

 Can anyone suggest me how to solve this problem any help or code sample is much appreciated.

  • February 21, 2012
  • Like
  • 0

Hi,

 

I need to download an image using apex code when click on 'Download' link.

For this below is the code

<apex:page controller="TestController">
<apex:form >
<apex:commandLink action="/apex/DownloadImage"
style="font-size:15px;color:#0066CC;text-decoration:none;font-family:Segoe UI,Arial,Helvetica,sans-serif;" >
Download Image
</apex:commandLink>
</apex:form>
</apex:page>

 and in the 'DownloadImage'  <apex:page controller="TestController" contentType="I/MIME#image.png"> also tried with the contentType="image/png#image.png". With these content types able to download 'image.png' but the content in the file is not in '.png' format.

 

I am able to download a '.crt' file with the contentType="S/MIME#certificate.crt" and it is working fine.

 

Can anyone please help me on downloading an image using apex code.

 

Thanks in advance.

Hi,

 

I am currently working on a visualforce page that is going to be used in a sites email campaign. Turns out Opportunity does not work well with sites so I need some help taking my query of Opportunity and placing values into string fields (or list, whichever works).

 

Opportunity record ID is passed through the email so that is used in the query, also keeps it limited to 1 per page so that should make it easier to deal with.

 

Here is a shot of how I am querying:

 

public with sharing class rrdipus {

//Collect Opportunity ID to use in query
public string uniqueID = System.currentPagereference().getParameters().get('q'); 
public string getUniqueID() { return uniqueID; }

public list<Opportunity> getDetails() 
{
		return [SELECT Project_Street__c, Project_City__c, Project_State__c, Project_Zip__c, Proj_Country__c, Proj_Expiration__c, Proj_RSF__c
                FROM Opportunity
                WHERE Id = :uniqueID ];

}

}

As for the VF apge, I know how to display everything needed - just confused how to get those values returned in the query to a string field.

 

Example: I would like to take Project_Street__c and place it into a string field called thestreet or something like that.

 

Thanks in advance,

  • February 21, 2012
  • Like
  • 0

I have a requirement need to display a table if any of the row value is acitive in one of the column called status now how to display a link(cancel) with in the same column that is next to acitve value.if user click on that link  status should turn to cancle and link should  disappear. Any thoughts....

  • February 21, 2012
  • Like
  • 0

Hi,

 

Below is my VF page and Controller class code. I have a look-up field on my VF page. I type in city name and click on Add. I have java script function (I think it is AJAX) which shows this value on Apex InputTextArea. Everything works except that the selected value appears on the InputTextArea control and disappears. I am suspecting something to do with page refresh but not sure.

I have highlighted the important blocks of code.

 

Any help is much appreciated. Thanks in advance.

 

VF Page-

<apex:page standardController="Leg__c"  extensions="TripLegsGroupBookController" recordSetVar="Leg__c" tabStyle="Leg__c">
 
 <apex:pageblock title="Group book legs">
  <apex:form id="mForm" >
    <script type="text/javascript"> 
      function doSave(sname) { 
        CityName(document.getElementById(sname).value); 
      } 
    </script>

    <apex:actionFunction name="CityName" action="{!ReadCityNames}" rerender="SelctCity">
      <apex:param name="CityNames" value="" assignTo="{!stcityName}" />
    </apex:actionFunction>
  
    <apex:pageblockSection columns="2">
       <apex:pageblockSectionItem >
          <apex:outputLabel value="City travelling:"/>      
          <apex:outputPanel >       
            <apex:inputField id="TravelCity" value="{!GroupLeg.To_City__c}"  />
            <apex:commandLink value="Add" onclick="doSave('{!$Component.TravelCity}')"/>
          </apex:outputPanel> 
       </apex:pageblockSectionItem>
       <apex:pageblockSectionItem >
          <apex:outputLabel value="Selected city/ies:"/>      
          <apex:outputPanel id="SelctCity">       
            <apex:inputtextarea id="SelCity" value="{!stcityName}"/>
          </apex:outputPanel> 
       </apex:pageblockSectionItem>
    </apex:pageBlockSection>           
  </apex:form>
  </apex:pageblock>

</apex:page>

 

Controller class

Public class TripLegsGroupBookController{
   Private final Leg__c myTripLeg;
   Public String stCityName{get; set;}
   public String TCity{get; set;}  
   
   Public TripLegsGroupBookController(ApexPages.StandardSetController LegStdController){
    this.myTripLeg=(Leg__c) LegStdController.getRecord();
   }
//************************************   
   Public Leg__c getGroupLeg(){    
     Return myTripLeg;
   }
//************************************   
   Public PageReference ReadCityNames(){
     stcityName=TCity + ', ' + Apexpages.currentpage().getParameters().get('CityNames');
     TCity=stcityName;
     return null;   
   }  
//************************************   
   Public String getTCity(){
     return stcityName;
   }
//************************************   
   Public String getstcityName(){
     return stcityName;
   }      
}

Hi,

My Requirements is:

 

• Need to check can we access salesforce CRM Content from Authenticated Website License.

 

Also If you say that yes we can access SF CRM Content from Authenticated website then how can we enable Salesforce CRM Content User Featue Licesence for the Authenticated website user.

 

Please make sure that Authenticate Website license is must.


Above is my requirement, can you please help me out for the above .Looking forward for a positive reply