• Sohan Raj Gupta
  • NEWBIE
  • 445 Points
  • Member since 2017
  • Sr. Associate Projects
  • Cognizant Technology Solutions


  • Chatter
    Feed
  • 16
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 81
    Replies
Hello Developers,

In VF email template want Amount field to be rendered based on IF condition like if currency is JYP or USD then render.
<div style="{!IF({!relatedTo.Related_Opportunity__r.CurrencyIsoCode}='JYP', 'display:block', 'display:none')}" >            
Amount : <apex:outputText value="{!relatedTo.CurrencyIsoCode}" rendered="true" /> 
</div>

Please Note: I do not want to go for controller want to achive this through VF Email template only.

Thanks
Mehul
 
Hi,

in my VF i am insert record in account on click of button.. but after clicking save button it creates record in database but at this stage only when i refresh page(F5 .. using chrome) again record is inserted in database.. I think it is happening because of browser warning "The page that you're looking for used information that you entered. Returning to that page might cause any action you took to be repeated. Do you want to continue?" when click refresh..

can anybody please suggest way forward to this condition.. 
<apex:form>
                    <apex:inputText id="txtName" value="{!name}" label="Input"/>
  </apex:form>
<script>
  var txtName = document.getElementById('txtName');
  txtName.value='abc';
</script>
Occur error: Uncaught TypeError: Cannot set property 'value' of null
How can set value to apex:inputText from javascript?
Hi Team,

How to write test class for below code.
Controller
-----------------
public with sharing class TPipelineControllerClass {
    
    public static String oppid;
    
    public X360_Pipeline__c pipeline{get;set;}
    private ApexPages.StandardController sc{get;set;}
    public Opportunity opp = new Opportunity();
    public TPipelineControllerClass(ApexPages.StandardController sc){
        this.sc = sc;
        oppid = ApexPages.currentPage().getParameters().get('oppid');
        //system.debug('------'+oppid);
        opp =[select id,name,Account.name from Opportunity where id =:oppid limit 1];
        //system.debug('---'+hr.Name);
        //system.debug('---'+hr.Account.Name);
        pipeline = new X360_Pipeline__c();
        pipeline.Name = opp.Name;
        //system.debug('-------pipeline.Name'+pipeline.Name);
        pipeline.Account_Name__c= opp.AccountId;
        pipeline.Opportunity_Name__c = opp.Id;
    }
    
    public PageReference save(){
        try{
            insert pipeline;
            return new PageReference('/'+pipeline.Id);
        }catch(Exception ex){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, ex.getMessage()));
            return null;
        }
        
        
    }
    
    Public PageReference Cancel(){
        PageReference pr = new PageReference('/'+Schema.SObjectType.Opportunity.getKeyPrefix()+'/o');
        return pr;
        }

}
Test Class :
----------------
@isTest
public class TestTPipelineControllerClass {
    
    @isTest
    private static void test360Pipeline(){
        Test.startTest();
        
        PageReference pr = Page.TPipelineVFPage;
        Test.setCurrentPage(pr);
        
        Opportunity op = new Opportunity();
        try{
            Account acc = new Account(Name='Dummy Account');
            	insert acc;
        	
                op.Name = 'Dummy Oppty';
                op.AccountId = acc.Id;
                op.Lead_Country__c = 'India';
                op.Region__c = 'APAC';
                op.CloseDate = Date.newInstance(2018, 02, 20);
                op.ForecastCategoryName = 'Best Case';
                op.StageName = 'Red Zone / Awarded';
                op.Probability = 90;
                op.Category__c = 'Red Zone / Awarded, Negotiating Contract';
            insert op;
            X360_Pipeline__c pipe = new X360_Pipeline__c();
            pipe.Name = op.Name;
            pipe.Opportunity_Name__c = op.Id;
            pipe.Account_Name__c = op.AccountId;
            insert pipe;  
            
            pr.getParameters().put('id',pipe.Id);
        
            ApexPages.StandardController sc = new ApexPages.StandardController(pipe);
            TPipelineControllerClass pipeline = new TPipelineControllerClass(sc);
            
            pipeline.save();
            pipeline.Cancel();
        
        }
        catch(Exception e){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, e.getMessage()));
        }
        
        System.assert(true);
        System.assertNotEquals(Null, op.id);
        
        Test.stopTest();
    }

}
Can any one please help me how to write test class.

Thanks
Lakshmi

 
hi all,
     i want to create a visualforce page using Action Function in which we have two drop down lists( Country and State). when i select a country from drop down it should automatically shows the states of that country in other dropdown list automatically without reloading a page .(like AJAX).
any suggestion?
Regards
Amit
Hi,

In Setup->Users->Fields->Lanuage only field information is available. How to see the picklist values?
Thanks in advance.
In my page after selecting sendEmail Button,My page is redirecting to EmailDetail page
But In EmailDetail page selected contact is not showing.
Here is code
<apex:page controller="SearchRecords"  showHeader="false" sidebar="false" >
    <apex:form id="frm">
        <apex:pageblock >
            <apex:pageBlockSection title="Search Account Records" columns="1">
                Enter Name<apex:inputText value="{!getstring}" id="theTextInput"/>
                <apex:commandButton action="{!searchRecord}" value="Search" id="theSearch" reRender="frm"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Account Detail" id="pb">
                <apex:pageBlocktable value="{!accountlist}" var="acc">
                    <apex:column >
                        <input type="radio" name="group1" reRender="{!display}" />
                        <apex:actionSupport event="onclick" action="{!newClick}" reRender="conSection"  >
                            <apex:param assignTo="{!AccId}" name="accname" value="{!acc.id}"/>
                        </apex:actionSupport>
                    </apex:column>
                    <apex:column value="{!acc.Name}"/>
                    <apex:column value="{!acc.Phone}"/>
                </apex:pageBlocktable>
            </apex:pageBlockSection>
            
            <apex:outputPanel id="conSection">
                <apex:pageBlockSection title="Related Contact" id="conpgblk" rendered="{!display}" >
                    <apex:outputPanel rendered="{!listWrapper.size != 0}">
                        <div align="center" >
                            <apex:commandButton value="Send Email" action="{!SendEmail}"/>
                            <apex:commandButton value="Print Detail" action="{!PrintDetail}"/>
                        </div>
                        <apex:pageBlockTable value="{!listWrapper}" id="pbt1" var="wrap">
                            <apex:column headerValue="Select">
                            <apex:inputCheckbox value="{!wrap.checked}" id="inputBox"/>
                            </apex:column>
                            <apex:column value="{!wrap.con.Name}"/>
                            <apex:column value="{!wrap.con.Phone}"/>
                            <apex:column value="{!wrap.con.Email}"/>
                            <apex:column value="{!wrap.con.Account.Name}"/>
                            <apex:column value="{!wrap.con.AccountId}"/>
                            <apex:column value="{!wrap.con.Id}"/>
                        </apex:pageBlockTable>
                    <apex:commandButton value="First Page" rerender="conpgblk" action="{!FirstPage}" disabled="{!prev}"/>
                    <apex:commandButton value="Previous" rerender="conpgblk" action="{!previous}" disabled="{!prev}"/>
                    <apex:commandButton value="Next" rerender="conpgblk" action="{!next}" disabled=""/>
                    <apex:commandButton value="Last Page" rerender="conpgblk" action="{!LastPage}" disabled="{!disable}"/> 
                    </apex:outputPanel>
                    <apex:outputPanel rendered="{!listWrapper.size == 0}">
                        <b> NO RELATED CONTACTS FOR THIS ACCOUNT.</b> 
                    </apex:outputPanel>
                </apex:pageBlockSection>
            </apex:outputPanel>
        </apex:pageblock>
    </apex:form>
</apex:page>

public class SearchRecords {
    public boolean display{get;set;}
    public boolean disable{get;set;}
    public String AccId{get;set;}
    public string getstring{get;set;}
    public string selectedvalie{get;set;}
    public List<Account> accountlist {get;set;}
    public list<Contact> conList{get;set;}
    public list<Attachment> AttachmentList{get;set;}
    private integer totalRecs = 0;
    private integer OffsetSize = 0;
    private integer LimitSize=3;
    public  contact con{get;set;}
    public  Attachment Att{get;set;}
    public  string Body{get;set;}
    public string Subject{get;set;}
    public string selectAttachment{get;set;}
    public boolean Attc{get;set;}
    public boolean Docu{get;set;}
    public boolean SysFil{get;set;}
    public List<WrapperClass> listWrapper {get;set;}
    public List<WrapperClass> listWrapper1 {get;set;}
    public void searchRecord(){
        display=False;
        accountlist= new list<Account>();
        if(getstring!=null){
            accountlist= Database.query('select id,AccountNumber,name,Phone from Account where name like \'%'+getstring+'%\'');
        }
    } 
    public void newClick(){
        disable=false;
        LimitSize=3;
        OffsetSize=0;
        showContact();
    }
    public void showContact(){
        display=true;
        listWrapper = new List<WrapperClass>();
        List<Contact> conlist =[SELECT id,Title,Fax,Birthdate,Name,Account.Name,Phone,Email FROM Contact WHERE AccountId=:AccId LIMIT :LimitSize OFFSET :OffsetSize];
        if(conlist!=NULL){
            totalRecs = conlist.size();
            for(contact con:conlist)
            {
                listWrapper.add(new WrapperClass(con));
            }
        }
    }
    public pageReference PrintDetail(){
        listWrapper1=new list<WrapperClass>();
        for(WrapperClass wr: listWrapper){
            if(wr.checked==true)
                listWrapper1.add(wr);
        }
        pageReference acctPage = new pageReference('/Apex/printContactDetail');
        return acctPage;
    }
 
    public pageReference SendEmail(){
        listWrapper1=new list<WrapperClass>();
          String str='';
        for(WrapperClass wr: listWrapper){
            if(wr.checked==true){
                listWrapper1.add(wr);
            str+=wr.con.id+',';
            }
            system.debug('====>listWrapper1'+listWrapper1);
        }
        str=str.removeEnd(',');
        pageReference EmailPage = new pageReference('/Apex/EmailDetail?id='+str);
        emailPage.setRedirect(true);
            return EmailPage;
    }
    public pageReference AddFile(){
        String str=ApexPages.currentPage().getParameters().get('id');
        PageReference acctPage = new pageReference('/Apex/AttachmentPage?id='+str);
        return acctPage;
    }
    set<id> contactId=new set<Id>();
    
    public void Attachment(){
       String str1=ApexPages.currentPage().getParameters().get('id');
        system.debug('---line81'+str1);
        for(string st:str1.split(',')){
            contactid.add(st);
        }
       AttachmentList=[select Id,Name,Body,BodyLength,ContentType,ParentId from Attachment where ParentId IN:contactId];
        system.debug('AttachmentList'+AttachmentList);
    }
    public void HideShow(){
        system.debug('selectAttachment'+selectAttachment);
        if(selectAttachment=='Attachment'){
            Attc=True;
            Docu=False;
            SysFil=False;
            Attachment();
        }
        else if(selectAttachment=='Document'){
            Attc=False;
            Docu=True;
            SysFil=False;
        }
        else if(selectAttachment=='System File'){
            Attc=False;
            Docu=False;
            SysFil=True;
        }
    }
    public pageReference Send(){
        return null;
    }
    public pageReference Cancel(){
        return null;
    }
    public void FirstPage(){
        disable=false;
        OffsetSize = 0;
        showContact();
    }
    public void previous(){
        disable=false;
        OffsetSize = OffsetSize - LimitSize;
        showContact();
    }
    public void next(){
        OffsetSize = OffsetSize + LimitSize;
        showContact();
    }
    public void LastPage(){
        disable=true;
        OffsetSize = totalrecs - math.mod(totalRecs,LimitSize);
        showContact();
        
    }
    public boolean getprev(){
        if(OffsetSize == 0)
            return true;
        else
            return false;
        
    }
    public boolean getnxt(){
        if((OffsetSize + LimitSize) > totalRecs)
            return true;
        else
            return false;
    }

    public pageReference Save(){
            return null;
        }
    public class WrapperClass {
        public Boolean checked {get;set;}
        public contact con {get;set;}
        public WrapperClass(contact con) {
            this.con=con;
            checked=false;
        }
    }
}
EmailDetail page
<apex:page controller="SearchRecords" showHeader="false" sidebar="false">
    <script>
        function openPopup(){
             window.open('/apex/AttachmentPage','mywindow','width=600,height=400');
        }    
    </script>
    <apex:form >
        <apex:pageBlock title="Send Email To Selected Contacts">
            <div align="Middle">
                <apex:commandButton value="Send" action="{!Send}" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <apex:commandButton value="Add File" onclick="openPopup();return false;"/> &nbsp;&nbsp;&nbsp;&nbsp;
                <apex:commandButton value="Cancel" action="{!Cancel}"/>&nbsp;&nbsp;&nbsp;&nbsp;
            </div>
            <apex:pageBlockSection title="Email" columns="1">
                <apex:repeat value="{!listWrapper1}" var="wrap">
                    To:<apex:outputfield value="{!wrap.con.Name}" />
                </apex:repeat>
                <div class = "requiredInput">
                    Subject<div class = "requiredBlock"></div>
                    <apex:inputText title="Subject" required="true"/>
                </div>
                <apex:inputtextarea label="Body" richtext="true" value="{!Body}" cols="50" rows="15"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>
<apex:page standardController="Profile__c" extensions="OrdersFromUsers">
 <apex:outputPanel id="all">
  <apex:form >
    <apex:pageBlock >
      <apex:pageBlockSection title="Orders" columns="1" >
        <apex:pageBlockTable value="{!OrdersFromUsers}" var="cont">
          <apex:column value="{!cont.Name}"/>
           <apex:column value="{!cont.Address__c}"/>
         <apex:column value="{!cont.Booking_Date__c}"/>
          <apex:column value="{!cont.Customer_Name__c}" />
          <apex:column value="{!cont.Event_Name__c}" />
          <apex:column value="{!cont.Event_Type__c}"/>
       <!--   <apex:column value="{!cont.Location__c}"/>-->
          <apex:column value="{!cont.Services__c}"/>
           <apex:column value="{!cont.Time__c}"/>
        </apex:pageBlockTable>
         </apex:pageBlockSection>
    </apex:pageBlock>
    
     <apex:pageBlock >
     
      <apex:pageBlockSection title="Customer Information" columns="1" id="info">
        <apex:pageBlockTable value="{!ViewCustomerDetail}" var="cust">
          
          <apex:column value="{!cust.Name}"/>
          <apex:column value="{!cust.Address__c}"/>
          <apex:column value="{!cust.District__c}"/>
          <apex:column value="{!cust.Email__c}" />
          <apex:column value="{!cust.Mobile_No__c}"/>
          <apex:column value="{!cust.Pin_Code__c}"/>
          <apex:column value="{!cust.State__c}"/>
         
        </apex:pageBlockTable>
      
      </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
 </apex:outputPanel>
</apex:page>


public with sharing class OrdersFromUsers {
     public List<Order__c> OrdersFromUsers{get; set;}
   public List<Profile__c> ViewCustomerDetail{get;set;}
   public String actualName;
    public OrdersFromUsers(ApexPages.StandardController controller) {
    
        List <Order__c> val=[select Customer_Name__c from Order__c where customerName__r.name=:UserInfo.getFirstName()+' '+UserInfo.getLastName()];
        for(integer i=0;i<val.size();i++)
        {
            actualName='%'+val[i].Customer_Name__c+'%';
            ViewCustomerDetail=[select name,Address__c,District__c,Email__c,Mobile_No__c,Pin_Code__c,State__c from Profile__c where name like:actualName];
            
        }
        actualName='';
       OrdersFromUsers=[select name,Address__c,Booking_Date__c,Customer_Name__c,Event_Name__c,Event_Type__c,Services__c,Time__c from Order__c where customerName__r.name=:UserInfo.getName()];
    }
 
}

if i do this its giving me last record of that list but i want all records from this list
so what can i do plz tell me....
Hello everyone,
I want to upload a number of files when I select a value in the picklist.i.e. when I select 2 in picklist then it uploads only two files and so on.
Here is the code what I did to achieve this.
Thanks in advance
VF Page--

<apex:page standardController="Document" extensions="MyDocuments">
  <apex:form >
      <apex:pageBlock >          
          <apex:selectList value="{!len}" size="1">
              <apex:selectOptions value="{!option}"/>
              <apex:actionSupport event="onchange" action="{!uploadMultiFile}" reRender="lab"/>
          </apex:selectList>
      </apex:pageBlock>
      
      <apex:pageBlock title="UpLoad A File">
          <apex:pageBlockSection id="lab">
              <apex:repeat value="{!total}" var="t">
                  <apex:inputFile value="{!doc.body}" fileName="{!doc.name}"/>
              </apex:repeat>
              <apex:commandButton value="Save" action="{!save}"/>

          </apex:pageBlockSection>
      </apex:pageBlock>
  </apex:form>
</apex:page>

---------------------------------------------------------------------------------------------------------------------
Controller--

public class MyDocuments {
    
    public document doc {get;set;}
    public List<selectOption> option {get;set;}
    public String len {get;set;}
    public Integer total {get;set;}
    
    
    public MyDocuments(ApexPages.StandardController controller) 
    {
        doc = (Document)controller.getRecord();
        doc.folderId = UserInfo.getUserId();
        
        option = new List<selectOption>();
        option.add(new selectOption('','--None--'));
        for(Integer i=1; i<=10; i++)
        {
            option.add(new selectOption('val'+i,string.valueOf(i)));
        }
        
    }
    
    public void uploadMultiFile()
    {
        if(len == 'val1')
        {
            total = 1;
        }
        if(len == 'val2')
        {
            total = 2;
        }
    }

}

 
In the below 2 queries Account is the parent and Opportunity is the related record. This is a standard relation which exists in the Org.

Query 1: [SELECT Id,(SELECT Id FROM Opportunities) FROM Account WHERE Id IN :Trigger.New] 
In Query 1 I understand that Opportunities is the Relationship API Name for Opportunity Object , so we have used this to get child records.
.
Query 2: [SELECT Id FROM Account WHERE Id IN (SELECT AccountId FROM Opportunity) AND Id IN :Trigger.old]
Here in Query 2 why have  we used  Opportunity (Opportunity object API name) instead of Opportunities (Relationship API Name) though we are still accessing child records?

Please correct if my understanding for Query 1 is wrong.
I have created a visual force page  with two tabs for the same object fields.
when i click on the button it must go to second tabs.

Here is my code:

<apex:page standardController="product_Development__c" extensions="HistoryPageController">
<apex:form >

<apex:pageblock title="VF Page Tabs" >
<apex:tabPanel id="theTabPanel" value="{!tabOpt}" >
<apex:tab label="Basic Info">
<b>Name:</b><apex:inputField value="{!product_Development__c.name}"/><br/>
<b>closed Date:</b>
<apex:inputField value="{!product_Development__c.Policy_Name__c}"/>
<br/>
<b>Education Requirement:</b><apex:inputField value="{!product_Development__c.Policy_Name__c}"/><br/>
<apex:commandButton value="Go to Two" action="{!switch}" rerender="theTabPanel"/>
</apex:tab>
<apex:tab label="DetailPage">
<b>Apex:</b><apex:inputField value="{!product_Development__c.product_Id__c  }"/><br/>
<b>Max_Pay:</b>
<apex:inputField value="{!product_Development__c.product_Id__c}"/>
<br/>
<b>Min_Payt:</b><apex:inputField value="{!product_Development__c.product_Id__c}"/><br/>
</apex:tab>
</apex:tabPanel>
</apex:pageblock>
  </apex:form>

</apex:page>

apex class:
public class HistoryPageController
{
    public String tabOpt {get;set;}
    private ApexPages.StandardController controller;

    public HistoryPageController(ApexPages.StandardController controller)
    {
    this.controller = controller;
    }
      
    
    public void switch()
    {
        tabOpt = 'DetailPage';
    }
}
 here the button is created and it not switching the second  tab.
Please help me.
Hi,

I am using visualforce to make opportunity page sections tabular in lightning, I have a field that in in a 1 column page section in classic but when I add to the visualforce page as a 1 cloumn section with this 1 field only the placement is not left allinged.

Here is the code for the page block, what do i need to add to allign it to the left?

<apex:pageBlockSection title="Scheme Outline" columns="1"> <apex:outputField value="{!opportunity.Summary_Scheme_Calc_SF__c}"/> </apex:pageBlockSection>

I want it to be all the way to the left.
User-added image
            Hi All,

            I'm trying to filter the below mentioned response like below please check it once

              Map<String,String> customsettingValues = new Map<String,String>();
              Map<String,String> SelectedValues = new Map<String,String>();
              Set<String> orderList1 = new Set<String>();
              for(String firstKey : customsettingValues.keySet()){                     
                  String firstValue = customsettingValues.get(firstKey);                    
                for(String secondKey : SelectedValues.keySet()){                      
                    String secondValue = SelectedValues.get(secondKey);                      
                       if(firstValue.equals(secondKey)){
                            
                           orderList1.add(secondValue);
                           System.debug('orderList1:::---------'+orderList1);
                                                                    
                  }
                }
              }

            I got the Response Like below for the above code

            orderList1:::---------{chandra}
            orderList1:::---------{chandraiii@gmail.com,chandra}
            orderList1:::---------{Not Attended,chandraiii@gmail.com,chandra}
            orderList1:::---------{vizag,Not Attended,chandraiii@gmail.com,chandra}
            orderList1:::---------{ap,vizag,Not Attended,chandraiii@gmail.com,chandra}
            orderList1:::---------{Ind,ap,vizag,Not Attended,chandraiii@gmail.com,chandra}
            orderList1:::---------{88888888888,Ind,ap,vizag,Not Attended,chandraiii@gmail.com,chandra}

            How to change above response like below

            orderList1:::---------{chandra}
            orderList1:::---------{chandraiii@gmail.com}
            orderList1:::---------{Not Attended}
            orderList1:::---------{vizag}
            orderList1:::---------{ap}
            orderList1:::---------{Ind}
            orderList1:::---------{88888888888}

            If anybody having idea please let me know

            Thanks In Advance
            Basha
<apex:page standardController="Position__c" extensions="ParamBlogController">
 <apex:outputPanel id="all">
  <apex:form >
    <apex:pageBlock title="Account Detail">
      <apex:pageBlockSection title="Account">
            
             <apex:commandButton action="{!setupContacts}" value="try"/>
            <apex:inputField value="{!Position__c.Position_Type__c}"/>
     
      </apex:pageBlockSection>
      <apex:pageBlockSection title="Contacts" columns="1">
        <apex:pageBlockTable value="{!conts}" var="cont" rows="10">
          <apex:column value="{!cont.Id}"/>
          <apex:column value="{!cont.Name}"/>
           <apex:column value="{!cont.city_state__c}"/>
          <apex:column value="{!cont.Position_Type__c}"/>
          
      
        </apex:pageBlockTable>
      </apex:pageBlockSection>
    </apex:pageBlock>
  </apex:form>
 </apex:outputPanel>
</apex:page>


public class ParamBlogController 
{
 private ApexPages.StandardController stdCtrl {get; set;}
  
 public List<position__c> conts {get; set;}
  
 public ParamBlogController(ApexPages.StandardController std)
 {
  stdCtrl=std;
 
 }
  
 public void setupContacts()
 {
  conts=[select Name,city_state__c,Department__c,Position_Id__c,Position_Type__c from position__c where Position_Type__c=:stdCtrl.getId()];
 }
}

when i try to get the all records from position related records to position_types__c 

I can't break this loop:

List<User> userList = [SELECT Id FROM User WHERE UserRole.Name = 'X'];

     for(Obj__c obj: Trigger.new){
         for(User user : userList){
             if(obj.CreatedById != user.Id){
                 obj.OwnerId = user.Id;
             }
         }     
     }
I need to reassign an object if user's Role != 'X'.
We have a few users with Role 'X'. We need to reassign an object to one from these users, if it's created not by one of them. But my loop choose the last one and change owner even if owner is already correct (with Role 'X'). How can I fix it?
List<User> userList = [SELECT Id FROM User WHERE UserRole.Name = 'X'];

     for(Obj__c obj: Trigger.new){
         for(User user : userList){
             if(obj.CreatedById != user.Id){
                 obj.OwnerId = user.Id;
             }
         }     
     }

 
I want to delete records from PageBlockTable via Remote Action?
Hi,

Everytime there is a new update to Salesforce for Outlook, I package the software and deploy it to our users via SCCM. I was wondering if there was an easier way this could be managed by an automatic update either via SCCM or by the users themselves? Users do not have admin rights to their machines, but seeing how SFO is a user level installation, I was hoping there would be some solution to help manage these constant updates.

Thanks!
 
Hello Developers,

In VF email template want Amount field to be rendered based on IF condition like if currency is JYP or USD then render.
<div style="{!IF({!relatedTo.Related_Opportunity__r.CurrencyIsoCode}='JYP', 'display:block', 'display:none')}" >            
Amount : <apex:outputText value="{!relatedTo.CurrencyIsoCode}" rendered="true" /> 
</div>

Please Note: I do not want to go for controller want to achive this through VF Email template only.

Thanks
Mehul
 
VF page----------------------------
<apex:page controller="editDeleteContactRecords" >
    <apex:form >
        <apex:pageBlock title="Account Detail">
    
        <apex:pageBlockSection >
        <apex:outputField value="{!acc.Name}"/>
        <apex:outputField value="{!acc.Phone}"/>
        <apex:outputField value="{!acc.Fax}"/>
        <apex:outputField value="{!acc.AccountNumber}"/>
        </apex:pageBlockSection>
        
        <apex:pageBlockSection title="Contacts" collapsible="false" columns="1">
        
        
        <apex:pageBlockTable value="{!acts}" var="con">
        
       <apex:column headerValue="Action">
        <apex:commandLink value="Edit |" action="{!editContact}">
        <apex:param value="{!con.Id}" name="selectedContactId" assignTo="{!selectedContact}"/>
        </apex:commandLink>
        <apex:commandLink value="Del" action="{!deleteSelectedContact}">
        <apex:param value="{!con.id}" assignTo="{!delSelContId}" name="delContId"/>
        </apex:commandLink>
        </apex:column>     
        <apex:column value="{!con.Name}"/>
        <apex:column value="{!con.Email}"/>
        <apex:column value="{!con.Title}"/>
        
        </apex:pageBlockTable>
        
       </apex:pageBlockSection>
        
        </apex:pageBlock>
    </apex:form>

</apex:page>


Apex class----------------------------
public class editDeleteContactRecords
{
public Account acc {get;set;}
public Id id;





     public editDeleteContactRecords (){
     
           id  = ApexPages.CurrentPage().getparameters().get('id');
           acc  =  (id==null)?new Account():[select  Name,Phone,fax,AccountNumber From Account where Id =:id];
     
     
     }
     
      public List<Contact> getacts(){
          
          Id id  = ApexPages.CurrentPage().getparameters().get('id');
          List<Contact> acts = [select id,Name,Title,Email,Phone from Contact where AccountId =: id ];
         
          
         return acts;
        
        
          
          // parameterValue = ApexPages.CurrentPage().getparameters().get('nameParam');
           
       }
     
    
    public PageReference editContact(){
    
     String selectedContact =apexpages.currentPage().getParameters().get('selectedContactId');
    PageReference pg=new PageReference('/'+'apex/UpdateDetail?id='+selectedContact);
    return pg;
        
    }
    // Initialize setCon and return a list of records
     public PageReference deleteSelectedContact(){
     String delSelContId= ApexPages.CurrentPage().getparameters().get('delContId');
       
        if(delSelContId!=null){
        Contact delContact = [Select Id from Contact where Id=:delSelContId];
        delete delContact;
        }
        
        return null;
        
    }  

}
Hi,

  I have a below simple trigger  it has 100% code coverage
trigger updateopportunitycontact on Lead (before update) 
{
for(Lead lead:System.Trigger.new) 
{ 

  if (lead.IsConverted && lead.ConvertedOpportunityId != null ) 
 { 
   Contact con = [SELECT Id FROM Contact WHERE Contact.Id = :lead.ConvertedContactId];
    
   Opportunity opp = [SELECT Contact__c from Opportunity where opportunity.id = :lead.ConvertedOpportunityId];
   
   opp.Contact__c = lead.ConvertedContactId;
   
   update opp;
   
   
  }
  
}

}
Test Class 
@isTest(SeeAllData = true)
private class   test_updateopportunitycontact {

public static testmethod void testupdateoppcon()
{
test.startTest();
Lead testLead = new Lead(
   LastName='123456789890654',
   Company = 'Couchbase11',
   LeadSource = 'Training',
   run_assn_rules_yn__c = False
   
  );
  
 insert testLead;


Database.LeadConvert lc = new database.LeadConvert();

lc.setLeadId(testLead.id);

 
LeadStatus convertStatus = [Select Id, MasterLabel from LeadStatus where IsConverted=true limit 1];

lc.setConvertedStatus(convertStatus.MasterLabel);

Database.LeadConvertResult lcr = Database.convertLead(lc);

System.assert(lcr.isSuccess());

 
test.stopTest(); 
 
}

}

I keep getting below message when validated in production 

Code Coverage Failure
The following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.
updateopportunitycontact


Please suggest me what might be the issue in the code. 

Thanks
Sudhir
 
  • July 09, 2018
  • Like
  • 0
Hi,

in my VF i am insert record in account on click of button.. but after clicking save button it creates record in database but at this stage only when i refresh page(F5 .. using chrome) again record is inserted in database.. I think it is happening because of browser warning "The page that you're looking for used information that you entered. Returning to that page might cause any action you took to be repeated. Do you want to continue?" when click refresh..

can anybody please suggest way forward to this condition.. 
<apex:form>
                    <apex:inputText id="txtName" value="{!name}" label="Input"/>
  </apex:form>
<script>
  var txtName = document.getElementById('txtName');
  txtName.value='abc';
</script>
Occur error: Uncaught TypeError: Cannot set property 'value' of null
How can set value to apex:inputText from javascript?
Hi All,

As we know in batch class, we can able to retrieve more than 50k records but in normal apex class i need to fetch more than 50K records.Is there any workaround?

Regards,
VSK98
  • July 06, 2018
  • Like
  • 0
If I select other from ownership picklist field in account it should create new box to add picklist value.