• kriiyer
  • 0 Points
  • Member since 2008

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
  • 2
Hello all,
We currently have a requirement of displaying the contract term dates in a table with links to delete them. It looks something like this.
Contract Term Dates                         Action
02/02/2009                                           Remove
09/03/2009                                           Remove
where Remove is a link which would delete the contract term date record and refresh the page. I used the apex:commandLink for implementing the Remove link functionality. It does delete the record. However, it throws a Javascript error which says Invalid Argument. The error comes from the javascript snippet generated by the Salesforce engine on the page.
I further tried changing the commandLink to commandButton. I use the apex:param to pass the contract term date ID to the controller. However, for some reason the ID does not reach the controller and the controller method throws a List does not return any rows for assignment error.
Here is what I wrote:
<apex:dataTable id="dataTableObj" value="{!allTermDates}" var="a"  title="Details of Effective Date" rendered="{!showADJTable}">
        <apex:commandButton value="Remove" action="{!removeTermDates}" onclick="return confirmDeletion();">
            <apex:param name="termDates" value="{!a.Id}"></apex:param>
        <apex:outputField value="{!a.Date__c}"/>


<script language="Javascript">
 function confirmDeletion(){
   return confirm('The Terms Date will be permanently deleted. Do you wish to continue—');

 My Controller method looks something like this:

public PageReference removeTermDates(){
 Id termId= System.currentPageReference().getParameters().get('termDates');
 System.assertNotEquals(null, termId);
 Term_Dates__c termDat = [select Id, Date_Type__c from Term_Dates__c where id=:termId];



 }else if(termDat.Date_Type__c.equals('Adjustment')){

 }else if(termDat.Date_Type__c.equals('Cash Out')){


 delete termDat;
 return null;

Kindly advise on what I'm missing here.
Thanks in advance.
Hi all,
I'm a newbie to Salesforce and intend to create an attachment object through a method in my Apex class. My code doesnt throw any error, however the attachment object does not get inserted.
Heres my code.
public void saveAttachment(){
  String encodedContentsString = System.currentPageReference().getParameters().get('fileContents');
  Id accountId = System.currentPageReference().getParameters().get('accountId');
  Attachment attachment = new Attachment();
  attachment.Body = Blob.valueOf(encodedContentsString);
  attachment.Name = String.valueOf('test.txt');
  attachment.ParentId = accountId; 
  insert attachment;
Am I missing out on anything here or is this just not the right way to create an attachment. I also pass the required parameters i.e. fileContents (this is a Base64 encoded string) and accountId (this is supposed to be the parentId for the attachment) Kindly advise.

Hi all,
Is it possible to customize the style of an apex:pageBlock element given that there is no style attribute that we can use with apex:pageBlock. For eg. is there a way by which we can include a border on the left hand side of a pageBlock. The default behaviour is that there is no border on the left hand side.
Thanks in advance,
Hi all,
I get a Javascript error (Invalid Argument) while using apex:commandLink. My code is as under:
<apex:pageBlock rendered="{!showFifthSection}">
    <table width="80%">
            <td style="font-weight:bold;" width="20%" valign="top">
                Enter Hi ROC adjustment criteria:
            <td width="10%">
                <apex:inputField value="{!contractTerms.ADJ_RT_CRITERIA__c}" />
            <td colspan="3">
                <apex:pageMessage severity="info" strength="1" title="Please include details regarding the criteria for which the Hi-ROC rate reduction or increase would adjust.  Describe any rate adjustment tables, and include references to pages and sections within the contract that explain the rate adjustment criteria.  Include details, such as number of month's notice an account must have before a rate change." />
            <td style="font-weight:bold;">Enter effective date(s) Hi-ROC adjustment(s):</td>
            <td><apex:inputField id="termDt" value="{!termDates.Date__c}"/> <apex:CommandButton action="{!addTermDates}" value="Add" onclick="return checkBlankDate(document.getElementById('{!$Component.termDt}'));"></apex:CommandButton>
        <td colspan="3 align="left">
            <apex:dataTable value="{!allTermDates}" var="a" title="Details of Effective Date" >
                <apex:column >
                     <apex:commandLink value="Remove" action="{!removeTermDates}">
                         <apex:param name="termDates" value="{!a.Id}" />
                <apex:column > <span style="padding:15px;"/><apex:outputField value="{!a.Date__c}"/></apex:column>
        <td colspan="3" align="right">
            <apex:commandButton action="{!nextPage}" value="Continue" styleClass="btn" onclick="return checkEmptyFields(this.form);"></apex:commandButton>

 It throws me an error as soon as I click the Remove link. However the records get deleted on the Remove Link but it throws the error. Kindly advise if I've missed out on anything.
When I do a View Source of the generated page it says that there is an error in a javascript function that is generated by Salesforce. The function name is dpf() and the error is thrown at if (adp != null). The javascript generated code is as under.
function dpf(f) {
    var adp = f.adp;
    if (adp != null) {
        for (var i = 0;i < adp.length;i++) {
function apf(f, pvp) {
  var adp = new Array();
  f.adp = adp;var ps = pvp.split(',');
  for (var i = 0,ii = 0;i < ps.length;i++,ii++) {
    var p = document.createElement("input");
    p.type = "hidden";  
    p.name = ps[i];
    p.value = ps[i + 1];
    adp[ii] = p;i += 1;
function jsfcljs(f, pvp, t) {
  apf(f, pvp);
  var ft = f.target;
  if (t) {
    f.target = t;
  f.target = ft; 

 Are there any constraints on using an apex:commandLink or an apex:dataTable within an HTML table?

Message Edited by kriiyer on 07-29-2008 07:07 AM

I created a package and included two apex classes in it. When I tried to upload I am getting an error "No testMethods found in the selected Apex code for the package". Not sure how to handle this error. Please let me know how to proceed.


I have a requirement like reading a file on local mahine using Apex
after reading that file using Apex I want to send the contents of that file as an attachment through email
can any one send me the sample Apex code of reading a file on local machine
waitng for a quick reponse