• VivekShinde
  • NEWBIE
  • 100 Points
  • Member since 2013
  • Technical Lead
  • Eternus Solutions Pvt. Ltd.

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 29
    Replies
Hi all,

I have a Map in which i have Sobject fields and labels and i am adding these labels to my wraper list and showing it on VF page.
I want to show only the custom field labels here. So i am trying to add condition while adding the labels in wrapper list...but cannot do it.
Can you help? Here is my code:
APEX class::



public class getLabel{

Public Proposal_Form__c pfc = new Proposal_Form__c();
public List<WrapperClass> listWrapper {get;set;}
public Map<String,String> labelMap;
public String resultString {get;set;} 
public ApexPages.StandardController controller; 

public getLabel(ApexPages.StandardController Controller) {
    pfc = (Proposal_Form__c)Controller.getRecord(); 
    this.controller = Controller;  
    listWrapper = new List<WrapperClass>();
    labelMap = new Map<String,String>();
    labelMap = retLabelMap('ProposalFields__c');
    system.debug('******LabelMap***'+labelMap);
        for(String s : labelMap.values()){
            listWrapper.add(new WrapperClass(s,false));
        }
       
   }

public class WrapperClass {  
    public Boolean checkBool {get;set;}
    public String fieldNme{get;set;}  
    public WrapperClass(String prop,Boolean checkBool ){  
        this.fieldNme = prop;  
        this.checkBool = checkBool ;  
    }  
}

public Static Map<String,String> retLabelMap(String type){
    Map<String, Schema.SObjectType> m = Schema.getGlobalDescribe();
    Schema.SObjectType s= m.get(type);
    Map<String, Schema.SObjectField> fieldMap = s.getDescribe().fields.getMap();
    Map<String,String> aMap = new Map<String,String>();
    for (String fieldName: fieldMap.keySet()) {
        aMap.put(fieldName,fieldMap.get(fieldName).getDescribe().getLabel());
    }
    return aMap;
}

public PageReference saveCheckboxValue(){
   if(listWrapper!=null && listWrapper.size()>0){
        for(WrapperClass w : listWrapper){
            if(w.checkBool == true){
              
                   if(resultString!=null){
                        resultString = resultString + '\n'+ w.fieldNme;
                   }
                   else{
                        resultString = w.fieldNme;
                   }
            }
          }
        }
     
     pfc.Fields_Associated__c = resultString; 
     try
     {
         insert pfc;
         PageReference pg = new PageReference('/'+pfc.id);
         return pg;
     }
     catch(dmlexception e)
     {
           apexpages.addmessages(e);
           return null;
     }

}
}
I am trying to add some if condition in the bold part of my code.

Thanks,
Amita
 
Hi there,
i did a method supposed to redirct into Quote details page, but it doesnt couldyou help please.
the method is excuted success, but redirect doesn't work.
qid is the ID of the quote.

Many thanks
public PageReference redirectQ(id qid){
        System.debug('STARTING redirectQ: '+qid);
		quote q = [SELECT id, name FROM QUOTE WHERE id=:qid];
         System.debug('quote q: '+ q);
        PageReference QuotePage = new PageReference(qid);
        System.debug('QuotePage: ' + QuotePage);
        QuotePage.setRedirect(true);
        return QuotePage;
    }

 
Hello Guys  I am facing the issue  last  few days let me know if anyone have good idea about this issue. I also got the 100% code coeverage of the class but the method is going fail with Methods defined as TestMethod do not support Web service callouts in Test class..Error
global with Sharing class WebserviceCreateCME {
    
    
    webservice static Void CreateCME(Id ContractId)
    {
      
        CreateCasesByContract.CreateCase();
        
    }
    
    
}
Test Class 
@isTest
Public with Sharing class TestWebserviceCreateCME {
    @IsTest Static void WebserviceTestMethod()
        
    {  
            
        Id retailRecordTypeId = [ SELECT Id,Name FROM RecordType WHERE name='Retail Contract' AND SObjectType='Contract' limit 1].Id;
        
        NAICS_Code__c nacObj = new NAICS_Code__c(
            name = 'nac code01');
        
        insert nacObj;
        
        Leasing_Agent__c l = new Leasing_Agent__c(
            name = 'Name',
            EmployeeID__c = 12,
            InActiveDate__c = date.today(),
            IS_ACTIVE__c = true,
            LeasingAgentID__c = 14
        );
        
        insert l;
        
        BP_Property__c bp_property = new BP_Property__c(
            name = 'BP_Property__c',
            AvailableArea__c = 22402,
            AvailableCount__c = 28,
            BD_Owner_Entity_ID__c = 45,
            BD_Property_ID__c = 32,
            Building_Count__c = 1,
            Colloquial_Owner__c = 'David Haug',
            InActiveDate__c = date.today(),
            IS_ACTIVE__c = true,
            Leasing_Agent__c = l.id,
            Lender__c = 'lender',            
            Market_Name__c =  'market name',
            Occupancy__c = 46,
            Owner_Entity__c = 'owner entity',
            Pay_To_Name__c = 'pay to name',
            Payment_Address__c = 'payment address',
            Payment_City__c = 'payment city',
            Payment_State__c = 'payment state',
            Payment_Suite__c = 'suite',
            Payment_Zip__c = '12323',
            PropChargeCAM__c = 47,
            PropChargeElectric__c = 1234,
            PropChargeNNN__c = 48,
            PropCurrentYearExpenses__c = 49,
            Property_Fax__c = '1231231234',
            Property_City__c = 'property city',
            Property_Code__c = 'property code',
            Property_ID__c = 49,
            Property_Manager__c = 'manager',
            Property_Name__c = 'property name',
            Property_SQFT__c = 49,
            Property_State__c = 'property state',
            Property_Street__c = 'property street',
            Property_Zip__c = '12312',
            PropGrossArea_c__c = 1234
        );
        
        insert bp_property;
        
        Building__c building = new Building__c(
            name = 'building name',
            PropertyIDYardi__c = 1227,
            PropertyIDBD__c = 23,
            PropertyCode__c = 'm2323dh',
            BuildingIDBD__c = 33,
            Building_State__c = 'building state',
            BuildingStreet__c = 'building street',
            BuildingZip__c = '12312',
            Building_City__c = 'building city',
            IS_ACTIVE__c = true,
            BDBuildingName__c = '2323 South Voss Rd',
            Google_Review_URL__c = 'http://www.google.com',
            Yelp_Review_URL__c = 'http://www.yelp.com',
            InActiveDate__c = date.today(),
            BldgGrossArea__c = 40,
            BP_Property__c = bp_property.id
        );
        
        insert building;
        
        BP_Unit__c bp_unit = new BP_Unit__c(
            name = 'bp unit name',
            BD_Availability_Status__c = 'status',
            BD_BuildingID__c = 50,
            BD_PropertyID__c = 51,
            BD_UnitID__c = 52,
            BD_UnitNum__c = '53',
            BP_Property__c = bp_property.id,
            Building__c = building.id,
            InActiveDate__c = date.today(),
            IS_ACTIVE__c = true,
            SF_Unit_Status__c = 'status',
            Size__c = 54,
            Type__c = 'type',
            Unit_Rate__c = 55,
            Unit_Recommended_Rent__c = 56,
            Unit_Sub_Category__c = 'sub category',
            Yardi_Unit_ID__c = 57,
            Yardi_Unit_Num__c = 'unit num');
        
        insert bp_unit;
        
        Account account = new Account(
            name = 'account name',
            type = 'owner',
            NAICS_Code__c = nacObj.Id,
            NAICS_Code_4__c = 'Accounting, Tax Preparation, Bookkeeping, and Payroll Services | 5412',
            Industry = 'Energy');
        
        insert account;
        
        Contact contact = new Contact(
            lastname = 'nguyen',
            accountid = account.id);
        
        insert contact;     
        
        Contact contractContact = new Contact(
            lastname = 'test',
            MailingStreet  = 'MailingStreet',
            MailingCity = 'MailingCity',
            MailingState = 'MailingState',
            MailingPostalCode = 'MailingPostalCode',
            
            accountid = account.id);
        
        insert contractContact; 
        
        Account brokeraccount = new Account(
            name = 'broker account',
            type = 'owner');
        
        insert brokeraccount;
        
        Opportunity Oppt = new Opportunity(
            Name='test opportunity', 
            Status__c = 'Actively Looking',            
            StageName='Initial Inquiry', 
            CloseDate= system.today(),
            Leasing_Agent__c = l.id,
            AccountID = account.id,
            LeadSource = 'Test Lead Source',
            Commencement_Date__c = Date.today(),
            Lease_Expiration_Date__c = Date.today(),
            Lease_Signed_Date__c = Date.today(),
            Lease_Square_Feet__c = 12345,
            Suite__c = 'Test Suite',
            Preferred_size__c = '100-500');
        
        Insert Oppt;
        
        Contract c = new Contract(
            Absorbed_Explanation__c = 'explanation',
            Additional_Monthly_Charge_Notes__c = 'notes',
            After_hour_Utilities_Detail__c = 'utility details',
            After_hour_Utilities__c = 'yes',
            ATTN__c = 'attn',
            Breakpoint__c = 6,
            Broker_Comm_Paid__c = 7,
            Brokerage_services_info_given__c = 'info given',
            Broker__c = contact.Id,
            Broker_involved__c = 'Yes',
            CAM__c = 8,
            Rent_Commencement_Date__c = date.today(),
            Comments__c = 'comments',
            Net_TI__c = 9,
            ETIC__c = 10,
            Other_Expenses__c = 11,
            Space_Leased__c = '12',
            Tenant_Prepaid__c = 13,
            TI_Applied_To__c = 'Free Rent',
            TI_Credit__c = 14,
            Other_Description__c = 'other description', 
            Contact_Email__c = 'minh@email.com',
            Base_Mo_Yr__c = date.today(),
            CPI_Cap__c = 15,
            Deposit_Transfer_Amount__c = 16,
            Elec__c = 17,
            Elec_Options__c = 'elec options',
            Escalation_Cap__c = 3,
            X1st_Mth_Rent_Received__c = 'first month rent recieved',     
            Guarantor__c = contact.id,
            Holdover_Lease_Backdated__c = 'holdover lease backdated',
            Holdover_Not_Std__c = 17,
            How_Long__c = date.today(),
            Initial_Agreement_Start_Date__c = date.today(),
            Insurance__c = 18,
            Lease_Agreement__c = 'lease agreement',
            Lease_Type__c = 'lease type',
            Lease_Type_Comments__c = 'lease comments',
            MLS_Comment__c = 'mls comment',
            MLS_Type__c = 'Lease',
            Non_Standard_Fee_Desc__c = 'non std fee desc',
            Non_Std_Fee__c = '24',
            OPEX_Base__c = date.today(),
            OPEX_Stop__c = 25,
            Other_Monthly_Charge__c = 26,
            Other_Monthly_Charge_Desc__c = 'monthly charge desc',
            Other_Provisions__c = 'other provisions',
            Parking__c = 27,
            PT_Other_Desc__c = 'pt other desc',
            PT_Type__c = 'type',
            Payment_not_in_full_details__c = 'payment not in full details',
            Payment_Type__c = 'payment type',
            Percent_Rent__c = 28,
            Prior_Annual_Rate__c = 29,
            Pro_Rata_Share__c = 30,
            Promo_Mktg__c = 31,
            Renewal_Option_Detail__c = 'renewal option detail',
            Renewal_Option__c = 'renewal option',
            Rent_Adjustment__c = 'rent adjustment',
            Reserved_Parking_Detail__c = 'reserved parking detail',
            Reserved_Parking__c = 'reserved parking', 
            Right_of_First_Refusal_Detail__c = 'refusal detail',
            Right_of_First_Refusal__c = 'first refusal', 
            Security_Deposit__c = 32,
            Security_Deposit_Received__c = '33',
            Signage__c = 34,
            Special_Provisions__c = 'special provisions',
            Storage__c = 76,
            Taxes__c = 35,
            Tenant_From__c = 'tenant from',
            Term_Type__c = 'term type',
            Termination_Option_Date__c = date.today(),
            Termination_Option_Detail__c = 'termination option detail',
            Termination_Option__c = 'termination option',         
            Unit_Num_On_Lease__c = 'a02',
            USA_Patriot_Act__c = 'usa patriot act',        
            Prorated_rent_due__c = 37,
            What_Happened__c = 'what happened',
            Late_Fee_Pct__c = 38,
            Rent_Due_Date__c = 'rent due date',
            Hold_Over_Percentage__c = 39,
            //MLS_TRAN_ID__c,
            deactivation_reason__c = 'deactivation reason',
            deactivation_date__c = date.today(),
            CME_Case_ID__c = 40,
            accountid = account.id,
            Building__c = building.id,
            BP_Unit__c = bp_unit.id,
            Manual_Contract_End_Date__c = system.today(),
            Status = 'Lease Signed By Tenant',
            Contract_Contact__c = contractContact.Id,
            CustomerSignedDate = system.today(),            
            Opportunity__c = oppt.id,
            RecordTypeID = retailRecordTypeId
        );
        
        
        insert c;
        
        
        WebserviceCreateCME.CreateCME(c.Id);
    }
}




  • April 07, 2017
  • Like
  • 0
I'm facing a weird issue when a datetime is converted to date between midnight and 1 AM ET (Eastern Time). We're facing the issue after the day light saving which is post 12th March 2017.

We're fetching the current date and time using system.now() method. The datetime is returned in GMT timezone.

If the current datetime is 3/21/2017 12.15 AM, then the GMT returned by the system.now() mehtod is 4.15 AM. 4 hours are added in the time since, ET is 4 hours behind GMT.

Now, we're making use of the DateTime class's instance method, format('EEE') to get the current day. For the stated date in the example, the day comes out to be Tuesday. Based on this day, we've some calculations which determine the number of days to be subtracted from the datetime instance.

Suppose, it is determined that we want to subtract 2 days and get the date. After subtracting 2 days from the datetime 3/21/2017 12.15 AM, we're getting datetime as 3/19/17 12.15 AM.

We want the date component from this datetime, hence are making use of the DateTime class' instace method date() to fetch the date. But, the datetime is converted to date, it is returning 3/18/2017 instead of 3/19/2017. The date() method returns date in local timezone and I believe that when the datetime is converted to date, the date is getting calculated by subtracting 5 hours instead of 4 hours to get the date in local timezone which is ET.

Any help regarding understanding the reason behind this will be much obiliged. Thanks in advance!

Hi All,

 

Hope all are doing well.

I'm facing a problem which I have never faced earlier doesn't know what exactly is the problem. Kindly help me to find the solution.

 

I have following page and controller code snippet:

 

---- VF Page code ----

<apex:page controller="MyController">

    <apex:form id="formId">

 

        <apex:pageBlock>

            <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Save" action="{!saveNewStudent}"/>
                <apex:commandButton value="Cancel" action="{!cancelNewStudent}"/>
            </apex:pageBlockButtons>

 

            <table cellspacing="5px" cellpadding="10px">
                                
                <tr>
                    <td style="width:270px; vertical-align:top;">
                        <apex:outputLabel styleClass="outputLabelClass" value="{!$ObjectType.Student__c.fields.Name.label}"/><br/>
                        <apex:inputField styleClass="inputFieldClass" value="{!objStudent.Name}"/>
                     </td>
                 </tr>
                                
              </table>

        </apex:pageBlock>

    </apex:form>

</page>

 

-------Controller code------------

public with sharing class MyController
{

    public Student__c objStudent{get; set;}

 

    public MyController()

    {

        objStudent = new Student__c();

    }

 

    public void saveNewStudent()
    {
        system.debug('------objStudent.Name-----'+objStudent.Name);
        if(objStudent.Name != null && objStudent.Name != '')
        {
            //Some logic
        }
        else
        {
            ApexPages.addMessage(new ApexPages.message(ApexPages.severity.Error,'The name cannot be left  blank.'));
        }
    }

}

 

-------My Problem-------

My problem is that when I click on the "Save Button" then in the debug the value for the Student object's standard name field is coming NULL. (The data type of standard name field is text)

But when I use a custom field instead of standard name field then the value is getting reflected in the debug log. Doesn't know what is the main source of problem.

 

Also, there is no validation rule or other required field for the custom object which is obstructing the save operation.

 

 

Thanks,

Vivek Shinde

Hi all,

I have a Map in which i have Sobject fields and labels and i am adding these labels to my wraper list and showing it on VF page.
I want to show only the custom field labels here. So i am trying to add condition while adding the labels in wrapper list...but cannot do it.
Can you help? Here is my code:
APEX class::



public class getLabel{

Public Proposal_Form__c pfc = new Proposal_Form__c();
public List<WrapperClass> listWrapper {get;set;}
public Map<String,String> labelMap;
public String resultString {get;set;} 
public ApexPages.StandardController controller; 

public getLabel(ApexPages.StandardController Controller) {
    pfc = (Proposal_Form__c)Controller.getRecord(); 
    this.controller = Controller;  
    listWrapper = new List<WrapperClass>();
    labelMap = new Map<String,String>();
    labelMap = retLabelMap('ProposalFields__c');
    system.debug('******LabelMap***'+labelMap);
        for(String s : labelMap.values()){
            listWrapper.add(new WrapperClass(s,false));
        }
       
   }

public class WrapperClass {  
    public Boolean checkBool {get;set;}
    public String fieldNme{get;set;}  
    public WrapperClass(String prop,Boolean checkBool ){  
        this.fieldNme = prop;  
        this.checkBool = checkBool ;  
    }  
}

public Static Map<String,String> retLabelMap(String type){
    Map<String, Schema.SObjectType> m = Schema.getGlobalDescribe();
    Schema.SObjectType s= m.get(type);
    Map<String, Schema.SObjectField> fieldMap = s.getDescribe().fields.getMap();
    Map<String,String> aMap = new Map<String,String>();
    for (String fieldName: fieldMap.keySet()) {
        aMap.put(fieldName,fieldMap.get(fieldName).getDescribe().getLabel());
    }
    return aMap;
}

public PageReference saveCheckboxValue(){
   if(listWrapper!=null && listWrapper.size()>0){
        for(WrapperClass w : listWrapper){
            if(w.checkBool == true){
              
                   if(resultString!=null){
                        resultString = resultString + '\n'+ w.fieldNme;
                   }
                   else{
                        resultString = w.fieldNme;
                   }
            }
          }
        }
     
     pfc.Fields_Associated__c = resultString; 
     try
     {
         insert pfc;
         PageReference pg = new PageReference('/'+pfc.id);
         return pg;
     }
     catch(dmlexception e)
     {
           apexpages.addmessages(e);
           return null;
     }

}
}
I am trying to add some if condition in the bold part of my code.

Thanks,
Amita
 
Hello Experts,
  • I have one apex class and I displaying the list of fileds from FieldSet on VF page.
  • There are some input fields, which i want in my apex code.
    <!-- VF Page Snippet-->
    *******
    *******
    <apex:repeat value="{!fields}" var="f">
          <apex:outputText value="{!f.Label}"/>
          <apex:inputText WHAT_LOGIC_I_SHOULD_USE_HERE />  <br/>
    </apex:repeat>
    *******
    *******
    
    /* Apex Code Snippet  */
    
    public List<Schema.FieldSetMember> getFields() 
    {
          return SObjectType.Contact.FieldSets.Quiz_Field_Set.getFields();
    }
  • Whatever values I put into Input Text Box, that all value I want into my Apex Code.
even also i am using readonly  atribute ,  geting same error please do the needful,

Collection size 10,028 exceeds maximum size of 10,000. 


<apex:page controller="Leaddisplay" readOnly="true">

       <apex:pageBlock >
           <apex:DataTable value="{!ld}" var="a">
               <apex:column value="{!a.Lastname}"  headerValue="LastName"/>
            <apex:column value="{!a.company}"  headerValue="companyName"/>
               <apex:column value="{!a.status}"  headerValue="LeadStatus"/>
                     <apex:column value="{!a.phone}"  headerValue="phone"/>
               </apex:DataTable>
             
                 </apex:pageBlock>
      </apex:page>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>....


public class Leaddisplay {
    public list<lead>ld{set;get;}
    public Leaddisplay(){
       // ld= new list<lead>();
       ld=[select  lastname,phone,company,status from lead];
        
    }

}

  
 
Hello,

I am looking for way to override the standard Recent account pages.
User-added image
Basically, I want to remove the New button, and keeping rest as it is.
I donot want to consume new tab

Thanks for suggestion
  • April 19, 2017
  • Like
  • 1
Hey,
I have an image in static resource which is getting used in the css property of a div on a vf page. In my developer org, it is working fine. But when i make the managed package and install it in some other org, 404 Not Found error is thrown. The static resource is not getting found. I have checked in the resources and the resource has been included in the package and image is present as well. But somehow it does seem to be found in the package.

Thanks
Shubham Jha 
 
Below is the code for update button and the text panel on the vf page

 <div id="UpdateButton">
                            UPDATE
                        </div>

<input id="textpaneljs" type="text" name="txt" size="35" value="{!myoutput}"/></div>   

I have written the below code on the vf page

<apex:actionFunction name="update" action="{!update}" rerender="">                                                                                                                                                                                              
<apex:param name="companyname" value=""  />                                                                                                                       
</apex:actionFunction>

then on the apex class

public void update(){
      
        String CName = ApexPages.currentPage().getParameters().get('companyname');
        system.debug('the customized 123 are '+CName);        
        
    }

then on jquery in static resource

var companyname = j$('#textpaneljs').val();
function setupClickEvents(){
j$('#cockpitUpdateButton').click(function(){
update(companyname);
});
}

On the system debug statemnet I am getting only null
  • April 18, 2017
  • Like
  • 0
want insert selected radio option from vf page
<apex:page controller="OnlineFeed" id="testpage">
    <apex:form id="theform" >
        <apex:pageBlock title="OnlineFeedback" id="pb">
            <apex:pageBlockSection columns="1" title="RegistrationForm" collapsible="false" >
                <apex:pageBlockSectionItem id="pbsi1">
                    <apex:outputLabel >Name:</apex:outputLabel>
                    <apex:inputText value="{!TName}" />
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem id="pbsi2">
                    <apex:outputLabel >Email:</apex:outputLabel>
                    <apex:inputText value="{!TEmail}" />
                    
                </apex:pageBlockSectionItem> 
            </apex:pageBlockSection>
            <apex:outputLabel >How satisfied were you with:</apex:outputLabel><br/>
            <h1>Key point #1</h1><br/>
            
            
            <input class="radioBtn" type="radio" name="order" onchange="getSelectedValue()" value="Very Satisfied"/>Very Satisfied
            <input class="radioBtn" type="radio" name="order" onchange="getSelectedValue()" value="Satisfied" />Satisfied
            <input class="radioBtn" type="radio" name="order" onchange="getSelectedValue()" value="Neutral" />Neutral
            <input class="radioBtn" type="radio" name="order" onchange="getSelectedValue()" value="Unsatisfied" />Unsatisfied
            <input class="radioBtn" type="radio" name="order" onchange="getSelectedValue()" value="veryUnsatisfied" />veryUnsatisfied<br/>
            
            <apex:outputLabel >Feel free to add any other comments or suggestions:</apex:outputLabel><br/>
            <apex:inputTextarea cols="30" rows="10"/><br/>
            <apex:outputText >* The information given within the Feedback Form will be used for service improvement only and are strictly confidential.</apex:outputText>
            
            
            
            <apex:commandButton title="save" onclick="getSelectedValue();" action="{!submitted}" value="save" >
              
                
            </apex:commandButton>
        
        </apex:pageBlock>
     
        
    </apex:form>
    <script>
    
    function getSelectedValue() {
        var radioBtns = document.getElementsByClassName("radioBtn");
        for(var i = 0; i < radioBtns.length; i++){
            if(radioBtns[i].checked)   
            {
                alert( 'button checked :'+radioBtns[i].value);
                document.getElementById("key1").value =radioBtns[i].value; 
                
                alert( 'button checked :'+radioBtns[i].value);
                document.getElementById("key2").value=radioBtns[i].value;
                alert( 'button checked :'+radioBtns[i].value);
                document.getElementById("key3").value=radioBtns[i].value;
                alert('button checked:'+radioBtns[i].value);
                document.getElementById("key4").value=radioBtns[i].value;
                alert('button checked:'+radioBtns[i].value);
                document.getElementById("key5").value=radioBtns[i].value;
                alert('button checked:'+radioBtns[i].value);
                var key1=radiBtns[i].value;
                return false ;
            }
            
                
        }
    }
        </script>
</apex:page>






public class OnlineFeed {
    public string TName{set;get;}
    public string TEmail{set;get;}
    public string  key1 {set;get;}
    //public string getSelectedValue{set;get;}
    public string key2{set;get;}
    public string key3{set;get;}
    public string key4{set;get;}
    public string key5{set;get;}
    
   public OnlineFeed(){
        
        TName='';
        TEmail='';
        key1= ''; 
        key2='';
        key3='';
        key4='';
        key5='';
        
    }
    
    public void submitted(){
        RegistrationForm__c r=new RegistrationForm__c();
        r.Name = TName;
        r.Email__c=TEmail;
        r.Key_point_1__c=key1;
        r.Key_point_2__c=key2;
        r.Key_point_3__c=key3;
        r.Key_point_4__c=key4;
        r.Key_point_5__c=key5;
        insert r;
        
        
    }
    

}
Hi there,

I have a Visualforce page that allows for editing of rows in a table. My problem is, I can't figure out what is causing the 'forcus' to be initially placed on the calendar of the first row of my visualforce object, and consiquently causing the calendar to display. I don't want the calednar to display unless someone clicks on it. My visualforce code is below, and a screenshot is attached.

Thank you in advance for your assistance.

<apex:page standardController="Request__c" extensions="TrController" >
    <!--Because we will be defining 'Input' fields, we must wrap our code in a 'Form' block. -->
    <apex:form id="Time_Entry_Form">
        <apex:pageBlock title="CDCR - Salesforce Time Reporting for Requests" id="Time_Entry_List">
           
            <!-- The following pageBlockButtons segment defines the two buttons that appear at the top of the Time entry form. -->
            <apex:pageBlockButtons id="Button_area">
                <!-- The following Button is defined in a more complicated fashion so that a parameter can be passed. -->
                <apex:commandLink >
                    <a href="javascript: CurrRequest('{!Request__c.Id}');" class="btn">New</a>               
                </apex:commandLink>
                <apex:commandButton value="Save" action="{!save}"/>
            </apex:pageBlockButtons>
           
             <!-- The following pageBlockTable segment defines the time entry rows that will be displayed. -->
            <apex:pageBlockTable value="{!TimeEntries}" var="entry" id="Entry_Table_List">
                <apex:column width="45" headerValue="Action">
                    <a href="javascript:if (window.confirm('Are you sure?')) DeleteEntry('{!entry.Id}');" style="font-weight:bold">Del</a>               
                </apex:column>   
                <apex:column width="70" headerValue="Activity">
                    <apex:inputField value="{!entry.Activity__c}"/>
                </apex:column>   
                <apex:column headerValue="Date Worked">
                    <apex:inputField value="{!entry.Date_Worked__c}"/>
                </apex:column>   
                <apex:column width="20" headerValue="Hours">
                    <apex:inputField value="{!entry.Hours_Worked__c}"/>
                </apex:column>   
                <apex:column width="20" headerValue="Worked">
                    <apex:inputField value="{!entry.Minutes_Worked__c}"/>
                </apex:column>   
                <apex:column headerValue="Work Description">
                    <apex:inputField style="width:100%" value="{!entry.Work_Description__c}"/>
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>
        <!-- This action block is executed based on the 'Delete' button being clicked on. -->
        <apex:actionFunction action="{!del}" name="DeleteEntry" reRender="Time_Entry_List">
            <apex:param name="EntryID" value="" assignTo="{!SelectedEntryID}"/>
        </apex:actionFunction>
       
         <!-- This action block is executed based on the 'New' button being clicked on. -->
        <apex:actionFunction action="{!add}" name="CurrRequest" reRender="Time_Entry_List">
            <apex:param name="EntryID" value="" assignTo="{!ReqID}"/>
        </apex:actionFunction>

    </apex:form>
</apex:page>

User-added image
Response code: 400
Error,  { "error": { "code": "BadRequest", "message": "The MIME type 'text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2' requires a '/' character between type and subtype, such as 'text/plain'.", "innerError": { "request-id": "822a994e-6ef7-4c4c-bd27-5b96186165f0", "date": "2017-04-13T13:44:15" } } }

        HttpRequest req = new HttpRequest();
        req.setMethod('GET');
        req.setHeader('Content-Type', 'application/json');
        req.setHeader('Authorization', 'Bearer '+ accessToken);
        req.setEndpoint('https://graph.microsoft.com/v1.0/me/drive/root');      
        HttpResponse res = h.send(req);
I want the dialog popup to display only when the checkbox is checked, but this code displys when checked and unchecked. I want a different pop up for uncheck..How do I write that script?
checkbox code
<input id="showprompt" type="checkbox" name="CO_BRAND" value="cobrand"  onclick="ShowPrompt()" /> 

Javascript Code

<script>
    
var checkmodal = document.getElementById('checkboxModal');
var btn = document.getElementById("showprompt");
var span = document.getElementsByClassName("checkboxclose")[0];


function ShowPrompt()

{
  checkmodal.style.display = "block";
  
}

span.onclick = function() {
    checkmodal.style.display = "none";
}

window.onclick = function(event) {
    if (event.target == modal) {
        checkmodal.style.display = "none";
    }
}
  • April 13, 2017
  • Like
  • 0
Hi friends,
I am having problem for code coverage. My class and Test classes are as below:
Class:
********************************
global with sharing class NavikUtilityClass {
    global Static HttpResponse callSendToNavikAuthentication(String endURL,String methodType,String methodFunctional,String accNum, String contact, String recommendation,Integer dataId, List<SendToInbox.response> input,List<String> dataIds) {
        String baseUrl = EndPoint__c.getvalues('BaseURL').EndPointURL__c;
        navikAuthDomain.response mapResp = navikAuthentication.getMapId(UserInfo.getUserEmail());
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setHeader('sessionToken',mapResp.sessionToken);
        request.setMethod(methodType);
        if(methodFunctional == 'ACTIVITY'){
            request.setEndpoint(baseUrl + '/' + endURL);
        }
        
       
        if(methodFunctional == 'DRILLDOWN'){
            request.setEndpoint(baseUrl + '/' + endURL);
            String accNo = EncodingUtil.urlEncode(accNum,'UTF-8');
            String cont = EncodingUtil.urlEncode(contact,'UTF-8');
            String recom = EncodingUtil.urlEncode(recommendation,'UTF-8');
            request.setBody('accountNumber='+accNo+'&contact='+cont+'&recommendation='+recom);
        }
        if(methodFunctional == 'SPECIFICRECOMM'){
            request.setHeader('content-type', 'application/json');
            request.setHeader('Accept', 'application/json');
            request.setEndpoint(baseUrl + '/' + endURL);
            request.setEndpoint(baseUrl + '/'+endURL+dataId);
        }
        if(methodFunctional == 'SENDEMAIL'){
            request.setHeader('content-type', 'application/json');
            request.setHeader('Accept', 'application/json');
            request.setEndpoint(baseUrl + '/' + endURL);
            String s = JSON.serialize(input);
            request.setBody(s);
        }
        if(methodFunctional == 'INVALID'){
            request.setHeader('content-type', 'application/json');
            request.setHeader('Accept', 'application/json');
            request.setEndpoint(baseUrl + '/' + endURL);
            request.setBody(JSON.serializePretty(dataIds));
        }
        HttpResponse response = null;
         try {
                response = http.send(request);
            } catch(System.CalloutException e) {
                System.debug('Callout error: '+ e);
                System.debug(response.toString());
            }
        return response;  
    }   
}

********
Test class
*********************
@isTest
public class NavikUtilityClassTest{
    public static testmethod void utilitytest() {
        List<String> dataIds;
        dataIds.add('abcd');
        Test.startTest();
        Test.setMock(HttpCalloutMock.class, new NavikUtilityClassMocGenerator());
        HttpResponse res = NavikUtilityClass.callSendToNavikAuthentication('http://api.salesforce.com/foo/bar', 'Testmethod', 'abc', '5142433683738', 'allen', 'recom', 27524, Null, dataIds);
        String contentType = res.getHeader('Content-Type');
        System.assert(contentType == 'application/json');
        String actualValue = res.getBody();
        String expectedValue = '{"foo":"bar"}';
        System.assertEquals(actualValue, expectedValue);
        System.assertEquals(200, res.getStatusCode());
    Test.stopTest();
    }
   

}
  • April 12, 2017
  • Like
  • 0
For some reason, I can not get my 'Delete' 'Commandlink' to appear even though it is coded. Please take a look at the screen shot that is attached. As you can see, I have the 'CommandLink' is coded, but no command link is showing up on the list.

Here is the code:

<apex:page standardController="Request__c" extensions="TrController">
    <!--Because we will be defining 'Input' fields, we must wrap our code in a 'Form' block. -->
    <apex:form >
        <apex:pageBlock title="CDCR - Salesforce Time Reporting for Requests">
            <apex:pageBlockButtons >
                <apex:commandButton value="Insert" action="{!add}"/>
                <apex:commandButton value="Save" action="{!save}"/>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!TimeEntries}" var="entry">
                <apex:commandLink action="{!del}" value="Delete" id="theCommandLink"/>
                <apex:column width="70" headerValue="Activity">
                    <apex:inputField value="{!entry.Activity__c}"/>
                </apex:column>   
                <apex:column width="30" headerValue="Date Worked">
                    <apex:inputField value="{!entry.Date_Worked__c}"/>
                </apex:column>   
                <apex:column width="20" headerValue="Hours">
                    <apex:inputField value="{!entry.Hours_Worked__c}"/>
                </apex:column>   
                <apex:column width="20" headerValue="Worked">
                    <apex:inputField value="{!entry.Minutes_Worked__c}"/>
                </apex:column>   
                <apex:column headerValue="Work Description">
                    <apex:inputField style="width:100%" value="{!entry.Work_Description__c}"/>
                </apex:column>   
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>User-added image

Thank you in advance for your assistance.
Hi,   If i click on "edit" text in the below image, then i need to hide all the <apexoutputext> tag in that row and display all <apex:inputtext> tags in that same row where i click the "edit" text. So I need to get the siblings ids <apexoutputext> tag.  Please help to solve this. 

User-added image

 
<apex:pageBlockTable value="{!categories}" var="c">
          <apex:column width="25px">
            <apex:inputCheckbox value="{!c.checked}"/>
          </apex:column>
          
           
        <apex:column headerValue="LastName" >  <apex:outputtext value="{!c.cat.LastName}"  id="lOutname" styleclass="outval"/>
                                                <apex:inputtext value="{!c.cat.LastName}" id="linname" styleclass="inpval"/> 
        </apex:column>
                       
        <apex:column headerValue="FirstName">   <apex:outputtext value="{!c.cat.FirstName}"  id="fOutname" styleclass="outval"/>
                                                <apex:inputtext value="{!c.cat.FirstName}" id="finname" styleclass="inpval"/>
        </apex:column>
        
        <apex:column headerValue="Department" >   <apex:outputtext value="{!c.cat.department}" id="Outdept" styleclass="outval"/>
                                                   <apex:inputtext value="{!c.cat.department}"   id="indept" styleclass="inpval"/>
        </apex:column>
        
        <apex:column headerValue="Edit/Save" > 
                                               <div id="editrow" onclick="editrow()"> Edit </div>  
                                               <div id="saverow"> Save </div> 
        </apex:column>
      

        </apex:pageBlockTable>

 
Hi there,
i did a method supposed to redirct into Quote details page, but it doesnt couldyou help please.
the method is excuted success, but redirect doesn't work.
qid is the ID of the quote.

Many thanks
public PageReference redirectQ(id qid){
        System.debug('STARTING redirectQ: '+qid);
		quote q = [SELECT id, name FROM QUOTE WHERE id=:qid];
         System.debug('quote q: '+ q);
        PageReference QuotePage = new PageReference(qid);
        System.debug('QuotePage: ' + QuotePage);
        QuotePage.setRedirect(true);
        return QuotePage;
    }