• Das M
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 5
    Replies
Hi, I am getting followinng error whilt I try to save this Class. Could someone help to fix this ?

Error: Compile Error: deleteInventory: Class must implement the global interface method: Iterable<Inventory__c> start(Database.BatchableContext) from Database.Batchable<Inventory__c> at line 1 column 14
global class deleteInventory implements Database.Batchable<Inventory__c>{
    global final String Query;
    global deleteInventory(String q){
        Query=q;
    }

    global Database.QueryLocator start(Database.BatchableContext BC){
        return Database.getQueryLocator(query);
        
            
    }

    global void execute(Database.BatchableContext BC,List<Inventory__c> scope){
        delete scope;
    }

    global void finish(Database.BatchableContext BC){
    // Get the ID of the AsyncApexJob representing this batch job
    }

}

 
  • January 14, 2016
  • Like
  • 0
Hi- Could some one can help me to write a Test class for this controller?
apex:
public with sharing class reconInventoryController {
    String Id = ApexPages.currentPage().getParameters().get('Id');
    String fileId = ApexPages.currentPage().getParameters().get('fileId');
    List<Inventory__c> inventories = new List<Inventory__c>();
    public String fileIds{get; set;}
   
    public PageReference updateInventories(){
        update inventories;
        PageReference orderPage = new PageReference('/apex/InventoryConfirm?Id='+ Id );
        orderPage.setRedirect(true);
        return orderPage; 
       
    }
   
    public List<Inventory__c> getInventories(){
    inventories = [SELECT Name,Pendant_Serial_Number__c,Account_Name__c,Comments__c,Data_Retrieval__c,Id,Phone_Serial_Number__c,Serial_Number__c,Shelf_Life__c,Ship_Date__c,Status__c FROM Inventory__c  
          
                 Where Account_Name__r.Id = :Id];
        return inventories;
    }
    
    
    public reconInventoryController(ApexPages.StandardController controller) {
       theAccount = [Select Id, Name from Account where Id= :Id LIMIT 1];
       //thefileId = ApexPages.currentPage().getParameters().get('fileId');
       
    }
    
    public Account theAccount{get; set;}
   
    
    
}

VF Page
<apex:page standardController="Account" extensions="reconInventoryController" showHeader="true" sidebar="true" >
<apex:form >
    <apex:pageBlock title="Inventory reconcile :  {!theAccount.Name}">
    

        <apex:pageBlockButtons location="bottom">
            <apex:commandButton action="{!updateInventories}" value="Update Inventory"/>
        </apex:pageBlockButtons>
         <apex:pageBlockTable value="{!inventories}" var="c">
            <apex:column headerValue="Model">
                <apex:outputLink value="{!URLFOR('/')}{!c.Id}" target="_blank">{!c.Name}</apex:outputLink>
            </apex:column>    
            <apex:column value="{!c.Pendant_Serial_Number__c}" />
            <apex:column value="{!c.Phone_Serial_Number__c}" />
            <apex:column value="{!c.Shelf_Life__c}" />
            <apex:column value="{!c.Ship_Date__c}" />
            <apex:column headerValue="Status" >
            <apex:inputField value="{!c.Status__c}" />
            </apex:column>
            <apex:column headerValue="Comments">
            <apex:inputField value="{!c.Comments__c}" style="width:95%" />
            </apex:column>
            
        </apex:pageBlockTable>
        
       
        
    </apex:pageBlock>
    </apex:form>
    </apex:page>

 
  • January 13, 2016
  • Like
  • 0
We are developeing a VF page where we can capture customer signature and attach it to the record.
The code is developed based from  following 2 posts.

http://corycowgill.blogspot.in/2013/12/capturing-signatures-with-html5-canvas.html
http://blog.jeffdouglas.com/2010/07/14/attach-a-pdf-to-a-record-in-salesforce/


It's done it 2 steps.
First we capture the signature and save it to aatchment as png file.
Second in the Visulforce page we refer this image to include in the VF. (The singnature doc Id is passed as URL parmenter )

This is how it's referd in the VF page that is redered as PDF
 <apex:image Url="https://c.cs41.content.force.com/servlet/servlet.FileDownload?file={!$CurrentPage.parameters.fileId}"  />
 
 The fileId is the attachment ID of the signature impage

The problem we have is once this page is attached to the record the image is broken. It's not diplaying image.
If I harcode this tag like below

 <apex:image Url="https://c.cs41.content.force.com/servlet/servlet.FileDownload?file==00P55000000HHz1"  />
 
 Every thing works fine.
 
 I debugged and verified that the URL parmenter is getting the right value.
 
 I would like your help to fix this issue.
<apex:page standardController="Account" extensions="reconInventoryController"  renderAs="pdf"  >
<apex:form >



<!---
<apex:outputPanel styleClass="panelWrapper" layout="block">
    <apex:pageBlock title="Inventory Updated" >
    </apex:pageBlock>
</apex:outputPanel>
--->

    <apex:pageBlock title="{!theAccount.Name} - Inventory Dated ( {!Today()})">
  

      
         <apex:pageBlockTable value="{!inventories}" var="c">
            
             <apex:column value="{!c.Name}" />   
            <apex:column value="{!c.Pendant_Serial_Number__c}" />
            <apex:column value="{!c.Shelf_Life__c}" />
            <apex:column value="{!c.Ship_Date__c}" />
            <apex:column value="{!c.Phone_Serial_Number__c}" />
           
            <apex:column value="{!c.Data_Retrieval__c}" />
            <apex:column value="{!c.Status__c}" />
            <apex:column value="{!c.Comments__c}" />
           
        
            
        </apex:pageBlockTable>
        
       
        
    </apex:pageBlock>
    {!MySignURL}
    <!--
    <apex:image url="{!MySignURL}" width="256" height="256"/>
     <apex:image value="/servlet/servlet.FileDownload?file=00P55000000HSTHEA4"  />
    --->


    /servlet/servlet.FileDownload?file={!$CurrentPage.parameters.fileId}

 <apex:image url="/servlet/servlet.FileDownload?file={!MySignURL}" />

  <apex:image Url="https://c.cs41.content.force.com/servlet/servlet.FileDownload?file={!$CurrentPage.parameters.fileId}"  />
 
 <apex:image value="{!URLFOR($Action.Attachment.Download, $CurrentPage.parameters.fileId )}" />
    
    
     
     
    </apex:form>
    </apex:page>
Here is the screenshot of the PDF that got attached through the code.
User-added image

I tried 3 diffrtent ways to display the image here as shown in the VF code. But none of them worked. 
Can any body find what Iam doing wrong here.
  • January 10, 2016
  • Like
  • 0
We are developeing a VF page where we can capture customer signature and attach it to the record.
The code is developed based from  following 2 posts.

http://corycowgill.blogspot.in/2013/12/capturing-signatures-with-html5-canvas.html
http://blog.jeffdouglas.com/2010/07/14/attach-a-pdf-to-a-record-in-salesforce/


It's done it 2 steps.
First we capture the signature and save it to aatchment as png file.
Second in the Visulforce page we refer this image to include in the VF. (The singnature doc Id is passed as URL parmenter )

This is how it's referd in the VF page that is redered as PDF
 <apex:image Url="https://c.cs41.content.force.com/servlet/servlet.FileDownload?file={!$CurrentPage.parameters.fileId}"  />
 
 The fileId is the attachment ID of the signature impage

The problem we have is once this page is attached to the record the image is broken. It's not diplaying image.
If I harcode this tag like below

 <apex:image Url="https://c.cs41.content.force.com/servlet/servlet.FileDownload?file==00P55000000HHz1"  />
 
 Every thing works fine.
 
 I debugged and verified that the URL parmenter is getting the right value.
 
 I would like your help to fix this issue.
<apex:page standardController="Account" extensions="reconInventoryController"  renderAs="pdf"  >
<apex:form >



<!---
<apex:outputPanel styleClass="panelWrapper" layout="block">
    <apex:pageBlock title="Inventory Updated" >
    </apex:pageBlock>
</apex:outputPanel>
--->

    <apex:pageBlock title="{!theAccount.Name} - Inventory Dated ( {!Today()})">
  

      
         <apex:pageBlockTable value="{!inventories}" var="c">
            
             <apex:column value="{!c.Name}" />   
            <apex:column value="{!c.Pendant_Serial_Number__c}" />
            <apex:column value="{!c.Shelf_Life__c}" />
            <apex:column value="{!c.Ship_Date__c}" />
            <apex:column value="{!c.Phone_Serial_Number__c}" />
           
            <apex:column value="{!c.Data_Retrieval__c}" />
            <apex:column value="{!c.Status__c}" />
            <apex:column value="{!c.Comments__c}" />
           
        
            
        </apex:pageBlockTable>
        
       
        
    </apex:pageBlock>
    {!MySignURL}
    <!--
    <apex:image url="{!MySignURL}" width="256" height="256"/>
     <apex:image value="/servlet/servlet.FileDownload?file=00P55000000HSTHEA4"  />
    --->


    /servlet/servlet.FileDownload?file={!$CurrentPage.parameters.fileId}

 <apex:image url="/servlet/servlet.FileDownload?file={!MySignURL}" />

  <apex:image Url="https://c.cs41.content.force.com/servlet/servlet.FileDownload?file={!$CurrentPage.parameters.fileId}"  />
 
 <apex:image value="{!URLFOR($Action.Attachment.Download, $CurrentPage.parameters.fileId )}" />
    
    
     
     
    </apex:form>
    </apex:page>
Here is the screenshot of the PDF that got attached through the code.
User-added image

I tried 3 diffrtent ways to display the image here as shown in the VF code. But none of them worked. 
Can any body find what Iam doing wrong here.
  • January 10, 2016
  • Like
  • 0