• reddygari403
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 30
    Questions
  • 14
    Replies
Hi everybody plz find the above error.the below program is for adding columns dynamicaly.plz find the error public class Demo { public map mapFieldToShow{get;set;} public map mapFieldToShow1{get;set;} list lstfield=new list(); list lstflabel=new list(); public Integer noOfColumns // User input { get; set { listFieldToShow = new List(); // listFieldToShow.addAll(lstField); for(integer i=0;i listFieldToShow {get;set;} List fieldLabels=new List(); public Demo() { Contactfields__c objp=[select objectName__c from Contactfields__c limit 1]; SObjectType objToken = Schema.getGlobalDescribe().get(objp.objectName__c); DescribeSObjectResult objDef = objToken.getDescribe(); Map fieldmap = objDef.fields.getMap(); for(Contactfields__c obj:[select fieldName__c from Contactfields__c order by Fieldvalue__c]) // query from custom settings. lstfield.add(obj.fieldName__c); listFieldToShow = new List(); mapFieldToShow = new Map(); mapFieldToShow1 = new Map(); for(integer i=0;i listTableResult { get;set; } public PageReference Add() { return ApexPages.currentpage(); } public List getlistTableResult() { return listTableResult; } public void setlistTableResult(List Contacts) { listTableResult = Contacts; } public PageReference save() { // to save updates. upsert listTableResult; return null; } } ============= {!mapFieldToShow1[colItem]}
hi i am getting a error plzzz rectify it. {!mapFieldToShow1[colItem]} class: ================ public class Demo { public map mapFieldToShow{get;set;} public map mapFieldToShow1{get;set;} list lstfield=new list(); list lstflabel=new list(); public Integer noOfColumns // User input { get; set { listFieldToShow = new List(); // listFieldToShow.addAll(lstField); for(integer i=0;i listFieldToShow {get;set;} List fieldLabels=new List(); public Demo() { Contactfields__c objp=[select objectName__c from Contactfields__c limit 1]; SObjectType objToken = Schema.getGlobalDescribe().get(objp.objectName__c); DescribeSObjectResult objDef = objToken.getDescribe(); Map fieldmap = objDef.fields.getMap(); for(Contactfields__c obj:[select fieldName__c from Contactfields__c order by Fieldvalue__c]) // query from custom settings. lstfield.add(obj.fieldName__c); listFieldToShow = new List(); mapFieldToShow = new Map(); mapFieldToShow1 = new Map(); for(integer i=0;i listTableResult { get;set; } public PageReference Add() { return ApexPages.currentpage(); } public List getlistTableResult() { return listTableResult; } public void setlistTableResult(List Contacts) { listTableResult = Contacts; } public PageReference save() { // to save updates. upsert listTableResult; return null; } }

Hi

 

 

HOW CAN I GET RELATED PAGES AND CLASSES WHEN I SELECT OBJECT.PLZ HELP

Hi

 

             how can i use database.com in salesforce

     hi

 

 

 

  I have a query.i.e.when i select an object  in select list , the related pages and classes shoud be displayed below...so plz help.

Hi EVERYBODY

 

 

       I have a query.i.e.when i select an object  in select list , the related pages and classes shoud be displayed below...so plz help.

 

 

 

 

hi

 

 

 bright sms not working properly.plz help

Hi everybody

 

 

how can i implement social media.

Hi Everybody

 

 

           how can i implement CTI  in developer edition

 

 

               Hi Everybody,

 

 

 

 

                                     How can I implement Service cloud in my salesforce instance.plz help.

Hi Everybody.

 

 

                              I have Three buttons namely EDIT, SAVE & DELETE.When I clicked save the remaining two buttons EDIT & DELETE should disappear.similarly when I click delete the remaining two should  disappear.AT THE SAME THE ACTION SHOULD BE PERFORMED.

Hi All

 

 How can i integrage salesforce with social networking sites like facebook, etc.plz help

Give some examples of requirements which cannot be built in salesforce.com via standard functionality?

 Explain, the way you will query child from parent and parent from child

 List few components which cannot be deployed using force.com IDE or change sets.

16. Explain the trigger handler pattern.

 Minimum number of queries required to query for 2 level, 3 level relationships in salesforce

9. When you override a button by specifying a VF page, what is a necessary condition for the VF page to be available.

lead conversition using customisation

Hi

 

 

 how can we write a trigger using list,set ,map for two custom objects.the trigger should be in the way ,,when we insert a record in one object ,the record should automatically inserted in the second  object.at the same time when we update the record in first object.the record should automatically update in the second object...i.e.there should not be any relation between two objects.

 

 

               Hi Everybody,

 

 

 

 

                                     How can I implement Service cloud in my salesforce instance.plz help.

16. Explain the trigger handler pattern.

  how to delete the record from displayed table in visualforcepage using custem controller based on checkbox send me sample code

 

 

 

<apex:column headervalue="Select"> <apex:actionregion >
<apex:actionsupport action="{!selectedContact}" event="onclick" >
<input type="radio" name ="contact" />
<apex:param name="conid" value="{!con.Id}" assignTo="{!conid}">
</apex:param> </apex:actionsupport></apex:actionregion>
</apex:column>

 

// tried public selectedcontact() instead of page reference

Public pagereference selectedContact(){
selcontactid = System.currentPagereference().getParameters().get('conid');
system.debug('selected contact:::::::::::::'+selcontactid);
system.debug('selected contact conid:::::::::::::::::'+conid);
return null;
}

 

the method is being called ut the conid is printing null

  • August 31, 2012
  • Like
  • 0

Hi - I have a drop down on a VF page that displays the number of pages of records.

I want to be able to programmatically set the drop down value to '1' when the user sorts by any column header.

I know this should be pretty simple, but I've been searching for an answer and cannot find anything.....

Here's the VF code for populating the drop down with data from the controller

 

<apex:selectList id="pgnm" size="1" value="{!pagenum}" onChange="changePage(this.options[this.selectedIndex].text);">
             	<apex:selectOptions value="{!pageNumbers}"/>
                </apex:selectList>
                <br/>
                <apex:actionFunction name="changePage" action="{!goToPage}" rerender="out" status="loading">
     				<apex:param assignTo="{!pagenum}" value="" name="pagenum"/>
   				</apex:actionFunction>

 

Here's the code that I want to cause the reset of the drop down to '1':

<apex:facet name="header" >
                    <apex:outputLink onclick="SortByStuLastName();return false;">Student Name</apex:outputLink>
                </apex:facet>

 I've tried adding a javascript function after the return false;  and calling it like this:setPageNum(' {!$Component.ltrowner}') but this did not work...

function setPageNum(val){
		document.getElementById(val).value = '1';
  }

 Your help is greatly appreciated!

  • August 30, 2012
  • Like
  • 0

I want to display the list view filter picklist that shows up at the top of a case. Its the one that lets u select your list view filters. e.g, All cases, All Open Cases, etc.

How can i get that to display in visualforce?

 

Regards

Shuchi

Hi,

 

How to insert the multiple values from picklist using visualforce and apex .

 

Thanks,

paddybilli

 

HI their,

 

   I can't see the google map in VF page when I copy and paste the code here is my code......Dnt knw y?help pls

 

<apex:page standardController="Account">

<head>

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">

$(document).ready(function() {

var myOptions = {
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: false
}

var map;
var marker;

var geocoder = new google.maps.Geocoder();
var address = "{!Account.BillingStreet}, " + "{!Account.BillingCity}, " + "{!Account.BillingPostalCode}, " + "{!Account.BillingCountry}";

var infowindow = new google.maps.InfoWindow({
content: "<b>{!Account.Name}</b><br>{!Account.BillingStreet}<br>{!Account.BillingCity}, {!Account.BillingPostalCode}<br>{!Account.BillingCountry}"
});

geocoder.geocode( { address: address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK && results.length) {
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {

//create map
map = new google.maps.Map(document.getElementById("map"), myOptions);

//center map
map.setCenter(results[0].geometry.location);

//create marker
marker = new google.maps.Marker({
position: results[0].geometry.location,
map: map,
title: "{!Account.Name}"
});

//add listeners
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
google.maps.event.addListener(infowindow, 'closeclick', function() {
map.setCenter(marker.getPosition());
});

}

} else {
$('#map').css({'height' : '15px'});
$('#map').html("Oops! {!Account.Name}'s billing address could not be found, please make sure the address is correct.");
resizeIframe();
}
});

function resizeIframe() {
var me = window.name;
if (me) {
var iframes = parent.document.getElementsByName(me);
if (iframes && iframes.length == 1) {
height = document.body.offsetHeight;
iframes[0].style.height = height + "px";
}
}
}

});
</script>

<style>
#map {
font-family: Arial;
font-size:12px;
line-height:normal !important;
height:250px;
background:transparent;
}
</style>

</head>

<body>
<div id="map"></div>
</body>
</apex:page>

 

 

I have edited the layout of Account by Visualforce page also....

I have Custom  Lookups for Contacts and Accounts.  They work great independently when called from a Visualforce Page.

Except, when the calling page is one of the Lookups.

 

In the case of calling the account lookup from the contact lookup to populate the field of a contact add, it won't return to the contact lookup page at all.

 

The Contact Lookup page is below  (Account Lookup is modled after that)

 

<apex:page controller="CustomContactLookupController"
title="Search"
showHeader="false"
sideBar="false"
tabStyle="contact"
id="pg">

<script type="text/javascript">
function openLookup(baseURL, width, modified, searchParam){
var originalbaseURL = baseURL;
var originalwidth = width;
var originalmodified = modified;
var originalsearchParam = searchParam;

var lookupType = baseURL.substr(baseURL.length-3, 3);
if (modified == '1') baseURL = baseURL + searchParam;

var isCustomLookup = false;

// Following "001" is the lookup type for Account object so change this as per your standard or custom object
if(lookupType == "001"){

var urlArr = baseURL.split("&");
var txtId = '';
if(urlArr.length > 2) {
urlArr = urlArr[1].split('=');
txtId = urlArr[1];
}

// Following is the url of Custom Lookup page. You need to change that accordingly
baseURL = "/apex/CustomAccountLookup?txt=" + txtId;

// Following is the id of apex:form control "myForm". You need to change that accordingly
baseURL = baseURL + "&frm=" + escapeUTF("{!$Component.CustomContactLookup}");
if (modified == '1') {
baseURL = baseURL + "&lksearch=" + searchParam;
}

// Following is the ID of inputField that is the lookup to be customized as custom lookup
if(txtId.indexOf('Account') > -1 ){
isCustomLookup = true;
}
}

// jmc added because above does not set it - this will cause all lookups to override
isCustomLookup = true;

if(isCustomLookup == true){
openPopup(baseURL, "lookup", 350, 480, "width="+width+",height=480,toolbar=no,status=no,directories=no,menubar=no,resizable=yes,scrollable=no", true);
}
else {
if (modified == '1') originalbaseURL = originalbaseURL + originalsearchParam;
openPopup(originalbaseURL, "lookup", 350, 480, "width="+originalwidth+",height=480,toolbar=no,status=no,directories=no,menubar=no,resizable=yes,scrollable=no", true);
}
}
</script>

<apex:form >
<apex:outputPanel id="page" layout="block" style="margin:5px;padding:10px;padding-top:2px;">
<apex:tabPanel switchType="client" selectedTab="name1" id="tabbedPanel">

<!-- SEARCH TAB -->
<apex:tab label="Search" name="tab1" id="tabOne" onclick="!Search" reRender="searchResults">

<apex:actionRegion >
<apex:outputPanel id="top" layout="block" style="margin:5px;padding:10px;padding-top:2px;">
<apex:outputLabel value="Search" style="font-weight:Bold;padding-right:10px;" for="txtSearch"/>
<apex:inputText id="txtSearch" value="{!searchString}" />
<span style="padding-left:5px"><apex:commandButton id="btnGo" value="Go" action="{!Search}" rerender="searchResults"></apex:commandButton></span>
</apex:outputPanel>

<apex:outputPanel id="pnlSearchResults" style="margin:10px;height:350px;overflow-Y:auto;" layout="block">
<apex:pageBlock id="searchResults">
<apex:pageBlockTable value="{!results}" var="a" id="tblResults">
<apex:column >
<apex:facet name="header">
<apex:outputPanel >Name</apex:outputPanel>
</apex:facet>
<apex:outputLink value="javascript&colon;top.window.opener.lookupPick2('{!FormTag}','{!TextBox}_lkid','{!TextBox}','{!a.Id}','{!a.Name}', false)" rendered="{!NOT(ISNULL(a.Id))}">{!a.Name}</apex:outputLink>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:outputPanel >Account</apex:outputPanel>
</apex:facet>
<apex:outputLink disabled="true" value="javascript&colon;top.window.opener.lookupPick2('{!FormTag}','{!TextBox}_lkid','{!TextBox}','{!a.Id}','{!a.Account.Name}', false)" rendered="{!NOT(ISNULL(a.Id))}">{!a.Account.Name}</apex:outputLink>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:outputPanel >Title</apex:outputPanel>
</apex:facet>
<apex:outputLink disabled="true" value="javascript&colon;top.window.opener.lookupPick2('{!FormTag}','{!TextBox}_lkid','{!TextBox}','{!a.Id}','{!a.Title}', false)" rendered="{!NOT(ISNULL(a.Id))}">{!a.Title}</apex:outputLink>
</apex:column>
<apex:column >
<apex:facet name="header">
<apex:outputPanel >Email Name</apex:outputPanel>
</apex:facet>
<apex:outputLink disabled="true" value="javascript&colon;top.window.opener.lookupPick2('{!FormTag}','{!TextBox}_lkid','{!TextBox}','{!a.Id}','{!a.email}', false)" rendered="{!NOT(ISNULL(a.Id))}">{!a.email}</apex:outputLink>
</apex:column>

</apex:pageBlockTable>
</apex:pageBlock>
</apex:outputPanel>
</apex:actionRegion>

</apex:tab>

<!-- NEW contact TAB -->
<apex:tab label="New contact" name="tab2" id="tabTwo" >

<apex:pageBlock id="newcontact" title="New contact" >

<apex:pageBlockButtons location="top">
<apex:commandButton action="{!savecontact}" value="Save"/>
</apex:pageBlockButtons>
<apex:pageMessages />

<apex:pageBlockSection columns="2">
<apex:inputField value="{!contact.LastName}" required="true"/>
<apex:inputField value="{!contact.FirstName}" required="true"/>
<apex:inputField value="{!contact.Title}"/>
<apex:inputField value="{!contact.Email}"/>
<apex:inputField value="{!contact.AccountId}"/>
<apex:inputField value="{!contact.Department}"/>
<apex:inputField value="{!contact.Phone}"/>
<apex:inputField value="{!contact.MobilePhone}"/>

<apex:inputField value="{!contact.Fax}"/>
<apex:inputField value="{!contact.ReportsToId}"/>
<apex:inputField value="{!contact.AssistantName}"/>
<apex:inputField value="{!contact.AssistantPhone}"/>
<apex:inputField value="{!contact.Description}"/>
<apex:inputField value="{!contact.BirthDate}"/>
<apex:inputField value="{!contact.Date_of_Last_Personal_Contact__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>

</apex:tab>
</apex:tabPanel>
</apex:outputPanel>
</apex:form>
</apex:page>

 

------------

I modeled this after code that was better than the Standard Lookups but inherited a few of the pesky behavors.

Such as:

-- On initial call from a populated field - populated search field with the existing field and instigating that search.

---- I wanted a full search instigated without the user clearing the search field and pressing GO.

--On Add  - not calling that specific search for selection

 

The comments are for those purposes.

 

It does, however, not show an error on add when required field is missing because it's jumping back to the search w/o  validating.  If you select the add tab again, you'll see it's still there.  I just haven't put in the error checking yet.  If that comes to you easily, you can share, but I'm not especially concerned wit it yet.

 

You'll love these processes so it's worth you debugging and sharing with me.

 

I'm glad to be able to payback for all the help you guys have given me.

 

Thanks.

  

 

 

 

Hi,

 

How to get a matrix table (like a matrix report with two grouping columns) in a visualforce page ? The matrix table should be like follwing image (colors is just for information):

 

Contractors/PLs

PL 1

PL 2

PL 3

PL 4

Contractor 1

Stage 1

Stage 1

Stage 1

 

Contractor 2

 

Stage 2

Stage 3

Stage 5

Contractor 3

 

 

Stage 4

 

Contractor 4

    

 

First line (Blue) --> get values for custom field PL__c (this is the first dimension

First column (green) --> get values for custom field Contractor__c (the the second dimension)

Content of the other cells (Orange) --> Stage__c

 

Except the top cell which will be the header (Red).

 

All the best,

 

Anzar,

Hi,

 

 

i writtn the code for a wrapper class.

 

 

my task is if there is 10 records i want to save only 4 records.first i have to select the records  by clicking check box  .after that i have to click "process selected" for saving the 4 records.so plz help.

 

 

my code

 

 

page:

 

<apex:page controller="wrapperClassController2">

<apex:form >

<apex:pageBlock >

<apex:pageBlockButtons >

<apex:commandButton value="Process Selected" action="{!processSelected}" rerender="table"/>

</apex:pageBlockButtons>

<!-- In our table we are displaying the cContact records -->

<apex:pageBlockTable value="{!contacts}" var="c" id="table">

<apex:column >

<!-- This is our selected Boolean property in our wrapper class -->

<apex:inputCheckbox value="{!c.selected}"/>

</apex:column>

<!-- This is how we access the contact values within our cContact container/wrapper -->

<apex:column value="{!c.con.Name}" />

<apex:column value="{!c.con.Email}" />

<apex:column value="{!c.con.Phone}" />

</apex:pageBlockTable>

</apex:pageBlock>

</apex:form>

</apex:page>

 

controller:

=========

 

public class wrapperClassController2 {

 

//Our collection of the class/wrapper objects cContact

public List<cContact> contactList {get; set;}

 

//This method uses a simple SOQL query to return a List of Contacts

public List<cContact> getContacts() {

if(contactList == null) {

contactList = new List<cContact>();

for(Contact c : [select Id, Name, Email, Phone from Contact limit 20]) {

// As each contact is processed we create a new cContact object and add it to the contactList

contactList.add(new cContact(c));

}

}

return contactList;

}

 

 

public PageReference processSelected() {

 

//We create a new list of Contacts that we be populated only with Contacts if they are selected

List<Contact> selectedContacts = new List<Contact>();

 

//We will cycle through our list of cContacts and will check to see if the selected property is set to true, if it is we add the Contact to the selectedContacts list

for(cContact cCon : getContacts()) {

if(cCon.selected == true) {

selectedContacts.add(cCon.con);

}

}

 

// Now we have our list of selected contacts and can perform any type of logic we want, sending emails, updating a field on the Contact, etc

System.debug('These are the selected Contacts...');

for(Contact con : selectedContacts) {

system.debug(con);

}

return null;

}

 

 

// This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the standard salesforce object Contact and a Boolean value

public class cContact {

public Contact con {get; set;}

public Boolean selected {get; set;}

 

//This is the contructor method. When we create a new cContact object we pass a Contact that is set to the con property. We also set the selected value to false

public cContact(Contact c) {

con = c;

selected = false;

}

}

}