• Krrish Gopal
  • NEWBIE
  • 20 Points
  • Member since 2012
  • Administrator
  • Exicom Tele-Systems Ltd.

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 23
    Replies
Hi,
I want to create a unique account(unique account name) collection variable in Salesforce flow using get record element, we have duplicate account name(multiple account with same name) and I want to skip sames name account in my collection variable.

Regards,
Krishan Gopal
Day_Activity__r(Child) --> Day_Item__r(Master)
Day_Item__r(Child) --> Kips_PJP_Weekly_Plan__c(Master)

Visualforce Page Code
Error: <apex:repeat> cannot be used inside <apex:map> in the markup

<apex:page standardController="Kips_PJP_Weekly_Plan__c">
<apex:map width="100%" height="500px" mapType="roadmap" zoomLevel="15" scrollBasedZooming="true" showOnlyActiveInfoWindow="">
<apex:repeat value="{!Kips_PJP_Weekly_Plan__c.Day_Item__r}" var="v1">
<apex:repeat value="{!v1.Day_Activity__r}" var="v2">
    <apex:mapMarker title="" position="{!v2.Geolocation__Latitude__s},{!v2.Geolocation__Longitude__s}">
            <apex:mapInfoWindow >
                <apex:outputPanel layout="block" style="font-weight: bold;">
                    <apex:outputText >{!v2.kips_Account__r.Name}
                    </apex:outputText>
                </apex:outputPanel>
            </apex:mapInfoWindow>
    </apex:mapMarker>
</apex:repeat>
</apex:repeat>
</apex:map>
</apex:page>
Disable inputfield at Visualforce page based on other inputfield picklist values

<apex:page controller="AddingCompetitorsDetailHWController" tabStyle="Account" sidebar="false"  >
<apex:pageMessages id="pgMessages" ></apex:pageMessages>
<apex:sectionheader title="Books in Use"/>
    <apex:form >
        <apex:variable var="rowNum" value="{!0}"  />
        <apex:pageBlock >
            <apex:variable var="rowNum" value="{!0}"  />  
            <apex:pageBlockTable value="{!interestList}" var="int" title="Competitor Analysis">
                <apex:facet name="footer">
                    <apex:commandLink value="Add More Class" action="{!insertRow}"/>
                </apex:facet>

                        <apex:column headerValue="Class">
                            <apex:inputField value="{!int.Kips_Class__c}" required="true"/>
                        </apex:column>
                        
                        <apex:column headerValue="Valid Data">
                            <apex:inputField value="{!int.Kips_Valid_Data__c}" required="true"/>
                        </apex:column>
                        
                        <apex:column headerValue="Publisher">
                            <apex:inputfield value="{!int.kips_Publisher__c}" required="true"/>
                        </apex:column>

                        <apex:column headerValue="Other Publisher Name">
                            <apex:inputfield value="{!int.Kips_Other_Publisher__c}"/>
                        </apex:column>                         

                        <apex:column headerValue="Other Publisher Title Name">
                            <apex:inputfield value="{!int.Other_Book_Title__c}"/>
                        </apex:column>                         

                        <apex:column headerValue="Subject">
                            <apex:inputfield value="{!int.Subject__c}" required="true"/>
                        </apex:column>

                        <apex:column headerValue="Series">
                            <apex:inputfield value="{!int.Series__c}" required="true"/>
                        </apex:column>

                        <apex:column headerValue="Title" >
                            <apex:inputfield value="{!int.Headword_Book_Title__c}" required="true"/>
                        </apex:column>                  

                        <apex:column headerValue="Reason">
                            <apex:inputfield value="{!int.Reason_v2__c}" required="true"/>
                        </apex:column>                         

                        <apex:column headerValue="Other Reason">
                            <apex:inputfield value="{!int.Other_Reason__c}" />
                        </apex:column>                         

                <apex:column headerValue="Action" >
                    <apex:commandLink style="font-size:15px; font-weight:bold; text-align:center;color:red;" value="X" action="{!delRow}">
                        <apex:param value="{!rowNum}" name="index" />
                    </apex:commandLink>
                    <apex:variable var="rowNum" value="{!rowNum+1}"/>
                </apex:column>          
            </apex:pageBlockTable>
            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!insertIntests}"/>&nbsp;
                <apex:commandButton value="Canncel" action="{!Cancel}" immediate="true"/>&nbsp;
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>
                  
User-added image
 I have a custom lookup filed Asset__c  at custom object Service_Report__c.  Service_Report__c is a child object of standard case object i.e. case is parent of Service_Report__c
Now I want to write a apex trigger to update InstallDate and Site__c fields at asset when Asset__c!=null, when I create and update record at custom object  Service_Report__c.
 InstallDate(asset) = Date_of_Site_Visit_To__c(custom lookup field at Service_Report__c)
 Site__c(custom lookup field at asset) =  Site__c(custom lookup field at case)
 Asset object fields: InstallDate(Standard field),  Site__c(lookup)
 Service_Report__c  object fields: Case__c(lookup), Asset__c(lookup), Date_of_Site_Visit_To__c(date field)
 Case object fields: Site__c(lookup)
I created a Visualforce page to override the standard case view page. I have a custom button "OnlineClosed" on case object that ask for a remark and update 2 field status and stage at case object. The button works fine on the standard case view page, but not at my visualforce page. Does anyone have any idea why this button does not working on the visualforce page? When I click on it, I get a error message "URL No Longer Exists".
 
About Custom Button 
Behavior: Execute JavaScript and Content Source: OnClick JavaScript.
 
{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/33.0/apex.js")}
var url = parent.location.href; 
var updateRecord = new Array(); 
var myquery = "SELECT Id FROM Case WHERE Id = '{!Case.Id}' limit 1"; 
var reason = prompt("Enter reason", ""); 
result = sforce.connection.query(myquery); 
records = result.getArray("records"); 
if(records[0]) 
{ 
var update_Case = records[0]; 
update_Case.Status = "Closed"; 
update_Case.Stage__c= "Resolved"; 
update_Case.Remark__c= reason; 
updateRecord.push(update_Case); 
} 
result = sforce.connection.update(updateRecord); 
parent.location.href = url;

Code for Button on VisualForce page is below.
<apex:commandButton action="{!URLFOR($Action.Case.OnlineClosed,Case.id)}" value="Online Closed"/>

Hi,
I wanted to confirm it is possible to display the Field_Service_Report__r(custom object), 
Notes and Attachments, OpenActivities and other related list on a VF page that is being accessed via guset user at saleforce site, in admin mode it works fine.

My VF Page
<apex:page action="{!CheckSession}"  controller="CaseDetailController" showHeader="true" cache="false" sidebar="true" tabStyle="Case">
    <chatter:feedwithfollowers entityId="{!objcase.Id}"/>
    <apex:form >
        <apex:pageblock mode="maindetail" title="Case Detail">
            <apex:outputpanel >
                <apex:pageblocksection title="Case Information" showheader="true" collapsible="true" columns="2">
                    <apex:outputfield value="{!objcase.CaseNumber}"/>
                    <apex:outputfield value="{!objcase.OwnerId}"/>
                    <apex:outputfield value="{!objcase.Origin}"/>
                    <apex:outputfield value="{!objcase.Priority}"/>
                    <apex:outputfield value="{!objcase.Status}"/>
                    <apex:outputfield value="{!objcase.Stage__c}"/>
                    <apex:outputfield value="{!objcase.Type}"/>
                    <apex:outputfield value="{!objcase.Reason}"/>
                    <apex:outputfield value="{!objcase.CreatedDate}"/>
                    <apex:outputfield value="{!objcase.ClosedDate}"/>
                    <apex:outputfield value="{!objcase.Site__c}"/>
                    <apex:outputfield value="{!objcase.AssetId}"/>
                    <apex:outputfield value="{!objcase.AccountId}"/>
                    <apex:outputfield value="{!objcase.ParentId}"/>
                    <apex:outputfield value="{!objcase.Is_Expenses_Claimed__c}"/>
                </apex:pageblocksection>
                <apex:pageblocksection title="Contact Detail" showheader="true" collapsible="true" columns="2">
                    <apex:outputfield value="{!objcase.ContactId}"/>
                    <apex:outputfield value="{!objcase.Contact.Phone}"/>
                    <apex:outputfield value="{!objcase.Contact.MobilePhone}"/>
                    <apex:outputfield value="{!objcase.Contact.Email}"/>
                    <apex:outputfield value="{!objcase.Contact.Fax}"/>
                </apex:pageblocksection>
                <apex:pageblocksection title="Description Information" showheader="true" collapsible="true" columns="1">
                    <apex:outputfield value="{!objcase.Subject}"/>
                    <apex:outputfield value="{!objcase.Description}"/>
                </apex:pageblocksection>
                <apex:pageblocksection title="Web Information" showheader="true" collapsible="true" columns="2">
                    <apex:outputfield value="{!objcase.SuppliedCompany}"/>
                    <apex:outputfield value="{!objcase.SuppliedEmail}"/>
                    <apex:outputfield value="{!objcase.SuppliedName}"/>
                    <apex:outputfield value="{!objcase.SuppliedPhone}"/>
                </apex:pageblocksection>
                <apex:pageblocksection title="I&C Detail" showheader="true" collapsible="true" columns="2">
                    <apex:outputfield value="{!objcase.P_O_Number_I_C__c}"/>
                    <apex:outputfield value="{!objcase.P_O_Date_I_C__c}"/>
                </apex:pageblocksection>
                <apex:pageblocksection title="Case Assignment" showheader="true" collapsible="true" columns="2">
                    <apex:outputfield value="{!objcase.Service_Center__c}"/>
                    <apex:outputfield value="{!objcase.Engineer_Vendor__c}"/>
                </apex:pageblocksection>
                <apex:pageblocksection title="System Information" showheader="true" collapsible="true" columns="2">
                        <apex:outputfield value="{!objcase.CreatedById}"/>
                        <apex:outputfield value="{!objcase.CreatedDate}" id="createddate" label="Created Date"/>
                        <apex:outputfield value="{!objcase.LastModifiedById}"/>
                        <apex:outputfield value="{!objcase.LastModifiedDate}"/>
                </apex:pageblocksection>
            </apex:outputpanel>
        </apex:pageblock>
</apex:form>
<apex:relatedList subject="{!$CurrentPage.parameters.Id}" list="Field_Service_Report__r"/>
<apex:relatedList subject="{!$CurrentPage.parameters.Id}" list="CombinedAttachments"/>
 <apex:relatedList subject="{!$CurrentPage.parameters.Id}" list="OpenActivities"/>
 <c:CaseComments CasesId="{!objcase.Id}"/>
 <c:CaseHistory CasesId="{!objcase.Id}"/>
 </apex:page>
 
My APEX Controller

public class CaseDetailController 
{
   public case objcase{get;set;}
   public CaseDetailController ()
   {    
       
   }
   public pageReference CheckSession()
   {
             objcase = new case();
             objcase = [SELECT AccountId,AssetId,BusinessHoursId,CaseNumber,ClosedDate,CommunityId,ContactId,Contact.Name,Contact.Phone,Contact.MobilePhone,Contact.Email,Contact.Fax,CreatedById,CreatedDate,Created_By__c,CreatorFullPhotoUrl,CreatorName,CreatorSmallPhotoUrl,Description,Engineer_Vendor__c,HasCommentsUnreadByOwner,HasSelfServiceComments,Id,Invoice_Date__c,Invoice_Number__c,IsClosed,IsDeleted,IsEscalated,Is_Expenses_Claimed__c,LastModifiedById,LastModifiedDate,LastReferencedDate,LastViewedDate,Origin,Other_Problem_Reported__c,OwnerId,ParentId,Priority,Problem_Reported__c,P_O_Date_I_C__c,P_O_Number_I_C__c,Reason,Remark__c,Service_Center__c,Site__c,SLAViolation__c,Stage__c,Status,Subject,SuppliedCompany,SuppliedEmail,SuppliedName,SuppliedPhone,SystemModstamp,Type FROM Case where id=:apexpages.currentpage().getparameters().get('id') limit 1];
       return null;
   }
   
}

 
My Visualforce Page is CaseListView

<apex:page controller="displaycase" title="Exicom Engineer Portal">
 <apex:form id="frm">
 <apex:pageBlock title="Search for cases based on criteria">
 <table width="100%">
  <tr>
     <td width="25%"><strong>Status  </strong>
        <apex:selectList size="1" value="{!getcasestatus}">
        <apex:selectOptions value="{!cstatus}"> </apex:selectOptions>
        </apex:selectList>
     </td>
     <td width="25%"><strong>Type  </strong>
        <apex:selectList size="1" value="{!getcasetype}">
        <apex:selectOptions value="{!ctype}"> </apex:selectOptions>
        </apex:selectList>
     </td>
     <td width="25%"><strong>Reason  </strong>
        <apex:selectList size="1" value="{!getcasereason}">
        <apex:selectOptions value="{!creason}"> </apex:selectOptions>
        </apex:selectList>       
     </td>
     <td width="15%"><strong>Priority  </strong>
        <apex:selectList size="1" value="{!getcasepriority}">
        <apex:selectOptions value="{!cpriority}"> </apex:selectOptions>
        </apex:selectList>      
     </td>
     <td width="10%">
        <apex:commandButton value="Search" action="{!displaycaselist}"/>       
     </td>
  </tr>
 </table>
 </apex:pageBlock>
 <apex:pageBlock title="Search a particular case">
 <apex:pageBlockSection columns="2">
 <apex:inputText value="{!getcasenumber}" label="Case Number"/>
 <apex:commandButton value="Search" action="{!searchcaselist}"/>
 </apex:pageBlockSection>
 </apex:pageBlock>
 </apex:form>
 <c:GenericPaginationComponent Records="{!caselst}" Fields="{!cseFieldLst}" Title="Search Result"/>
</apex:page>
My Apex Class is displaycase

public class displaycase {

public string getcasestatus{get;set;}
public string getcasenumber{get;set;}
public string getcasetype{get;set;}
public string getcasereason{get;set;}
public string getcasepriority{get;set;}

public  void displaycase ()
{
    getcasestatus='';
    getcasetype= '';
    getcasereason= '';
    getcasepriority= '';
    
}
public List<Case> caselst{get;set;}
public List<String> cseFieldLst {get;set;}


public list<selectoption>getcstatus()
{
    list<selectoption>selectopts=new list<selectoption>();
    selectopts.add(new selectoption('',''));
    selectopts.add(new selectoption('Open','Open'));
    selectopts.add(new selectoption('Closed','Closed'));
    selectopts.add(new selectoption('Rejected','Rejected'));
    return selectopts;
}

public list<selectoption>getctype()
{
    list<selectoption>selectoptt=new list<selectoption>();
    selectoptt.add(new selectoption('',''));    
    selectoptt.add(new selectoption('Out of Warranty','Out of Warranty'));
    selectoptt.add(new selectoption('Under AMC','Under AMC'));
    selectoptt.add(new selectoption('Under Warranty','Under Warranty'));
    return selectoptt;
}

public list<selectoption>getcreason()
{
    list<selectoption>selectoptr=new list<selectoption>();
    selectoptr.add(new selectoption('',''));    
    selectoptr.add(new selectoption('Acceptance Testing','Acceptance Testing'));
    selectoptr.add(new selectoption('Breakdown','Breakdown'));
    selectoptr.add(new selectoption('Equipment Complexity','Equipment Complexity'));
    selectoptr.add(new selectoption('Equipment Design','Equipment Design'));
    selectoptr.add(new selectoption('Exceptional','Exceptional'));
    selectoptr.add(new selectoption('Feedback','Feedback'));
    selectoptr.add(new selectoption('Installation','Installation'));
    selectoptr.add(new selectoption('Job Warranty','Job Warranty'));
    selectoptr.add(new selectoption('Other','Other'));
    selectoptr.add(new selectoption('Paid Repair','Paid Repair'));
    selectoptr.add(new selectoption('Performance','Performance'));
    selectoptr.add(new selectoption('Preventive Maintenance','Preventive Maintenance'));    
    return selectoptr;
}

public list<selectoption>getcpriority()
{
    list<selectoption>selectoptp=new list<selectoption>();
    selectoptp.add(new selectoption('',''));
    selectoptp.add(new selectoption('Major','Major'));
    selectoptp.add(new selectoption('Minor','Minor'));
    selectoptp.add(new selectoption('Critical','Critical'));
    return selectoptp;
}

public void displaycaselist()
{
    caselst=new list<case>();
    cseFieldLst=new list<string>();

    String query = 'select CaseNumber,CreatedDate,ClosedDate,IsClosed,IsEscalated,Priority,Reason,Status,Type FROM Case where id !=NULL ';

    if(getcasestatus!=null){
       query+=' and Status=\''+getcasestatus+'\'';
    }
    if(getcasetype!=null){
       query+=' and Type=\''+getcasetype+'\'';
    }
    if(getcasereason!=null){
       query+=' and Reason=\''+getcasereason+'\'';
    }
    if(getcasepriority!=null){
       query+=' and priority=\''+getcasepriority+'\'';
    }

    caselst=Database.query(query+=' ORDER BY CreatedDate DESC');
    cseFieldLst = new List<String>{'CaseNumber','CreatedDate','ClosedDate','IsClosed','IsEscalated','Priority','Reason','Status','Type'};
    
}

public void searchcaselist()
{   
    caselst=new list<case>();
    cseFieldLst=new list<string>();
    if(getcasenumber!=null){
       caselst=Database.query('select CaseNumber,CreatedDate,ClosedDate,IsClosed,IsEscalated,Priority,Reason,Status,Type FROM Case where CaseNumber like \'%'+getcasenumber+'%\' ORDER BY CreatedDate DESC');
       cseFieldLst = new List<String>{'CaseNumber','CreatedDate','ClosedDate','IsClosed','IsEscalated','Priority','Reason','Status','Type'};
    }    
}
}
 
My Visualforce component is  GenericPaginationComponent
<apex:component controller="GenericPaginationComponentContrl">
  
  <!-- Attributes to accept the parameters -->
  <apex:attribute name="Records" Type="Sobject[]" assignTo="{!sObjLst}" required="true" description="Accepts list of records of any object and assign to a variable in controller class"/>
  <apex:attribute name="Fields" Type="String[]" required="true" description="Accepts list of field API names of a sobject in string format"/>
  <apex:attribute name="Title" Type="String" required="true" description="Accepts the title of the section"/>
  
  <!-- Table which displays records along with pagination -->
  <apex:form >
      <apex:pageBlock >
          <apex:pageBlockSection columns="1" title="{!Title}" id="pbSec">
              <apex:pageBlockTable value="{!SobjRecords}" var="sObj">
                  <!-- Dispalys the multiple columns based on the user input -->
                  <apex:repeat value="{!Fields}" var="fld">
                      <apex:column value="{!sObj[fld]}"/>
                  </apex:repeat>
              </apex:pageBlockTable>
              <!-- Dispalys pagination buttons -->
              <apex:panelGrid columns="5">
                  <apex:commandButton value="|<" action="{!con.first}" disabled="{!!con.hasPrevious}" status="pagStatus" reRender="pbSec" title="First"/>
                  <apex:commandButton value="<" action="{!con.previous}" disabled="{!!con.hasPrevious}" status="pagStatus" reRender="pbSec" title="Previouse"/>
                  <apex:commandButton value=">" action="{!con.next}" disabled="{!!con.hasNext}" status="pagStatus" reRender="pbSec" title="Next"/>
                  <apex:commandButton value=">|" action="{!con.last}" disabled="{!!con.hasNext}" status="pagStatus" reRender="pbSec" title="Last"/>
                  <apex:actionStatus startText="Fetching..." id="pagStatus"/>
              </apex:panelGrid>
          </apex:pageBlockSection>
      </apex:pageBlock>
  </apex:form>
</apex:component>
 
My visualforce component class is GenericPaginationComponentContrl
public class GenericPaginationComponentContrl {
  //Stores the records which are supplied to the 'Records' attribute.
  public Sobject[] sObjLst {get;set;}
  /*
   1. Implementing the pagination with ApexPages.StandardSetController.
   2. We can utilize the built in methods available for the ApexPages.StandardSetController to build the pagination.
   3. Following are the built in mehods we can utilize -
    a. first()
    b. previous()
    c. next()
    d. last()
    e. getHasPrevious() - returns boolean value.
    f. getHasNext() - returns boolean value.
    g. setPageSize(IntegerValue)
  */
  public ApexPages.StandardSetController con {
   get {
    //initializing con with the records.
    if(con == null)
     con = new ApexPages.StandardSetController(sObjLst);
    //Setting the pagination size
    con.setPageSize(5);
    return con;
   }
   set;
  }
  //Method which returns subset of records from the sObjLst.
  public List<sobject> getSobjRecords() {        
   //Type Casing the records and returning to display on the page.
   return (List<sobject>)con.getRecords();
  }
 }

 

Apex Class
public class displaycase {
public string getcasetype{get;set;}
public  void displaycase ()
{
    
}
public list<case> caselst{get;set;}


public list<selectoption>getcasestatus()
{
    list<selectoption>selectopt=new list<selectoption>();
    selectopt.add(new selectoption('Open','Open'));
    selectopt.add(new selectoption('Closed','Closed'));
    return selectopt;
}
public void displaycaselist()
{
    caselst=new list<case>();
   caselst=[SELECT CaseNumber,ClosedDate,IsClosed,IsEscalated,Priority,Reason,Status,Subject,Type FROM Case where status=:getcasetype];
}
}
Visualforce page
<apex:page controller="displaycase">
 <apex:form id="frm">
 <apex:selectList size="1" value="{!getcasetype}" >
 <apex:selectOptions value="{!casestatus}"> </apex:selectOptions>
 <apex:actionSupport event="onchange" action="{!displaycaselist}"/>
 </apex:selectList>
 <apex:outputLabel id="pnl1" >
 <apex:pageBlock >
 <apex:pageBlockTable value="{!caselst}" var="cse">
 <apex:column >
      <apex:outputLink value="/apex/TabbedVisualforcePage?Id={!cse.id}">{!cse.CaseNumber}</apex:outputLink>
 </apex:column>
 <apex:column value="{!cse.Subject}"/>
 <apex:column value="{!cse.Type}"/>
 <apex:column value="{!cse.Priority}"/>
 <apex:column value="{!cse.Reason}"/>
 <apex:column value="{!cse.Status}"/>
 <apex:column value="{!cse.IsEscalated}"/>
 <apex:column value="{!cse.IsClosed}"/>
 <apex:column value="{!cse.ClosedDate}"/>
 </apex:pageBlockTable>
 </apex:pageBlock>
 </apex:outputLabel>
 </apex:form>
</apex:page>
Page shown list of cases successfully but when I'm trying to click on case number, code through an Authorization Required error.
 
Hi I am trying to implement this to show case history through GenericHistoryComponent and GenericHistoryComponentController at my visualforce page through below metion syntex :

<apex:tab label="Case Histories" name="GenericHistoryComponent">
         <c:GenericHistoryComponent recordLimits="50" myObjects="{!Case.Id}"/>
</apex:tab>

Once I clicked on a particular case I got a Visualforce error msg "Cannot convert the value of '{!myObject}' to the expected type".

if use below mention attrubute syntex in GenericHistoryComponent code

<apex:attribute name="myObjects" type="SObject" description="Object we wish to view the history of" required="true" assignTo="{!myObject}" />
<apex:attribute name="recordLimits" description="Number of lines of history to display" type="Integer" required="false" assignTo="{!recordLimit}" />

Please help

Hi,

 

I created the Custom object named by Tool__c and Toolkit_Lineitem__c, now i'm trying to create a custom button to generate a pdf. I create a visualforce for the same but when i save,  i have an error msg:

 

 Invalid field Tool_Lineitem__r for SObject Tool__c error

 

pls help to resolve this issue.

 

<apex:page standardController="Tool__c" title="Tool" renderAs="pdf">

<apex:form >
<head>
<style>
@page
{
size:portrait;
margin:0.20in;
}
.cellfontsize
{
font-family:calibri;
font-size:6px;
}
.cellheaderfontsize
{
font-family:Calibri;
font-size:12px;
}
</style>
</head>

<table border="0" width="100%">
<tr>
<td style="width:50%;"><apex:image url="https://krishan4184-dev-ed.my.salesforce.com/06990000000Am45" height="50" width="150"/> </td>
<td style="text-align:right;">
<span style="color:#000000;font-weight:bold;font-family:Calibri;font-size:16px;margin-left:100px;float:right;margin-top:20px;">
Exicom Tele-Systems
</span>

</td>
<hr/>
<br/>
<div style="font-size:10px;font-family:calibri;">
<center><b>D-194,3RD FLOOR, OKHLA INDUSTRIAL AREA, PHASE-I NEW DELHI-110022</b></center>
<center><b>Tel No.: 011-46601363, 46601364</b></center>
<br/>
<center><b><u>DELIVERY CHALLAN / GATE PASS</u></b></center>
</div>
</tr>
<br/>
<div style="float:left;font-family:calibri;font-size:14px;"><b>To,</b></div><div style="float:right;font-family:calibri;font-size:14px;"><b> DC / GP No.</b> &nbsp;{!Tool__c.Gate_Pass__c}</div><br/><br/>
<div style="float:left;font-family:calibri;font-size:14px;"><b>The Security Officer</b></div><div style="float:right;font-family:calibri;font-size:14px;"><b>Date</b>&nbsp;<apex:outputText value="{0,date,dd'/'MM'/'yyyy}">
<apex:param value="{!Tool__c.Date__c}"/>
</apex:outputText></div><br/><br/>

</table>
<br/>
<br/>
<div style="font-family:calibri;font-size:14px;">
Issued From : {!Tool__c.From__c} <div style="float:right;text-align:left;">Dept.: {!Tool__c.Department__c}</div><br/>
Dispatched To : {!Tool__c.Dispatch_To__c}<div style="float:right;text-align:right;">&nbsp;Ref No.: {!Tool__c.Gate_Pass__c} </div>
<br/> Please allow M/s &nbsp;&nbsp;<b>{!Tool__c.Engineer_Name__c}</b>&nbsp;to take out the following items:</div>
<br></br>
<table border="1" cellspacing="0" cellpadding="2" align="center" width="100%">
<tr>
<td class="cellheaderfontsize">
<b>S.No.</b>
</td >
<td class="cellheaderfontsize">
<b>Particular</b>
</td>
<td class="cellheaderfontsize">
<b>Description</b>
</td>
<td class="cellheaderfontsize">
<b>Quantity</b>
</td>
<td class="cellheaderfontsize">
<b>Remark</b>
</td>
</tr>
<apex:variable var="call" value="{!0}" />
<apex:repeat var="v" value="{!Tool__c.Tool_Lineitem__r}">
<apex:variable var="call" value="{!call+1}"/>
<tr>
<td style="font-family:calibri;font-size:12px;">
{!ROUND(call,0)}
</td>
<td style="font-family:calibri;font-size:12px;">
{!v.Particular__c}
</td>
<td style="font-family:calibri;font-size:12px;">
{!v.Description__c}
</td>
<td style="font-family:calibri;font-size:12px;">
{!ROUND(v.Quantity__c,0)}
</td>
<td style="font-family:calibri;font-size:12px;">
{!v.Remark__c}
</td>
</tr>
</apex:repeat>
</table>
<br/>

<div style="float:left;font-family:calibri;font-size:12px;"><b>Receipt By</b></div><div style="justify;float:right;font-family:calibri;font-size:12px;"> <b>HOD / Competent Authority </b></div><br/><br/>
<div style="font-family:calibri;font-size:14px;">Confirmation : I confirm the receipt of above mentioned material by me or by Mr. .................................. subject to
discrepancies mentioned in the receivers column, if any found by the receiver.<br/><br/></div>

<div style="page-break-after:always;font-family:calibri;font-size:12px;"> Receiver's Signature............................ &amp; Date ...........................<br/><br/>
Receiver's Name.............................</div>
</apex:form>
</apex:page>

Hi,
I want to create a unique account(unique account name) collection variable in Salesforce flow using get record element, we have duplicate account name(multiple account with same name) and I want to skip sames name account in my collection variable.

Regards,
Krishan Gopal
Hello All,

Can some one help me to Sending an email notification to Admin whenever a field is created or deleted for a custom object in salesforce?

Thanks in advance
 I have a custom lookup filed Asset__c  at custom object Service_Report__c.  Service_Report__c is a child object of standard case object i.e. case is parent of Service_Report__c
Now I want to write a apex trigger to update InstallDate and Site__c fields at asset when Asset__c!=null, when I create and update record at custom object  Service_Report__c.
 InstallDate(asset) = Date_of_Site_Visit_To__c(custom lookup field at Service_Report__c)
 Site__c(custom lookup field at asset) =  Site__c(custom lookup field at case)
 Asset object fields: InstallDate(Standard field),  Site__c(lookup)
 Service_Report__c  object fields: Case__c(lookup), Asset__c(lookup), Date_of_Site_Visit_To__c(date field)
 Case object fields: Site__c(lookup)
I created a Visualforce page to override the standard case view page. I have a custom button "OnlineClosed" on case object that ask for a remark and update 2 field status and stage at case object. The button works fine on the standard case view page, but not at my visualforce page. Does anyone have any idea why this button does not working on the visualforce page? When I click on it, I get a error message "URL No Longer Exists".
 
About Custom Button 
Behavior: Execute JavaScript and Content Source: OnClick JavaScript.
 
{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/33.0/apex.js")}
var url = parent.location.href; 
var updateRecord = new Array(); 
var myquery = "SELECT Id FROM Case WHERE Id = '{!Case.Id}' limit 1"; 
var reason = prompt("Enter reason", ""); 
result = sforce.connection.query(myquery); 
records = result.getArray("records"); 
if(records[0]) 
{ 
var update_Case = records[0]; 
update_Case.Status = "Closed"; 
update_Case.Stage__c= "Resolved"; 
update_Case.Remark__c= reason; 
updateRecord.push(update_Case); 
} 
result = sforce.connection.update(updateRecord); 
parent.location.href = url;

Code for Button on VisualForce page is below.
<apex:commandButton action="{!URLFOR($Action.Case.OnlineClosed,Case.id)}" value="Online Closed"/>

Hi,
I wanted to confirm it is possible to display the Field_Service_Report__r(custom object), 
Notes and Attachments, OpenActivities and other related list on a VF page that is being accessed via guset user at saleforce site, in admin mode it works fine.

My VF Page
<apex:page action="{!CheckSession}"  controller="CaseDetailController" showHeader="true" cache="false" sidebar="true" tabStyle="Case">
    <chatter:feedwithfollowers entityId="{!objcase.Id}"/>
    <apex:form >
        <apex:pageblock mode="maindetail" title="Case Detail">
            <apex:outputpanel >
                <apex:pageblocksection title="Case Information" showheader="true" collapsible="true" columns="2">
                    <apex:outputfield value="{!objcase.CaseNumber}"/>
                    <apex:outputfield value="{!objcase.OwnerId}"/>
                    <apex:outputfield value="{!objcase.Origin}"/>
                    <apex:outputfield value="{!objcase.Priority}"/>
                    <apex:outputfield value="{!objcase.Status}"/>
                    <apex:outputfield value="{!objcase.Stage__c}"/>
                    <apex:outputfield value="{!objcase.Type}"/>
                    <apex:outputfield value="{!objcase.Reason}"/>
                    <apex:outputfield value="{!objcase.CreatedDate}"/>
                    <apex:outputfield value="{!objcase.ClosedDate}"/>
                    <apex:outputfield value="{!objcase.Site__c}"/>
                    <apex:outputfield value="{!objcase.AssetId}"/>
                    <apex:outputfield value="{!objcase.AccountId}"/>
                    <apex:outputfield value="{!objcase.ParentId}"/>
                    <apex:outputfield value="{!objcase.Is_Expenses_Claimed__c}"/>
                </apex:pageblocksection>
                <apex:pageblocksection title="Contact Detail" showheader="true" collapsible="true" columns="2">
                    <apex:outputfield value="{!objcase.ContactId}"/>
                    <apex:outputfield value="{!objcase.Contact.Phone}"/>
                    <apex:outputfield value="{!objcase.Contact.MobilePhone}"/>
                    <apex:outputfield value="{!objcase.Contact.Email}"/>
                    <apex:outputfield value="{!objcase.Contact.Fax}"/>
                </apex:pageblocksection>
                <apex:pageblocksection title="Description Information" showheader="true" collapsible="true" columns="1">
                    <apex:outputfield value="{!objcase.Subject}"/>
                    <apex:outputfield value="{!objcase.Description}"/>
                </apex:pageblocksection>
                <apex:pageblocksection title="Web Information" showheader="true" collapsible="true" columns="2">
                    <apex:outputfield value="{!objcase.SuppliedCompany}"/>
                    <apex:outputfield value="{!objcase.SuppliedEmail}"/>
                    <apex:outputfield value="{!objcase.SuppliedName}"/>
                    <apex:outputfield value="{!objcase.SuppliedPhone}"/>
                </apex:pageblocksection>
                <apex:pageblocksection title="I&C Detail" showheader="true" collapsible="true" columns="2">
                    <apex:outputfield value="{!objcase.P_O_Number_I_C__c}"/>
                    <apex:outputfield value="{!objcase.P_O_Date_I_C__c}"/>
                </apex:pageblocksection>
                <apex:pageblocksection title="Case Assignment" showheader="true" collapsible="true" columns="2">
                    <apex:outputfield value="{!objcase.Service_Center__c}"/>
                    <apex:outputfield value="{!objcase.Engineer_Vendor__c}"/>
                </apex:pageblocksection>
                <apex:pageblocksection title="System Information" showheader="true" collapsible="true" columns="2">
                        <apex:outputfield value="{!objcase.CreatedById}"/>
                        <apex:outputfield value="{!objcase.CreatedDate}" id="createddate" label="Created Date"/>
                        <apex:outputfield value="{!objcase.LastModifiedById}"/>
                        <apex:outputfield value="{!objcase.LastModifiedDate}"/>
                </apex:pageblocksection>
            </apex:outputpanel>
        </apex:pageblock>
</apex:form>
<apex:relatedList subject="{!$CurrentPage.parameters.Id}" list="Field_Service_Report__r"/>
<apex:relatedList subject="{!$CurrentPage.parameters.Id}" list="CombinedAttachments"/>
 <apex:relatedList subject="{!$CurrentPage.parameters.Id}" list="OpenActivities"/>
 <c:CaseComments CasesId="{!objcase.Id}"/>
 <c:CaseHistory CasesId="{!objcase.Id}"/>
 </apex:page>
 
My APEX Controller

public class CaseDetailController 
{
   public case objcase{get;set;}
   public CaseDetailController ()
   {    
       
   }
   public pageReference CheckSession()
   {
             objcase = new case();
             objcase = [SELECT AccountId,AssetId,BusinessHoursId,CaseNumber,ClosedDate,CommunityId,ContactId,Contact.Name,Contact.Phone,Contact.MobilePhone,Contact.Email,Contact.Fax,CreatedById,CreatedDate,Created_By__c,CreatorFullPhotoUrl,CreatorName,CreatorSmallPhotoUrl,Description,Engineer_Vendor__c,HasCommentsUnreadByOwner,HasSelfServiceComments,Id,Invoice_Date__c,Invoice_Number__c,IsClosed,IsDeleted,IsEscalated,Is_Expenses_Claimed__c,LastModifiedById,LastModifiedDate,LastReferencedDate,LastViewedDate,Origin,Other_Problem_Reported__c,OwnerId,ParentId,Priority,Problem_Reported__c,P_O_Date_I_C__c,P_O_Number_I_C__c,Reason,Remark__c,Service_Center__c,Site__c,SLAViolation__c,Stage__c,Status,Subject,SuppliedCompany,SuppliedEmail,SuppliedName,SuppliedPhone,SystemModstamp,Type FROM Case where id=:apexpages.currentpage().getparameters().get('id') limit 1];
       return null;
   }
   
}

 
My Visualforce Page is CaseListView

<apex:page controller="displaycase" title="Exicom Engineer Portal">
 <apex:form id="frm">
 <apex:pageBlock title="Search for cases based on criteria">
 <table width="100%">
  <tr>
     <td width="25%"><strong>Status  </strong>
        <apex:selectList size="1" value="{!getcasestatus}">
        <apex:selectOptions value="{!cstatus}"> </apex:selectOptions>
        </apex:selectList>
     </td>
     <td width="25%"><strong>Type  </strong>
        <apex:selectList size="1" value="{!getcasetype}">
        <apex:selectOptions value="{!ctype}"> </apex:selectOptions>
        </apex:selectList>
     </td>
     <td width="25%"><strong>Reason  </strong>
        <apex:selectList size="1" value="{!getcasereason}">
        <apex:selectOptions value="{!creason}"> </apex:selectOptions>
        </apex:selectList>       
     </td>
     <td width="15%"><strong>Priority  </strong>
        <apex:selectList size="1" value="{!getcasepriority}">
        <apex:selectOptions value="{!cpriority}"> </apex:selectOptions>
        </apex:selectList>      
     </td>
     <td width="10%">
        <apex:commandButton value="Search" action="{!displaycaselist}"/>       
     </td>
  </tr>
 </table>
 </apex:pageBlock>
 <apex:pageBlock title="Search a particular case">
 <apex:pageBlockSection columns="2">
 <apex:inputText value="{!getcasenumber}" label="Case Number"/>
 <apex:commandButton value="Search" action="{!searchcaselist}"/>
 </apex:pageBlockSection>
 </apex:pageBlock>
 </apex:form>
 <c:GenericPaginationComponent Records="{!caselst}" Fields="{!cseFieldLst}" Title="Search Result"/>
</apex:page>
My Apex Class is displaycase

public class displaycase {

public string getcasestatus{get;set;}
public string getcasenumber{get;set;}
public string getcasetype{get;set;}
public string getcasereason{get;set;}
public string getcasepriority{get;set;}

public  void displaycase ()
{
    getcasestatus='';
    getcasetype= '';
    getcasereason= '';
    getcasepriority= '';
    
}
public List<Case> caselst{get;set;}
public List<String> cseFieldLst {get;set;}


public list<selectoption>getcstatus()
{
    list<selectoption>selectopts=new list<selectoption>();
    selectopts.add(new selectoption('',''));
    selectopts.add(new selectoption('Open','Open'));
    selectopts.add(new selectoption('Closed','Closed'));
    selectopts.add(new selectoption('Rejected','Rejected'));
    return selectopts;
}

public list<selectoption>getctype()
{
    list<selectoption>selectoptt=new list<selectoption>();
    selectoptt.add(new selectoption('',''));    
    selectoptt.add(new selectoption('Out of Warranty','Out of Warranty'));
    selectoptt.add(new selectoption('Under AMC','Under AMC'));
    selectoptt.add(new selectoption('Under Warranty','Under Warranty'));
    return selectoptt;
}

public list<selectoption>getcreason()
{
    list<selectoption>selectoptr=new list<selectoption>();
    selectoptr.add(new selectoption('',''));    
    selectoptr.add(new selectoption('Acceptance Testing','Acceptance Testing'));
    selectoptr.add(new selectoption('Breakdown','Breakdown'));
    selectoptr.add(new selectoption('Equipment Complexity','Equipment Complexity'));
    selectoptr.add(new selectoption('Equipment Design','Equipment Design'));
    selectoptr.add(new selectoption('Exceptional','Exceptional'));
    selectoptr.add(new selectoption('Feedback','Feedback'));
    selectoptr.add(new selectoption('Installation','Installation'));
    selectoptr.add(new selectoption('Job Warranty','Job Warranty'));
    selectoptr.add(new selectoption('Other','Other'));
    selectoptr.add(new selectoption('Paid Repair','Paid Repair'));
    selectoptr.add(new selectoption('Performance','Performance'));
    selectoptr.add(new selectoption('Preventive Maintenance','Preventive Maintenance'));    
    return selectoptr;
}

public list<selectoption>getcpriority()
{
    list<selectoption>selectoptp=new list<selectoption>();
    selectoptp.add(new selectoption('',''));
    selectoptp.add(new selectoption('Major','Major'));
    selectoptp.add(new selectoption('Minor','Minor'));
    selectoptp.add(new selectoption('Critical','Critical'));
    return selectoptp;
}

public void displaycaselist()
{
    caselst=new list<case>();
    cseFieldLst=new list<string>();

    String query = 'select CaseNumber,CreatedDate,ClosedDate,IsClosed,IsEscalated,Priority,Reason,Status,Type FROM Case where id !=NULL ';

    if(getcasestatus!=null){
       query+=' and Status=\''+getcasestatus+'\'';
    }
    if(getcasetype!=null){
       query+=' and Type=\''+getcasetype+'\'';
    }
    if(getcasereason!=null){
       query+=' and Reason=\''+getcasereason+'\'';
    }
    if(getcasepriority!=null){
       query+=' and priority=\''+getcasepriority+'\'';
    }

    caselst=Database.query(query+=' ORDER BY CreatedDate DESC');
    cseFieldLst = new List<String>{'CaseNumber','CreatedDate','ClosedDate','IsClosed','IsEscalated','Priority','Reason','Status','Type'};
    
}

public void searchcaselist()
{   
    caselst=new list<case>();
    cseFieldLst=new list<string>();
    if(getcasenumber!=null){
       caselst=Database.query('select CaseNumber,CreatedDate,ClosedDate,IsClosed,IsEscalated,Priority,Reason,Status,Type FROM Case where CaseNumber like \'%'+getcasenumber+'%\' ORDER BY CreatedDate DESC');
       cseFieldLst = new List<String>{'CaseNumber','CreatedDate','ClosedDate','IsClosed','IsEscalated','Priority','Reason','Status','Type'};
    }    
}
}
 
My Visualforce component is  GenericPaginationComponent
<apex:component controller="GenericPaginationComponentContrl">
  
  <!-- Attributes to accept the parameters -->
  <apex:attribute name="Records" Type="Sobject[]" assignTo="{!sObjLst}" required="true" description="Accepts list of records of any object and assign to a variable in controller class"/>
  <apex:attribute name="Fields" Type="String[]" required="true" description="Accepts list of field API names of a sobject in string format"/>
  <apex:attribute name="Title" Type="String" required="true" description="Accepts the title of the section"/>
  
  <!-- Table which displays records along with pagination -->
  <apex:form >
      <apex:pageBlock >
          <apex:pageBlockSection columns="1" title="{!Title}" id="pbSec">
              <apex:pageBlockTable value="{!SobjRecords}" var="sObj">
                  <!-- Dispalys the multiple columns based on the user input -->
                  <apex:repeat value="{!Fields}" var="fld">
                      <apex:column value="{!sObj[fld]}"/>
                  </apex:repeat>
              </apex:pageBlockTable>
              <!-- Dispalys pagination buttons -->
              <apex:panelGrid columns="5">
                  <apex:commandButton value="|<" action="{!con.first}" disabled="{!!con.hasPrevious}" status="pagStatus" reRender="pbSec" title="First"/>
                  <apex:commandButton value="<" action="{!con.previous}" disabled="{!!con.hasPrevious}" status="pagStatus" reRender="pbSec" title="Previouse"/>
                  <apex:commandButton value=">" action="{!con.next}" disabled="{!!con.hasNext}" status="pagStatus" reRender="pbSec" title="Next"/>
                  <apex:commandButton value=">|" action="{!con.last}" disabled="{!!con.hasNext}" status="pagStatus" reRender="pbSec" title="Last"/>
                  <apex:actionStatus startText="Fetching..." id="pagStatus"/>
              </apex:panelGrid>
          </apex:pageBlockSection>
      </apex:pageBlock>
  </apex:form>
</apex:component>
 
My visualforce component class is GenericPaginationComponentContrl
public class GenericPaginationComponentContrl {
  //Stores the records which are supplied to the 'Records' attribute.
  public Sobject[] sObjLst {get;set;}
  /*
   1. Implementing the pagination with ApexPages.StandardSetController.
   2. We can utilize the built in methods available for the ApexPages.StandardSetController to build the pagination.
   3. Following are the built in mehods we can utilize -
    a. first()
    b. previous()
    c. next()
    d. last()
    e. getHasPrevious() - returns boolean value.
    f. getHasNext() - returns boolean value.
    g. setPageSize(IntegerValue)
  */
  public ApexPages.StandardSetController con {
   get {
    //initializing con with the records.
    if(con == null)
     con = new ApexPages.StandardSetController(sObjLst);
    //Setting the pagination size
    con.setPageSize(5);
    return con;
   }
   set;
  }
  //Method which returns subset of records from the sObjLst.
  public List<sobject> getSobjRecords() {        
   //Type Casing the records and returning to display on the page.
   return (List<sobject>)con.getRecords();
  }
 }

 

Apex Class
public class displaycase {
public string getcasetype{get;set;}
public  void displaycase ()
{
    
}
public list<case> caselst{get;set;}


public list<selectoption>getcasestatus()
{
    list<selectoption>selectopt=new list<selectoption>();
    selectopt.add(new selectoption('Open','Open'));
    selectopt.add(new selectoption('Closed','Closed'));
    return selectopt;
}
public void displaycaselist()
{
    caselst=new list<case>();
   caselst=[SELECT CaseNumber,ClosedDate,IsClosed,IsEscalated,Priority,Reason,Status,Subject,Type FROM Case where status=:getcasetype];
}
}
Visualforce page
<apex:page controller="displaycase">
 <apex:form id="frm">
 <apex:selectList size="1" value="{!getcasetype}" >
 <apex:selectOptions value="{!casestatus}"> </apex:selectOptions>
 <apex:actionSupport event="onchange" action="{!displaycaselist}"/>
 </apex:selectList>
 <apex:outputLabel id="pnl1" >
 <apex:pageBlock >
 <apex:pageBlockTable value="{!caselst}" var="cse">
 <apex:column >
      <apex:outputLink value="/apex/TabbedVisualforcePage?Id={!cse.id}">{!cse.CaseNumber}</apex:outputLink>
 </apex:column>
 <apex:column value="{!cse.Subject}"/>
 <apex:column value="{!cse.Type}"/>
 <apex:column value="{!cse.Priority}"/>
 <apex:column value="{!cse.Reason}"/>
 <apex:column value="{!cse.Status}"/>
 <apex:column value="{!cse.IsEscalated}"/>
 <apex:column value="{!cse.IsClosed}"/>
 <apex:column value="{!cse.ClosedDate}"/>
 </apex:pageBlockTable>
 </apex:pageBlock>
 </apex:outputLabel>
 </apex:form>
</apex:page>
Page shown list of cases successfully but when I'm trying to click on case number, code through an Authorization Required error.
 
Hello Dears,

Please let me know how to implement Pagination with Standard Controller and Extension used in Apex:Page.
Kindly assist on this.


Thanks,
Rohit Sharma

Hi , 

 

I am Installing a salesforce app on my enterprise org , and recieving this error "Missing Organization Feature: Campaign" . 

 

I cannot see a Campaign object in my current Org. Anyone know how to enable this? 

 

Thanks 

 

How can i convert number to word11

for eg: if i give Input : 1265

                         output: twelve hundred sixty five only.

 

i have tried this in javascript, its working fine , but unable to pass javascript value to custom object field value.

 

<HTML>
 <HEAD>
 <script type = "text/javascript">
function test_skill() {
var junkVal="1000" // 
//var junkVal=document.getElementById('rupees').value;
junkVal=Math.floor(junkVal);
var obStr=new String(junkVal);
numReversed=obStr.split("");
actnumber=numReversed.reverse();
if(Number(junkVal) >=0){
//do nothing
}
else{
alert('wrong Number cannot be converted');
return false;
}
if(Number(junkVal)==0){
document.getElementById('container').innerHTML=obStr+''+'Rupees Zero Only';
return false;
}
if(actnumber.length>9){
alert('Oops!!!! the Number is too big to covertes');
return false;
}
var iWords=["Zero", " One", " Two", " Three", " Four", " Five", " Six", " Seven", " Eight", " Nine"];
var ePlace=['Ten', ' Eleven', ' Twelve', ' Thirteen', ' Fourteen', ' Fifteen', ' Sixteen', ' Seventeen', ' Eighteen', ' Nineteen'];
var tensPlace=['dummy', ' Ten', ' Twenty', ' Thirty', ' Forty', ' Fifty', ' Sixty', ' Seventy', ' Eighty', ' Ninety' ];
var iWordsLength=numReversed.length;
var totalWords="";
var inWords=new Array();
var finalWord="";
j=0;
for(i=0; i<iWordsLength; i++){
switch(i)
{
case 0:
if(actnumber[i]==0 || actnumber[i+1]==1 ) {
inWords[j]='';
}
else {
inWords[j]=iWords[actnumber[i]];
}
inWords[j]=inWords[j]+' Only';
break;
case 1:
tens_complication();
break;
case 2:
if(actnumber[i]==0) {
inWords[j]='';
}
else if(actnumber[i-1]!=0 && actnumber[i-2]!=0) {
inWords[j]=iWords[actnumber[i]]+' Hundred and';
}
else {
inWords[j]=iWords[actnumber[i]]+' Hundred';
}
break;
case 3:
if(actnumber[i]==0 || actnumber[i+1]==1) {
inWords[j]='';
}
else {
inWords[j]=iWords[actnumber[i]];
}
if(actnumber[i+1] != 0 || actnumber[i] > 0){
inWords[j]=inWords[j]+" Thousand";
}
break;
case 4:
tens_complication();
break;
case 5:
if(actnumber[i]==0 || actnumber[i+1]==1) {
inWords[j]='';
}
else {
inWords[j]=iWords[actnumber[i]];
}
if(actnumber[i+1] != 0 || actnumber[i] > 0){
inWords[j]=inWords[j]+" Lakh";
}
break;
case 6:
tens_complication();
break;
case 7:
if(actnumber[i]==0 || actnumber[i+1]==1 ){
inWords[j]='';
}
else {
inWords[j]=iWords[actnumber[i]];
}
inWords[j]=inWords[j]+" Crore";
break;
case 8:
tens_complication();
break;
default:
break;
}
j++;
}
function tens_complication() {
if(actnumber[i]==0) {
inWords[j]='';
}
else if(actnumber[i]==1) {
inWords[j]=ePlace[actnumber[i-1]];
}
else {
inWords[j]=tensPlace[actnumber[i]];
}
}
inWords.reverse();
for(i=0; i<inWords.length; i++) {
finalWord+=inWords[i];
}
document.getElementById('container').innerHTML=finalWord; // we are getting values in to it.
}
 </script>
 </HEAD>
 <BODY onload="test_skill()">
 
<div id="container"></div>
 </BODY>
 
</HTML>
i want that value (document.getElementById('container').innerHTML=finalWord;) in field namely amountinwords__c .

Hi,

 

I have a VF page which has a list of records. I would like to have a hyperlink on any one field to link to that record.

 

For eg. if the list has a list of opportunities and i would like to point the opportunity name to be hyperlinked to that opportunity record.

 

Thanks

Prady

 

 

 

  • October 19, 2011
  • Like
  • 0

Recently I was working on a requirement which required overriding the Case detail page with a visualforce page. Problem crept when the related list comonent didnt worked for Case Comments and History. So I decided to write my own code to display the related lists.

I was finally able to write my own code to display the related list. It implements all the function that standard related list of Case Comments provide. In order to make it reusable, I made it as a component so that in other pages I just need to pass the Case Id and I will get the complete list of Case Comments.

 Heres the code finally :

 1. Component Code

 

<apex:component controller="CaseCommentsComponentController" allowDML="true">
<!-- Attribute Definition -->
<apex:attribute name="CaseId" description="Salesforce Id of the Case whose Case Comments needs to be rendered" type="Id" required="true" assignTo="{!caseId}" />

<!-- Component Body -->
<apex:componentBody >
<apex:form >
<apex:pageBlock title="Case Comments" >
<apex:pageBlockButtons location="top">
<apex:commandButton action="{!NewComment}" value="New"/>
</apex:pageBlockButtons>
<apex:pageBlockTable value="{!Comments}" var="comment">
<apex:column headerValue="Action">
<apex:outputLink value="/{!comment.cComment.Id}/e?parent_id={!caseId}&retURL=/{!caseId}">Edit</apex:outputLink>&nbsp | &nbsp
<apex:commandLink action="{!deleteComment}" value="Del">
<apex:param name="CommentId_d" value="{!comment.cComment.Id}"/>
</apex:commandLink>&nbsp | &nbsp
<apex:commandLink action="{!makePublicPrivate}" value="{!comment.PublicPrivateAction}">
<apex:param name="CommentId_p" value="{!comment.cComment.Id}" />
</apex:commandLink>
</apex:column>
<apex:column headerValue="Public" value="{!comment.cComment.IsPublished}" />
<apex:column headerValue="Comments">
<apex:outputText escape="false" value="{!comment.commentText}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:componentBody>
</apex:component>

 

 2. Apex Code

public with sharing class CaseCommentsComponentController {

public Id caseId {get; set;}
public cComments[] comments{
get{
List<cComments> comments = new List<cComments>();
for(CaseComment comment : [Select LastModifiedDate, LastModifiedBy.Id, LastModifiedBy.Name, IsPublished, CreatedDate, CreatedBy.Id, CreatedBy.Name, CommentBody From CaseComment c where ParentId = :caseId order by c.LastModifiedDate desc])
{
cComments tempcComment = new cComments();
tempcComment.cComment = comment;

// Build String to display.
tempcComment.commentText = '<b>Created By: <a href=\'/' + comment.CreatedBy.Id + '\'>' + comment.CreatedBy.Name + '</a> (' + comment.CreatedDate.format() + ') | ';
tempcComment.commentText += 'Last Modified By: <a href=\'/' + comment.LastModifiedBy.Id + '\'>' + comment.LastModifiedBy.Name + '</a> (' + comment.LastModifiedDate.format() + ')</b><br>';
tempcComment.commentText += comment.CommentBody;

if(comment.IsPublished)
tempcComment.PublicPrivateAction = 'Make Private';
else
tempcComment.PublicPrivateAction = 'Make Public';
//Add to list
comments.add(tempcComment);
}
return comments;
}

set;
}

public PageReference NewComment()
{
PageReference pr = new PageReference('/00a/e?parent_id='+ caseId + '&retURL=%2F' + caseId);
pr.setRedirect(true);
return pr;
}

public PageReference deleteComment()
{
Id commentId = ApexPages.currentPage().getParameters().get('CommentId_d');

for(cComments Comment : comments)
{
if(Comment.cComment.Id == commentId)
{
delete Comment.cComment;
break;
}
}

PageReference pg = new PageReference('/' + caseId);
pg.setRedirect(true);
return pg;
}

public PageReference makePublicPrivate()
{
Id commentId = ApexPages.currentPage().getParameters().get('CommentId_p');
for(cComments Comment : comments)
{
if(Comment.cComment.Id == commentId)
{
Comment.cComment.IsPublished = !Comment.cComment.IsPublished;
if(Comment.cComment.IsPublished)
Comment.PublicPrivateAction = 'Make Private';
else
Comment.PublicPrivateAction = 'Make Public';

update Comment.cComment;
break;
}
}
PageReference pg = new PageReference('/' + caseId);
pg.setRedirect(true);
return pg;
}

public class cComments {

public CaseComment cComment {get; set;}
public String commentText {get; set;}
public String PublicPrivateAction {get; set;}
}
}

 Hope it is helpful to you.

 Let me know your views on the code above or if you have any questions

Message Edited by Rajesh Shah on 10-16-2009 08:03 PM