• raj123
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 27
    Questions
  • 35
    Replies

Hi , 

 

I am trying to pass the api name of the object i what in the type for the apex:list views 

eg

where api name is the controller variable which has the api name of th eobject ex: Position__c

 

<apex:ListViews type="{!apiName}" />

 

the problem is i am not able to save this . its throwing some error like this 

 

Description Resource Path Location Type
Save error: {!apiName} does not exist listviews.page /MY DEV/src/pages line 0 Force.com save problem

 

when i just print this value in the outputtext the value is printing ,  i dont know whether we can pass the type value dynamically,  let me know about your insights. 

 

thanks. 

Actually i want to check whether if a field is of lookup type and do something if yes.

 

i tried the following 

 

String ltype='Lead';

Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
Schema.SObjectType leadSchema = schemaMap.get(ltype);

Map<String, Schema.SObjectField> lfieldMap = leadSchema.getDescribe().fields.getMap();

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

//It provides to get the object fields label.
String lfieldLabel = lfieldMap.get(fieldName).getDescribe().getLabel();

//It provides to get the object fields data type.
Schema.DisplayType lfielddataType = lfieldMap.get(fieldName).getDescribe().getType();

if(lfielddataType==Schema.DisplayType.ID)
system.debug(':::::::::::lfieldType'+lfielddataType);
system.debug(':::::::::::::::+lfieldLabel'+lfieldLabel);

}

 

but is displaying all types 

 

any suggestions

  • December 14, 2012
  • Like
  • 0

How to check whether the string contains singlequote, double quote, and blacklash (\)

 

i am not able to use the sring contains function  for these 3 things.

  • December 13, 2012
  • Like
  • 0

Hi all, i am trying to do table sort on one of the coloum , the command link i invoking the method to do the need ful and

 

the list has the sorted records but the problem is the pageblock table is not refreshing. i have added the pageblock

 

table id in the rerender, i even tried to referesh the whole form , still no help 

 

can some one tell me whats the error

 

<apex:column >
<apex:facet name="header">
<apex:commandLink action="{!flipSortOrder}" rendered="{!sortOrder == 'asc'}" rerender="contactform,conpageno,contact,pagePanelcon" > Revisit Time &#8743; </apex:commandlink>
<apex:commandLink action="{!flipSortOrder}" rendered="{!sortOrder == 'desc'}" rerender="contactform,conpageno,contact,pagePanelcon" > Revisit Time &#8744; </apex:commandlink>
</apex:facet>
<apex:outputfield value="{!con.Revisit_Time__c}">
</apex:outputfield>
</apex:column>

  • September 06, 2012
  • Like
  • 0

 

 

 

<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 folks,

 

I need help to resolve this issue urgently. 

 

I am getting this error while saving  the case after updating some fields from application , 

 

i have given CRUD access to the case object and at the field level security i have made them as editable and they are visible to this custom profile.

 

i dont know why am i getting this error. 

 

Update failed. First exception on row 0 with id 500U0000003xOv7IAE; first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id: []
  
Please help me to resolve this.
 
 

Hi Folks

 

I have an issue

 

date d = system.today().addDays(-2);
String strQuery='Select Id,Collection_Center_Code__c,RMA_Number__c,Case.Contact.Name,Contact.Email,SC_Received_Num_Boxes_WDE__c,SCReceivedPalleteID_WDE__c,SCReceivedTracking_WDE__c, SCReceivedTime_WDE__c,SCShipToWDDate_WDE__c,(Select Id,Received_Date__c From Order_Status__r where received_date__c > :d and received_date__c = null ) From Case t Where Collection_Center_Code__c =\''+Code+'\'';

 

the date variable is coming as d instead of value when i check in debug logs 

 

can some one help me with this 

thanks,

 

Unable to refresh the Force com project  components in eclipse

 

I am getting invalid operation with expired opereation, when  i try to refersh classes triggers from the server.

 

and i am getting following message when i open eclipse.

 

 

Unable to get describe object for project 'XXXX SIT'
The users password has expired, you must call SetPassword before attempting any other API operations

i have a need to Update more that 5000 records at a time, so i am storing the records in a List and updating but there is a limit that list cannot store more that 1000 rows.

 

Can any one help me with a code snippet to ccomplish this task 

 

Currently i am doing like this 

 

selectedjobs is a list of type jobwrapper

 

for(JobWrapper on : GetWrapperData())
{
if(cCon.isSelected == true)
{
selectedJobs .add(cCon.jb);
}
}

 

saving the changes

 

for(Job eq:selectedJobs)
{
Job eqsObject=new Job (Id=eq.id);
eqsObject.No=code;
lstEqRec.add(eqsObject);
}

 

updating 

if(!lstEqRec.isEmpty())
{
update lstEqRec;
}

 

The following is the code that is causing the problems.

 

<apex:outputLabel value="{!$Label.Passwaord}" style="padding-left:50px;padding-right:21px;font-weight:bold"/>
<apex:outputPanel styleClass="requiredInput" layout="inline">
<apex:outputPanel styleClass="requiredBlock" layout="inline"/>
<apex:inputSecret value="{!password}"/><br/>
</apex:outputPanel>
</apex:outputPanel>

 

i changer left padding and right padding , but its getting aligned differently in different browsers. Let me know if any one has faced this kind of problem and the fix u applied.

I have a Page Bock Table on my visualforce page which has a checkbox column, to select particular records and update. This Page also has the Pagination.

 

To Update the selected records there is a button which opens up a popup.

 

This popup has 2 buttons  one to Update and other button  "cancel" to close the popup..

 

The problem here is when  i click Cancel button on the popup the  checkboxes are not clearing up, i am clearing the selected records list inside the cancel method.

 

Cancel Method.

 

public PageReference Cancel1()
{
displayPopup = false;
//viewSortData();  // function to query and populate the table with updated values , if they update some records. 
selectedCases.clear();  // selected cases - list of wrapper class type, where is selected is a vatiable.
return null;
}

 

can someone help in clearing the checkboxes once cancel is clicked.

 

2. There is one more problem, when i select some records and update the  records that are in second or third page , as i have the pagination.

 

After the update the i am refereshing the pageblock table to reflect the changes, and it lands on  the first page after refresh with updated values, the problem here is user have to navigate to the page to see the changes made.

 

how to make it to land on the same page they have updated, so that they don't have to nagivate. 

 

 

  • April 19, 2012
  • Like
  • 0

Hi Folks, 

 

I have a problem , i have a page with the pageblock table  and each column has inline edit support,  this page also has a pagination .

 

the problem is when i am inline editing some records and clickingon the next  or previous with out saving i am getting a visualforce error

 

Visualforce Error
 


System.VisualforceException: Modified rows exist in the records collection!

 

can some one helpme getting rid of this.

 

thanks, 

  • March 14, 2012
  • Like
  • 0

i have have a search with t he datetime range,  but im not gettin the results till the end of the day , that is till 11.59 pm on the selected date , i am only getting till 12pm ( noon) ,

 

can some one help me to  edit the code to search till end of day , like how to format the selected datetime.  Thanks

  • March 13, 2012
  • Like
  • 0

Hi folk,

 

I am not getting how to unckeck the select all checkbox , which was checked to select all the records in the blage block table for the bulk update,

 

even after the bulk  update the select all check box displays as checked but its not active , how to revome this

 

i am using the following script

 

 <script type="text/javascript">
        function checkAll(cb)
        {
            var inputElem = document.getElementsByTagName("input");           
            for(var i=0; i<inputElem.length; i++)
            {    
                 if(inputElem[i].id.indexOf("checkedone")!=-1)                          
                inputElem[i].checked = cb.checked;
            }
        }
    </script>


  • March 12, 2012
  • Like
  • 0

i am not able to remove, the default value , actually i am doing the following

 

apex:pageblocksectionItem id="pgsecItm2">
                <apex:outputLabel value="To:" /><apex:inputField value="{!EndRange.Date}" id="dateorg2" onchange="populateHiddenFields()"/>
            </apex:pageblocksectionItem>

 

<script>

function populateHiddenFields()
        {
            document.getElementById('{!$Component.pg:frm:pgBlk:dateHdn}').value=document.getElementById('{!$Component.pg:frm:pgBlk:pgsec:pgsecIt:dateorg}').value; ( if i do.value='' ; the value is not getting populated.)
           
        }

<script>

 

 <apex:inputHidden id="dateHdn" value="{!strStartShipDate}"/>

 

can some one  please help me with this

  • March 09, 2012
  • Like
  • 0

i have a requirement to validate a text field which contains text in the following format 

 

XXXX-(mmddyy)todays date - 12345(5)digits or xxxxx_xxxxxx--(mmddyy)todays date - 12345(5)digits

 

 

NOT(
OR(
Formula:
LEN (XXXXXXXXXX__c) = 0,
REGEX( XXXXXXXXXXX__c , "XXXXXXXXXX-[0-9]{6}-[0-9]{5}")

 

can any one help me with the first one to check for the underscore inbetween 

thanks

  • February 14, 2012
  • Like
  • 0

I have a requirement to find no of records created monthy,

 

the input here is the date range,  start date and the end date .(start o the  month)

 

My question is how to query between these dates to get the monthly avarage of a particular field and the count no of  records created  monthly.

 

any help, code samples  would be appriciated. 

  • February 10, 2012
  • Like
  • 0

i am getting a default  todays date when the page loads in the inputfield for date, how can i remove this 

 

  <apex:outputLabel value="To:" />

<apex:inputField value="{!EndRecDate.Message_Posted__c}" id="dateorg3" onchange="populateHiddenFields()"/>

  • February 07, 2012
  • Like
  • 0

I have a requirement to compare the lastmodified date on access object ,  to the user input of no of days backs wards,  

 

i need to find whether the lastmodifieddate is less that the user input of no of days backwards from visualforce page

 

what i am doing is 

 

date d = system.today().addDays(-strNoDays);

(Select Id,last_modifieddate,Received_Date__c From  Access__c where last_modifieddate >= d and received_date__c = null)

 

i am getting Compile Error: unexpected token: 'd' at line 459 column 324  

 

Ay one has any ideas of doing this comparison

  • February 03, 2012
  • Like
  • 0

Can we select the user dynamically  for the outbound messaging, like user with particular profile only ,

 

should be able to send the outbound message and  outbound message should have  this profile user as the user in the outbound messaging.

 

Is there any workaround for this.

  • January 27, 2012
  • Like
  • 0

How to check whether the string contains singlequote, double quote, and blacklash (\)

 

i am not able to use the sring contains function  for these 3 things.

  • December 13, 2012
  • Like
  • 0

I have a custom object with contact lookup field and account lookup field, when I enter Contact I want Account lookup field to populate based on the contact (associated to only one account) to cut down on all the lookups my users need to do in this object page layout.

How can I get Id of a contact object into a custom controller class

I declared one string(decimal) variable in visualforce page (apex class). And also i taken one object with field values (all fields are number type). in visualforce page i am calling that variable name in <apex:repeat> tag,

 

here what i want is, 

 

if i given values to those varible from visualforce page, it will effect to custom object record. Means if given one value as 10.0 then one field can take that value and if i given second value it will take second field. 

 

This is nothing but, Storing values to custom fields through visualforce page. 

 

I want, how to store these type of operations?

 

please give the solution ASAP.....

 

thanks

gani

Hi

 

 

  I want  to display the current uploaded file  in VF page from content .I have created one  Library in content .It displaying the all previous Uploded files  in VF page  . we need only currently uploaded files to display  not previous files

 

Please find the below code 

 

select Id, ContentWorkspaceId, ContentDocumentId from ContentWorkspaceDoc
Where ContentWorkspaceId=:apexpages.currentpage().getparameters().get('ContentDocumentId')];

 

 

 

Please suggest ..........................

 

Thanks

 

  • November 08, 2012
  • Like
  • 0

Hi all, i am trying to do table sort on one of the coloum , the command link i invoking the method to do the need ful and

 

the list has the sorted records but the problem is the pageblock table is not refreshing. i have added the pageblock

 

table id in the rerender, i even tried to referesh the whole form , still no help 

 

can some one tell me whats the error

 

<apex:column >
<apex:facet name="header">
<apex:commandLink action="{!flipSortOrder}" rendered="{!sortOrder == 'asc'}" rerender="contactform,conpageno,contact,pagePanelcon" > Revisit Time &#8743; </apex:commandlink>
<apex:commandLink action="{!flipSortOrder}" rendered="{!sortOrder == 'desc'}" rerender="contactform,conpageno,contact,pagePanelcon" > Revisit Time &#8744; </apex:commandlink>
</apex:facet>
<apex:outputfield value="{!con.Revisit_Time__c}">
</apex:outputfield>
</apex:column>

  • September 06, 2012
  • Like
  • 0

Hi,

 

My Issue is like this i am displaying accounts and when ever i click on that account that entire ROW background color has to be set green. It is working fine but when i click on the 2nd Row the 1st Row background color should vanish.

 

But it displaying background color to all rows which ever i selected.Please fix it.

I am pasting the code here.

 

<apex:page standardController="Account" recordSetVar="act" sidebar="true" showHeader="false" wizard="false" tabStyle="Inv1__tab">
<apex:form id="accForm">
    <apex:pageBlock title="All Acounts" >
        <apex:pageMessage summary="Click on the account name" severity="info" strength="2"/>   
            <apex:pageBlockTable id="accTable" value="{!act}" var="a" onrowClick="show(this);">
                <apex:column headerValue="Account Name"><a href="#">{!a.Name}</a></apex:column>    
                <apex:column headerValue="Phone" >{!a.phone}</apex:column>
                <apex:column headerValue="Billing State/Province" >{!a.BillingState}</apex:column>
                <apex:column headerValue="Website" >{!a.Website}</apex:column>
            </apex:pageBlockTable>      
    </apex:pageBlock>
</apex:form>
<style>
.selectedDataRow {
    background-color: #ccffbb;
}
</style>
<script>
        function show(rowVar){               
        rowVar.className="selectedDataRow";
                
        }
</script>
</apex:page>

 

 

Thanks,

Bujji

  • June 07, 2012
  • Like
  • 0

I have been trying and searching for a while and I can't seem to find a way to display the Time specificly the hour and minutes from and Date time field. I would like to display the Hour and Minute from the NOW() function in salesforce formula editor. If anyone can give me some tips that would be great. Thanks.

Hi folks,

 

I need help to resolve this issue urgently. 

 

I am getting this error while saving  the case after updating some fields from application , 

 

i have given CRUD access to the case object and at the field level security i have made them as editable and they are visible to this custom profile.

 

i dont know why am i getting this error. 

 

Update failed. First exception on row 0 with id 500U0000003xOv7IAE; first error: INSUFFICIENT_ACCESS_OR_READONLY, insufficient access rights on object id: []
  
Please help me to resolve this.
 
 

Hi Folks

 

I have an issue

 

date d = system.today().addDays(-2);
String strQuery='Select Id,Collection_Center_Code__c,RMA_Number__c,Case.Contact.Name,Contact.Email,SC_Received_Num_Boxes_WDE__c,SCReceivedPalleteID_WDE__c,SCReceivedTracking_WDE__c, SCReceivedTime_WDE__c,SCShipToWDDate_WDE__c,(Select Id,Received_Date__c From Order_Status__r where received_date__c > :d and received_date__c = null ) From Case t Where Collection_Center_Code__c =\''+Code+'\'';

 

the date variable is coming as d instead of value when i check in debug logs 

 

can some one help me with this 

thanks,

 

I'm using the online Visualforce documentation to try to learn how to render a visualforce component as a PDF attachment on a visualforce email.  But, when I try creating a component exactly like the one in the documentation I get an error.  Am I missing something or is there a mistake in the documentation??

 

Here's the code I can't get to work (gray box below).  When I copy and paste it into a new visualforce component, it won't save and gives me this error message: Error: Unknown property 'account'

 

Defining a Custom Component as an Attachment

By creating a custom component and using it on the Visualforce email form and to render the PDF for the email, users can see a preview of the content they are trying to send.

The following markup defines a custom component namedattachmentthat represents the attachment for the email:
<apex:component access="global">
  <h1>Account Details</h1>
  
  <apex:panelGrid columns="2">

      <apex:outputLabel for="Name" value="Name"/>
      <apex:outputText id="Name" value="{!account.Name}"/>
      
      <apex:outputLabel for="Owner" value="Account Owner"/>
      <apex:outputText id="Owner" value="{!account.Owner.Name}"/>
      
      <apex:outputLabel for="AnnualRevenue" value="Annual Revenue"/>
      <apex:outputText id="AnnualRevenue" value="{0,number,currency}">
          <apex:param value="{!account.AnnualRevenue}"/>
      </apex:outputText>
      
      <apex:outputLabel for="NumberOfEmployees" value="Employees"/>
      <apex:outputText id="NumberOfEmployees" value="{!account.NumberOfEmployees}"/>
      
  </apex:panelGrid>
</apex:component>
Replace yourattachmentPDFpage like this:

How can I get a VF page to render in such a way that I can open it in Word?

 

I know that renderAs supports only PDF, but per this blog article (http://blog.sforce.com/sforce/2008/12/visualforce-to-excel.html), I've been playing with contentType. I've tried a few contentTypes:

 

application/vnd.ms-word

application/rtf

vnd.ms-word.document.macroEnabled.12

 

The first two (especially when used with an #filename.doc suffix) create content that can be opened in Word, but the Word document contains HTML tags.

 

The second one came from http://www.iana.org/assignments/media-types/application/index.html which has a list of valid media types. Word wouldn't open anything created with that content type.

 

How can I get a VF page to generate content that can be opened in MS Word?

 

  • March 23, 2011
  • Like
  • 0

Hey,

 

This is related to an earlier post:

http://community.salesforce.com/sforce/board/message?board.id=Visualforce&thread.id=10588

 

I am trying to make a VF data grid without knowing at compile time how many columns the grid is going to have.  Using straight HTML combined with VF markup, I have managed to do so, via the <apex:repeat> component.  Now I'm trying to take it one step further - I want to hook an actionSupport to each cell in my (one-row) grid so I can write its contents back to the controller and re-render the page (or a part of it).  A mock-up VF page and controller are as follows:

 

Page:

 

<apex:page id="mainPage" controller="testCtrlr" > <apex:form id="mainForm"> <apex:outputPanel id="clickedCell"> <apex:outputText value="Clicked : {!clickedCell}"/> <apex:actionSupport event="onclick" rerender="clickedCell"> <apex:param assignTo="{!clickedCell}" value="TEXT CLICKED {!NOW()}"/> </apex:actionSupport> </apex:outputPanel> <table> <tr> <apex:repeat value="{!rowData}" var="cell"> <td> <apex:outputPanel > <apex:outputText id="rowCell" value="{!cell}"/> <apex:actionSupport event="onclick" rerender="mainPage:mainForm:clickedCell"> <apex:param assignTo="{!clickedCell}" value="{!cell} {!NOW()}"/> </apex:actionSupport> </apex:outputPanel> </td> </apex:repeat> </tr> </table> </apex:form> </apex:page>

 

...and Controller:

 

public class testCtrlr { public String[] rowData { get { return new String[] { 'CELL 0' , 'CELL 1' , 'CELL 2' , 'CELL 3' }; } set; } public String clickedCell { get; set {
System.debug ( 'SETTING clickedCell to [' + value + ']' );
clickedCell = value;
}
} }

 

A couple of things about this don't seem to work.

  1. The resulting one-row table has four cells, containing the contents of the 'rowData' array ('CELL 0', etc.).  I would expect to be able to click on any of these cells and have its contents written into the 'clickedCell' property - and then displayed on the page thanks to the 'rerender' attribute of the 'actionSupport' component.  But what actually happens is - it only works for the right-most cell, the one containing 'CELL 3', and then only if it is the very first cell I click.  The AJAX refresh always seems to take place, according to my System Log window, but the only time the 'clickedCell's setter method is invoked is if the right-most cell is clicked the FIRST TIME, and never after for any cell.  It's as if the <apex:param> component ceases to work after the first time (and never does at all if any other cell is clicked).  I took a look at the page source and, though I don't really know what I'm looking at, it seems like all the cells have the same or similar 'onclick' directive.
  2. Notice the actionSupport attached to the 'clickedCell' outputPanel, updating the 'clickedCell' property to 'TEXT CLICKED' when you click on it.  I put that in there to demonstrate that THIS component does not have the same problem - you can click on it repeatedly and the 'clickedCell' property always gets set like it's supposed to.

Is there something I'm missing, here?  I feel like I'm <THIS> close, but not quite there.

 

Thanks, anybody who can comment on this.

 

 

  • March 05, 2009
  • Like
  • 0