• Balakumar Ramachandran 6
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 10
    Replies
Hi,

When i render my VF page as PDF the image inside is not getting displayed from Static Resource. 
I tried using image and apex tags both did not work.

<img src="{!URLFOR($Resource.Name)}" width="100px;"/> 
<apex:image value="data:image;base64,{!$Resource.Name}"/>

The same is getting displayed from VF page. Any idea ?

I also tried searching and tried to implement the below solution which did not work for me properly.

<style>

@page {
    margin : 70pt .5in .5in .5in;
    @top-center {
        content : "My Header";
     }
    @bottom-left {
        content : "My Footer on Left Side";
        font-size : 10 px;
        color : #808080;
    }
    @bottom-center {
        content : "My Footer in center" ;
        font-size : 10 px;
        color : #808080;
    }

    @top-center {
            content : element(header);
         }
    
    div.header {
        position : running(header) ;
        background-image:url(https://myURL);
    }
    
}
</style>

<div class="header">
    <center><img src="{!$Resource.Name}" width="25%"/></center>
</div>   

 
I need to export attachment objects from salesforce. it contains binary fields .

Dataloader says on export cannot export binary fields..any suggestion ?
I need to export my custom object through dataloader which contains more than 1.5 Lakhs record

On Export i get an error "Failed to Parse exception"

I have Bulk API and enable serial mode for bulk API enabled, Batch size is 10000 . I check the status of the records in monitor bulk job status and it says 50k records are processed but when i view the export file i dont see any data.

Any suggestions ?
i want to prevent values that are already loaded.. the userlist should not contain values that are already selected..how do i do it ?

public list<SelectOption> getLeftOptionList(){
    list<SelectOption> TempOptionList = new list<SelectOption>();
    list<User> TempValueList;
    list<User> UserList;

    list<PermissionSetAssignment> userpermission;
    map<id,PermissionSetAssignment> s = new map<id,PermissionSetAssignment>();
    userPermission =   [SELECT Assignee.Name, AssigneeId FROM PermissionSetAssignment where PermissionSet.id in ('0PSf0000000Cqcg','0PSf0000000CqZc')];
    system.debug('-------User Permission--------'+userPermission);
    for(PermissionSetAssignment p : userPermission)
    {
       s.put(p.AssigneeId,p);
    }
    system.debug('---------Permission Set Values-----------'+s.KeySet());
    
    if (s!= null) {
      //UserList = [Select Name, Id, IsActive, UserType From User where IsActive=true and UserType = :USERTYPE_STD and Id IN :InitialRightList limit 500];
     UserList = [Select Name, Id, IsActive, UserType From User where IsActive=true and UserType = :USERTYPE_STD and Id IN :s.KeySet() limit 500];
     system.debug('---------Permission Set Values-----------'+UserList);
      for (User u : UserList) {
      
        LeftOptionMap.put(u.Id, u);
       
      }
   
    } 
   
    TempValueList = LeftOptionMap.values();
    TempValueList.sort();  // sort by name
    for (User u : TempValueList) {
      TempOptionList.add(new SelectOption(u.Id, u.Name));
    }
    return TempOptionList;
  }
VF Page
-----------

                 <apex:pageblockTable value="{!users}" var="user" >                                                           
                         <apex:column width="20%">
                           <apex:facet name="header">Owner ID </apex:facet>                         
                            
                            <apex:commandlink value="Del" action="{!delCont}" rerender="" >
                               <apex:param name="contIdChosen"  value="{!user.UserOrGroupId}" assignTo="{!contIdChosen}"/>                         
                             </apex:commandlink>                            
                         </apex:column>                                    
                  </apex:pageblockTable>


class
=------

public PageReference delCont()
    {    
     system.debug('----------------------------------------Test Me------------------------------');
     Id id = System.currentPageReference().getParameters().get('contIdChosen');
     Scheme__Share toDel=new Scheme__Share(Id=contIdChosen );
     system.debug('----------Id is------------'+contIdChosen );     
     PageReference nextpage1 = new PageReference('/apex/share/WV_SharingDetails?parentId='+id);
     nextpage1.setredirect(true);
     return nextpage1;
    
    }


The method delCont  itself is not called inside pageblock.. If i place outside it it works fine but i need it inside pageblock..
i have a Del button in page and when i click on Del the pagereference section delCont is not called..instead it is getUserName method and closing after that..kindly suggest

page
-------

<apex:commandlink value="Del" action="{!delCont}" id="all">
                       <apex:param name="contIdParam" value="{!user.UserOrGroupId}" assignTo="{!contIdChosen}"/>                  
                     </apex:commandlink>

Controller
--------------

public class WV_ManualShareRead {
  
   public List<Scheme__Share> users;
   public List<User> userName;
   public list<id> useridlist{get;set;}  
  
 
  
   public String contIdChosen {get; set;}

   public WV_ManualShareRead()
   {
    useridList = new list<id>(); 
         
   }
   
   
    public List<Scheme__Share> getUsers()
    {       
        if(users == null)
        {
            users= [select UserOrGroupId from Scheme__Share where ParentId= :ApexPages.currentPage().getParameters().get('parentId')];
            system.debug('----------------My ID is------------------'+users);            
          
            // return users;
            for(Scheme__Share  X:users ){
            id value=X.UserOrGroupId;
             useridlist.add(value);          
            }
           
            return users;                      
         }
         return null;   
    }
   
    public List<User> getUserName()
    {
   
      if(useridlist != null && useridlist.size() > 0)
           {               
               userName = [SELECT Name FROM user WHERE id in :useridlist];
               system.debug('--------------Name is---------------'+userName);
               return userName;
               }
           
        return null;
    }
  
  
    public PageReference delCont()
    {
  
     system.debug('----------------------------------------Test Me------------------------------');
     Id id = System.currentPageReference().getParameters().get('parentId');
     Scheme__Share toDel=new Scheme__Share(id=contIdChosen );
     system.debug('----------Id is------------'+contIdChosen );
     //delete todel;
     //setupContacts();  
     PageReference nextpage1 = new PageReference('/apex/share/WV_SharingDetails?parentId='+id);
     return nextpage1;
    }
   
  
  
   
   
}
want to get the list of users returned in Username method query..how do i get it?? 

public class WV_ManualShareRead {
  
   List<Scheme__Share> users;
   List<User> userName;
   

    public List<User> getUserName()
    {
      if(userName == null)
          
              
               userName = [SELECT Name FROM user WHERE id = :users];
            
               return userName;
    }
   
    public List<Scheme__Share> getUsers() {

      
        if(users== null)
       
         
            users= [select UserOrGroupId from Scheme__Share where ParentId= :ApexPages.currentPage().getParameters().get('parentId')];
      
        return users;
               
           
     
    }
   
  
  
}
I know why the error " Illegal assignment from List to Id" is coming here..how to resolve it. any ideas ?

public with sharing class ExamplePageController {
 
    public list<String> InitialList  {get;set;}
    public list<String> CurrentList  {get;set;}

    public ExamplePageController() {
    InitialList = new list<String>();
    InitialList.add(UserInfo.getUserId());
    CurrentList = new list<String>();
   
  }
   
  public PageReference manualShareRead(){
      Id recordId= ApexPages.currentPage().getParameters().get('parentid');
      //Id userOrGroupId='005f0000000jioGAAQ';
      Id userOrGroupId=CurrentList;
      // Create new sharing object for the custom object Job.
      Scheme__Share jobShr  = new Scheme__Share();
  
      // Set the ID of record being shared.
      jobShr.ParentId = recordId;  
      system.debug('-------------------Record Id----------'+recordId); 
      // Set the ID of user or group being granted access.
      jobShr.UserOrGroupId = userOrGroupId;
      system.debug('-------------------User Id----------'+userOrGroupId);
      // Set the access level.
      jobShr.AccessLevel = 'Edit';
       
      // Set rowCause to 'manual' for manual sharing.
      // This line can be omitted as 'manual' is the default value for sharing objects.
      jobShr.RowCause = Schema.Scheme__Share.RowCause.Manual;
       
    --------------- remaining code-------------
Hi,

When i render my VF page as PDF the image inside is not getting displayed from Static Resource. 
I tried using image and apex tags both did not work.

<img src="{!URLFOR($Resource.Name)}" width="100px;"/> 
<apex:image value="data:image;base64,{!$Resource.Name}"/>

The same is getting displayed from VF page. Any idea ?

I also tried searching and tried to implement the below solution which did not work for me properly.

<style>

@page {
    margin : 70pt .5in .5in .5in;
    @top-center {
        content : "My Header";
     }
    @bottom-left {
        content : "My Footer on Left Side";
        font-size : 10 px;
        color : #808080;
    }
    @bottom-center {
        content : "My Footer in center" ;
        font-size : 10 px;
        color : #808080;
    }

    @top-center {
            content : element(header);
         }
    
    div.header {
        position : running(header) ;
        background-image:url(https://myURL);
    }
    
}
</style>

<div class="header">
    <center><img src="{!$Resource.Name}" width="25%"/></center>
</div>   

 
I need to export attachment objects from salesforce. it contains binary fields .

Dataloader says on export cannot export binary fields..any suggestion ?
VF Page
-----------

                 <apex:pageblockTable value="{!users}" var="user" >                                                           
                         <apex:column width="20%">
                           <apex:facet name="header">Owner ID </apex:facet>                         
                            
                            <apex:commandlink value="Del" action="{!delCont}" rerender="" >
                               <apex:param name="contIdChosen"  value="{!user.UserOrGroupId}" assignTo="{!contIdChosen}"/>                         
                             </apex:commandlink>                            
                         </apex:column>                                    
                  </apex:pageblockTable>


class
=------

public PageReference delCont()
    {    
     system.debug('----------------------------------------Test Me------------------------------');
     Id id = System.currentPageReference().getParameters().get('contIdChosen');
     Scheme__Share toDel=new Scheme__Share(Id=contIdChosen );
     system.debug('----------Id is------------'+contIdChosen );     
     PageReference nextpage1 = new PageReference('/apex/share/WV_SharingDetails?parentId='+id);
     nextpage1.setredirect(true);
     return nextpage1;
    
    }


The method delCont  itself is not called inside pageblock.. If i place outside it it works fine but i need it inside pageblock..
i have a Del button in page and when i click on Del the pagereference section delCont is not called..instead it is getUserName method and closing after that..kindly suggest

page
-------

<apex:commandlink value="Del" action="{!delCont}" id="all">
                       <apex:param name="contIdParam" value="{!user.UserOrGroupId}" assignTo="{!contIdChosen}"/>                  
                     </apex:commandlink>

Controller
--------------

public class WV_ManualShareRead {
  
   public List<Scheme__Share> users;
   public List<User> userName;
   public list<id> useridlist{get;set;}  
  
 
  
   public String contIdChosen {get; set;}

   public WV_ManualShareRead()
   {
    useridList = new list<id>(); 
         
   }
   
   
    public List<Scheme__Share> getUsers()
    {       
        if(users == null)
        {
            users= [select UserOrGroupId from Scheme__Share where ParentId= :ApexPages.currentPage().getParameters().get('parentId')];
            system.debug('----------------My ID is------------------'+users);            
          
            // return users;
            for(Scheme__Share  X:users ){
            id value=X.UserOrGroupId;
             useridlist.add(value);          
            }
           
            return users;                      
         }
         return null;   
    }
   
    public List<User> getUserName()
    {
   
      if(useridlist != null && useridlist.size() > 0)
           {               
               userName = [SELECT Name FROM user WHERE id in :useridlist];
               system.debug('--------------Name is---------------'+userName);
               return userName;
               }
           
        return null;
    }
  
  
    public PageReference delCont()
    {
  
     system.debug('----------------------------------------Test Me------------------------------');
     Id id = System.currentPageReference().getParameters().get('parentId');
     Scheme__Share toDel=new Scheme__Share(id=contIdChosen );
     system.debug('----------Id is------------'+contIdChosen );
     //delete todel;
     //setupContacts();  
     PageReference nextpage1 = new PageReference('/apex/share/WV_SharingDetails?parentId='+id);
     return nextpage1;
    }
   
  
  
   
   
}
want to get the list of users returned in Username method query..how do i get it?? 

public class WV_ManualShareRead {
  
   List<Scheme__Share> users;
   List<User> userName;
   

    public List<User> getUserName()
    {
      if(userName == null)
          
              
               userName = [SELECT Name FROM user WHERE id = :users];
            
               return userName;
    }
   
    public List<Scheme__Share> getUsers() {

      
        if(users== null)
       
         
            users= [select UserOrGroupId from Scheme__Share where ParentId= :ApexPages.currentPage().getParameters().get('parentId')];
      
        return users;
               
           
     
    }
   
  
  
}
I know why the error " Illegal assignment from List to Id" is coming here..how to resolve it. any ideas ?

public with sharing class ExamplePageController {
 
    public list<String> InitialList  {get;set;}
    public list<String> CurrentList  {get;set;}

    public ExamplePageController() {
    InitialList = new list<String>();
    InitialList.add(UserInfo.getUserId());
    CurrentList = new list<String>();
   
  }
   
  public PageReference manualShareRead(){
      Id recordId= ApexPages.currentPage().getParameters().get('parentid');
      //Id userOrGroupId='005f0000000jioGAAQ';
      Id userOrGroupId=CurrentList;
      // Create new sharing object for the custom object Job.
      Scheme__Share jobShr  = new Scheme__Share();
  
      // Set the ID of record being shared.
      jobShr.ParentId = recordId;  
      system.debug('-------------------Record Id----------'+recordId); 
      // Set the ID of user or group being granted access.
      jobShr.UserOrGroupId = userOrGroupId;
      system.debug('-------------------User Id----------'+userOrGroupId);
      // Set the access level.
      jobShr.AccessLevel = 'Edit';
       
      // Set rowCause to 'manual' for manual sharing.
      // This line can be omitted as 'manual' is the default value for sharing objects.
      jobShr.RowCause = Schema.Scheme__Share.RowCause.Manual;
       
    --------------- remaining code-------------