function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

If no logo is uploaded while creating a survey, then how to add default image to the survey

I am uploading the logo. but when logo is not selected i want to upload default image to the survey. How is it 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(); = '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="''&oid='+OrgId+'"></img>';
feedbackmain.Image__c = '<img src="https://c.'+org.InstanceName+'''&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;



<div class="formFeild"> <label>Upload Logo (5 MB Max. size)</label> <div class="feild"> <apex:inputfile value="{!file}" ></apex:inputfile> <!-- <apex:inputTextarea richText="true" value="{!feedbackmain.Image__c}" html-placeholder="Logo" styleClass="text-editor"/> --> </div>

Thanks & Regards,
Rowallim TechnologyRowallim Technology
Hi Satakshi
You can use if condition in controller.
    logo__c= '<img src="address.myimage.jpeg">;
Hope it will help you.