• azhar khasim
  • NEWBIE
  • 55 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 15
    Replies
Hello guys,

I have a Custom Button(OnClick JavaScript) in Classic was not working in Lightning now. I found that I need to use Lightning Component to update my Record Type on a click of a button.
 

This is My OnClick JavaScript for Updating Record Type.
************************************************
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}

// identify the record
var o = new sforce.SObject("Contact");
o.id = "{!Contact.Id}";

// Update the Record Type
o.RecordTypeId = "0122E000000KiWa"; //You can also Query the RecordTypeId

// save the change
sforce.connection.update([o]);

//refresh the page
window.location.reload();

**************************************************************

I need this requirement to use as Lightning Component in Salesforce Lightning 
Please provide me a solution for this in

( Component
  Controller
  Style
  Apex Class ) 


Thanks and Regards,
Azar Khasim.
I had a validation rule for which i was using to restrict as

If LOI Approval Status picklist value = Approved then only update the IsRenewed Chechbox = True.
*******************
If LOI Approved Status picklist value = (Rejected or Submitted) we don't want to make the IsRenewed checkbox to true.

*******************
Validation Rule:

 ISPICKVAL(LOI_Approval_Status__c, Approved) 

Please give me a solution for this 

Thanks and Regards,
Azar Khasim.
Hello Everyone,

I had an issue with Commandbutton which I need to redirect the page from the Visualforce page to some other company Website Contact Us page.

Here is my CommandButton code and Controller class code.

VF Page CommandButton:

 <apex:commandButton style="color:white; background-color:red; background-image:none; width:150px; height:35px" action="{!Cancel}" value="Cancel"  />

Controller Class:

 public PageReference Cancel(){
        PageReference pr = new PageReference('/www.bren.com/residential/contact');
        pr.setRedirect(true);
        return pr;
    }


Please help me with this issue.

Thanks and Regards,
Azar Khasim.
I had a field (Allotment) Long TextArea Field in Bren Updates(Custom Object).
I need to display the data which was in Allotment in te Visualforce Page.
I have tried it using <apex:outputField>
But still i was not getting thhe data to display on Visualforce page.

My issue on my Visualforce page:

    <apex:pageBlockSectionItem >
                              

                        <apex:outputLabel value="Allotment Summary" for="AllSum" style="font-family:Ancillary Bold; font-size:15px" />
                      <!--  <apex:outputField value="{!brenup.Allotment__c}" id="a0Wp0000003JTYb" />  -->
                        <apex:outputText value="{!HTMLENCODE(brenup.Allotment__c)}" style="white-space:pre;" escape="false"/>
                      <!--  <apex:inputfield value="{!brenup.Allotment_Summary__c}" id="AllSum" html-disabled="true" /> -->
                      <!--  <apex:inputTextarea richtext="false" value="{!brenup.Allotment__c}"  id="AllSum" readonly="true" cols="150" rows="25"/> -->
                        
                    </apex:pageBlockSectionItem>   

Bold code data is using now and it was not even displaying my data on Visualforce page.

ere below is my issue.
User-added image 
Please help me that i need to display my data in Visualforce page of that field(Allotment(Long Textarea Field)).

Please provide a solution for thisss.

Thanks and Regards,
Azhar Khasim.
Hello guys,

Need help in these for writing a validation rule

When field: 'Candidate Final Status" is not blank, then field: "Interviewer" and field: "Comments" is mandatory Validation Rule

Please help me from thiss...

Regards,
Azar Khasim

 
I Had a Field (Allotment Summary) Long TextArea Field in Bren Updates(Custom Object).
I need to display the data which was in Allotment Summary in the Visualforce Page.

I have tried it using <apex:outputField>
But still i was not getting the data to show in Visualforce page.

My Visualforce Page:

<apex:page controller="BookingLinkQuestionary" showHeader="false" sidebar="false">
    
    <style>
        body {
        background-image: url("https://www.bren.com/residential/images/home-banner11.jpg");
        
        
        }
        input[type="text"] {
        background: transparent;
        
        }        
    </style>  
    
    <apex:form >
        
        <style>
            body .bPageBlock .pbBody .fontcolor .pbSubheader h3{
            color:#ffffff;
            
            
            }
            body .bPageBlock .pbBody .blue .pbSubheader{
            background-color:#02a3d6;
            font-style:Aparajita;
            }
        </style>
       
        <apex:sectionHeader title="Bren Online Booking Form" />
       
        <apex:pageBlock >
        
             <center>
                <apex:image url="https://bren--partial--c.cs31.visual.force.com/resource/1523623530000/BrenLogo"/>
            </center>
            
            <apex:pageBlockButtons location="bottom" style="float:left;" >  
                
                <font size="4" style="color:red; float:left;" face="Ancillary Bold"><b>NOTE:Please click on 'Accepting Terms and Conditions ' checkbox before submitting the data to Bren Corporation.</b> </font>
                <br/>
                <center>
                    <apex:commandButton style="color:white; background-color:green; background-image:none; width:150px; height:35px" action="{!Submit}" value="Submit"  />
                    <apex:commandButton style="color:white; background-color:red; background-image:none; width:150px; height:35px" action="{!cancel}" value="Cancel"  />  
                </center>
            </apex:pageBlockButtons>
            
               
            <center>
                <font size="5" style="color:blue" face="Foobar Pro Bold" ><b>Welcome to Bren Online Booking Portal</b> </font>
            </center>
            
            <center>
                <font size="4" style="color:red" face="Foobar Pro"><b>Bren Terms of Allotment.</b> </font>
            </center>
             <br/><br/>
            <apex:outputPanel styleClass="blue" layout="block" >
                
                <apex:pageBlockSection title="Allotment Summary" collapsible="false"  columns="1">
                      
                 <apex:pageBlockSectionItem >
                        <apex:outputLabel value="Allotment Summary" for="AllSum" style="font-family:Ancillary Bold; font-size:15px" />
                     <apex:outputField value="{!brenup.Allotment__c}" id="AllSum" />
                   <!--    <apex:inputfield value="{!booking.Allotment_Summary__c}" id="AllSum" html-disabled="true" />  -->
                 <!--   <apex:inputTextarea richtext="true" value="{!booking.Allotment_Summary__c}"  id="AllSum" readonly="true" cols="60" rows="15"/>  -->
                  <!--   <apex:inputTextarea richtext="true" value="{!brenup.Allotment_Summary__c}"  id="AllSum" readonly="true" cols="60" rows="15"/>  -->
                           
                    </apex:pageBlockSectionItem>   
                                    
                </apex:pageBlockSection>
            
            <font size="4" style="color:black; float:left;" face="Ancillary Bold"><b>Q1. What is the full name of Bren corporation?</b> </font>
              
                <br/><br/><br/><br/>
                 <font size="4" style="color:black; float:left;" face="Ancillary Bold"><b>Q2. What is the full name of Bren corporation?</b> </font>
                
                <br/><br/><br/><br/>
                 <font size="4" style="color:black; float:left;" face="Ancillary Bold"><b>Q3. What is the full name of Bren corporation?</b> </font>
              
                <br/><br/><br/><br/>
                
                 <font size="4" style="color:black; float:left;" face="Ancillary Bold"><b>Q4. What is the full name of Bren corporation?</b> </font> 
              
                <br/><br/><br/><br/>
 
                 <font size="4" style="color:black; float:left;" face="Ancillary Bold"><b>Q5. What is the full name of Bren corporation?</b> </font>         
                
                <br/><br/><br/><br/>
 
                 <font size="4" style="color:black; float:left;" face="Ancillary Bold"><b>Q6. What is the full name of Bren corporation?</b> </font>
              
                <br/><br/><br/><br/>
 
                 <font size="4" style="color:black; float:left;" face="Ancillary Bold"><b>Q7. What is the full name of Bren corporation?</b> </font>
               
                <br/><br/><br/><br/>
 
                 <font size="4" style="color:black; float:left;" face="Ancillary Bold"><b>Q8. What is the full name of Bren corporation?</b> </font>
              
                <br/><br/><br/><br/>
 
                 <font size="4" style="color:black; float:left;" face="Ancillary Bold"><b>Q9. What is the full name of Bren corporation?</b> </font>
              
                <br/><br/><br/><br/>
 
                 <font size="4" style="color:black; float:left;" face="Ancillary Bold"><b>Q10. What is the full name of Bren corporation?</b> </font>
                 
                <br/><br/><br/><br/>
                
                 <br/>
              <apex:inputCheckbox style="color:black; width:20px; height:20px" required="true" value="{!isboolean}"/>  
           <!--     <apex:inputField style="color:black; width:25px; height:25px" required="true" value="{!booking.I_Accept__c}"/> -->
            <font size="4.5" style="color:red" face="Foobar Pro Bold" ><b>Accepting Terms and Conditions</b> </font>

                 <br/>  <br/>  
            <font size="3" style="font-family:Ancillary Bold; color:blue"><b>DECLARATION :
                
                I / WE the Applicant/s do hereby declare that the above-mentioned particulars / information given by me / us are true and genuine to my / our best knowledge and the same are irrevocable. 
                I / WE also declare the booking terms referred to above at SL.No.1 to 14 are read over to me / us and I / WE, after understanding the said conditions are willing to book the Apartment noted above.
                
                
                </b></font>   
            
            </apex:outputPanel>
        
        </apex:pageBlock>
    </apex:form>
</apex:page>




My Controller Class:

public class BookingLinkQuestionary {
    
     public Booking_Link__c booking {get;set;}
    public Boolean isboolean {get;set;}
    public string BrenUpdateId{get;set;}
    public Bren_Update__c brenup {get;set;}
   // public Boolean isboolean {get;set;}
    
     public BookingLinkQuestionary(){
        booking = new Booking_Link__c();
       
    }
  //  public checkLongArea(ApexPages.Controller cont){
  //  BrenUpdateId = ApexPages.CurrentPage().getParameters().get('id');
  //  brenup = [SELECT id , LongTextAreA__c FROM Bren_Update__c WHERE id =: BrenUpdateId];
  //  system.debug('##' + brenup);
    

//}
    public void Submit(){
        try{
            if(isboolean){
                INSERT brenup;
            } else{
                Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,''+'No records to Display"'));
            }
        }catch (Exception e) {
            ApexPages.addMessages (e);
           
        }
        
    }
     public void cancel(){
        booking = new Booking_Link__c();
    }

}


Please help me out from this...

Any help is highly appriciated.

Thanks and Regards,
Azhar Khasim.
Hello,

I need some help in my test class which has written on Trigger.

My Test Class :

@isTest
public class AccountNameUpdate {  
  @isTest  static void updateAccount(){
        Account a = new Account();
        a.Name = 'Abhishek Gupta';
        insert a;
        Booking_Link__c bl= new Booking_Link__c();
        bl.Customer_Number__c = a.Customer_Number__pc;
        bl.T2G__c =True;
        bl.Account__c = a.Id;
        bl.OwnerId = a.OwnerId;
        update bl;
    }

}


My Trigger:

trigger AccountNameUpdate on Booking_Link__c (before insert, before update) {
    List<Account> accountList = new List<Account>();
    String CustomNumber;
    for(Booking_Link__c bl : Trigger.new)
    {       
        CustomNumber = bl.Customer_Number__c;
       
    }
    accountList = [Select Id, OwnerId, Customer_Number__pc from Account where Customer_Number__pc =:CustomNumber ];
    for(Booking_Link__c bl : Trigger.new)
    {
        for(Account a : accountList)
        {
           if(bl.Customer_Number__c == a.Customer_Number__pc && bl.T2G__c==True)
            {
                bl.Account__c = a.Id;
                bl.OwnerId = a.OwnerId;
                  
            }
        }
    }  
}

Please Help me out from this

Thanks and Regards,
Azar Khasim.


<apex:page standardController="Account" >
    <apex:form>
        <apex:sectionHeader title="Person Customer Edit" subtitle="New Customer"/>
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
                <apex:commandButton action="{!cancel}" value="cancel"/>
                </apex:pageBlockButtons>
            </apex:pageBlock>
        <apex:pageBlock>
<apex:pageBlockSection>
    <apex:pageBlockSectionItem>
<apex:outputlabel value="First Name"/>
<apex:outputpanel>
<apex:inputText value="{!salutation}" id="personSalutation"/>
<apex:inputText value="{!fname}" id="personFname"/>
</apex:outputpanel>
        </apex:pageBlockSectionItem>
</apex:pageBlockSection>
            </apex:pageBlock>
    <apex:pageBlock>
        <apex:pageBlockSection>
<apex:pageBlockSectionItem>
<apex:outputLabel value="Last Name" for="personLname"></apex:outputLabel>
<apex:inputText value="{!lname}" id="personLname"/>
</apex:pageBlockSectionItem>
           </apex:pageBlockSection> 
            </apex:pageBlock>
    </apex:form>
</apex:page>

this is my code which i was unable to do.
My Error: Unknown property 'AccountStandardController.salutation'
Actually I want to send the Automated birthday email notification whose birthdate is excactly equal to system. today() day and month. suppose i am having one custoom object named client and under that object there is custom field named Date Of Birth and email...and what i want is I want to schedule this every day and if the d.o.b filed data in exsisting record in client object day and month is equal to system.today() day and month then send the email to that all that records whose birthdate is today and also send email to that one more client whose email i had put it by hard coding.. i had used this logic.. but failed.. I checked on apex job it shows error email is null.... i hope you all understand... what I am trying to do..plz help
global class sendGreetingWishes implements Database.Batchable<sObject>
{
 string query;
 global Database.querylocator start(Database.BatchableContext bc)
 {
  String query= 'SELECT Id, Name, email__c,birthday__c FROM stud__c';
  return Database.getQueryLocator(query);
 }

global void execute(Database.BatchableContext bc, List<stud__c> scope)
{
 for(stud__c iteratorUser : scope)
 {
   date thisdate=system.today();
   integer sysday=thisdate.day();
   integer sysmonth=thisdate.month();
   string dayandmonth=sysday+'/'+sysmonth;
   Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
   List<String> toAddresses = new List<String>();
   toAddresses.add(iteratorUser.email__c);
   email.setToAddresses(toAddresses);
   List<String> ccAddresses = new List<String>();
   ccAddresses.add('pranavlakshya009@gmail.com');
   email.setCcAddresses(ccAddresses);
   email.setSubject('Happy Birthday. Have a blast — Birthday Reminder!');
   String message = 'Happy Birthday';
   email.setHtmlBody(message);
   Messaging.sendEmail(new Messaging.SingleEmailMessage[]{email});
 }
}

 global void finish(Database.batchableContext bc)
 {
 }
}

 
I have an text area field for the description of my case.
<apex:inputTextArea label="Description" value="{!Case.Description}" cols="120" rows="10" />

and for the view the output is as follows:
<apex:outputText label="Description" value="{!Case.Description}" style="word-wrap:break-word;white-space: normal" />

If I enter a lot of information with brakes or any type of formatting, after I save it, it turns into a one paragraph, no format at all.
I tried the word wrap CSS style, but still doing the same thing. Any ideas?
User-added image