+ Start a Discussion

how to add default logo if logo is not selected

I want functionality where if logo is not selected then it should display default image by system. Is this possible?

public with sharing class DocumentController {
 public Feedback_Main__c feedbackmain{get;set;}
 public ID folderid{get;set;}
 public Blob file{get;set;}

public DocumentController() {
feedbackmain = new Feedback_Main__c();
Organization org =[select Id,InstanceName from Organization limit 1];

//List<String>AcutalBaseUrl =BaseUrl.split('.');

public PageReference Manage(){
PageReference pg = new PageReference('apex/SBAddQuestionPage');
return pg;

public PageReference saveAndRedirect() {

 Id OrgId = UserInfo.getOrganizationId();
 Folder FolderObj = [Select Id From Folder Where Name = 'Survey Builder' limit 1];
 Document d= new Document();

 d.name = 'LOGO';
 d.body=file; // body field in document object which holds the file.
 d.IsPublic = true;
 d.ContentType ='image/png';
 d.Type = 'png';

 d.folderid = FolderObj.Id; //folderid where the document will be stored insert d;
 if (Document.SObjectType.getDescribe().isCreateable())
     insert d;
Organization org =[select Id,InstanceName from Organization limit 1];
//(Sandbox)feedbackmain.Image__c = '<img src="https://c.cs41.content.force.com/servlet/servlet.ImageServer?id='+d.id+'&oid='+OrgId+'"></img>';
feedbackmain.Image__c = '<img src="https://c.'+org.InstanceName+'.content.force.com/servlet/servlet.ImageServer?id='+d.id+'&oid='+OrgId+'"></img>';

  system.debug('++++++++++D ID+++++++++++'+feedbackmain.Image__c);
  insert feedbackmain; // This takes care of the details for you.
  PageReference redirectPage = Page.SBAddQuestionPage;
  return redirectPage;