• B_k
  • NEWBIE
  • 10 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 5
    Replies
How to add message next to Apex:inputText and showing required error message.


My Visualforce Page
               <div> <label>Your Name</label> </div>
            <apex:inputText value="{!Case.SuppliedName}" html-rows="1" html-cols="20" style="width: 200px !important;" required="true" />
<div style="width: 500px; background: ">  &nbsp;</div>

MyPageController
public class CaseControllerExt {
    private final Case acase;
    public Blob afile {get; set;}
    public String contentType {get; set;}
    public String fileName {get; set;}
    public CaseControllerExt(ApexPages.StandardController stdController){
        this.acase=(Case)stdController.getRecord();
        acase.Status = 'New';
        acase.Origin = 'IT Request Form';
    }
    public PageReference createCaseWithAttachment() {
        try{
            insert(acase);
        }catch(System.DMLException e){
            ApexPages.addMessages(e);
        }
        if(afile!=null){
            Attachment attach=new Attachment();
            attach.Body=afile;
            attach.Name=filename;
            attach.ContentType=contentType;
            attach.ParentID=acase.id;
            try {
                insert(attach);
            } catch(System.DMLException e) {
                ApexPages.addMessages(e);
                return null;
            }
        }
        PageReference p = Page.Confirmpage;
        p.setRedirect(true);
        return p;                    
    }        
}

Screenshot
 
  • July 01, 2022
  • Like
  • 0
I work on salesforce and i created attach button. it works perfectly but when i click anywhere next the button the button works. anywhere in the red circle the choose file button work!!User-added image
  • June 15, 2022
  • Like
  • 0
How to make Visualforce Pages Visible to Users without login ?

I already did
 Go to Setup -> Sites -> Click Site name -> Public Access Settings
Enabled Visualforce Page Access.

but still doesnt work.
it worked fine in the sandbox but when i moved to production didnt work.
 
  • June 13, 2022
  • Like
  • 0
Someone can help me out in this problem. I wrote the test class but I am getting 15% of code coverage.


Apex Class
Apex Class

Test ClassTest Class
  • June 12, 2022
  • Like
  • 0
I'm facing problem to how to write test code for the attachment class.

Apex Class 

public class CaseControllerExt {
    private final Case acase;
    public Blob afile {get; set;}
    public String contentType {get; set;}
    public String fileName {get; set;}
    public CaseControllerExt(ApexPages.StandardController stdController){
        this.acase=(Case)stdController.getRecord();
        acase.Status = 'New';
        acase.Origin = 'IT Request Form';
    }
    public PageReference createCaseWithAttachment() {
        try{
            insert(acase);
        }catch(System.DMLException e){
            ApexPages.addMessages(e);
        }
        if(afile!=null){
            Attachment attach=new Attachment();
            attach.Body=afile;
            attach.Name=filename;
            attach.ContentType=contentType;
            attach.ParentID=acase.id;
            try {
                insert(attach);
            } catch(System.DMLException e) {
                ApexPages.addMessages(e);
                return null;
            }
        }
        PageReference p = Page.Confirmpage;
        p.setRedirect(true);
        return p;                    
    }        
}


Please provide solution for that.
 
  • June 11, 2022
  • Like
  • 0
Hello,

I've created two lookups on Activity object on Lead and Contact, trying to use your formula:
IF( ISBLANK( Contact__c ), Lead__r.Phone , Contact__r.Phone ).
No syntax error though.
However, it appears it does not work, the phone number from either Lead or Contact is not populating on Task.
 is only works with the new tasks. And I'm trying to backfill existing tasks.Populate Phone And Email on Task
  • April 06, 2022
  • Like
  • 0
I work on salesforce and i created attach button. it works perfectly but when i click anywhere next the button the button works. anywhere in the red circle the choose file button work!!User-added image
  • June 15, 2022
  • Like
  • 0
Someone can help me out in this problem. I wrote the test class but I am getting 15% of code coverage.


Apex Class
Apex Class

Test ClassTest Class
  • June 12, 2022
  • Like
  • 0
I'm facing problem to how to write test code for the attachment class.

Apex Class 

public class CaseControllerExt {
    private final Case acase;
    public Blob afile {get; set;}
    public String contentType {get; set;}
    public String fileName {get; set;}
    public CaseControllerExt(ApexPages.StandardController stdController){
        this.acase=(Case)stdController.getRecord();
        acase.Status = 'New';
        acase.Origin = 'IT Request Form';
    }
    public PageReference createCaseWithAttachment() {
        try{
            insert(acase);
        }catch(System.DMLException e){
            ApexPages.addMessages(e);
        }
        if(afile!=null){
            Attachment attach=new Attachment();
            attach.Body=afile;
            attach.Name=filename;
            attach.ContentType=contentType;
            attach.ParentID=acase.id;
            try {
                insert(attach);
            } catch(System.DMLException e) {
                ApexPages.addMessages(e);
                return null;
            }
        }
        PageReference p = Page.Confirmpage;
        p.setRedirect(true);
        return p;                    
    }        
}


Please provide solution for that.
 
  • June 11, 2022
  • Like
  • 0
Hello,

I've created two lookups on Activity object on Lead and Contact, trying to use your formula:
IF( ISBLANK( Contact__c ), Lead__r.Phone , Contact__r.Phone ).
No syntax error though.
However, it appears it does not work, the phone number from either Lead or Contact is not populating on Task.
 is only works with the new tasks. And I'm trying to backfill existing tasks.Populate Phone And Email on Task
  • April 06, 2022
  • Like
  • 0