• Raghu Ramanujam
  • NEWBIE
  • 5 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 14
    Replies

Hi Gurus,
I followed the below link to create a Picklist field in the component.

https://naveendhanaraj.wordpress.com/2018/06/19/lightning-picklist-component/

It works fine, the selected value is saved correctly.. But I am not able to display the selected value. It shows the first value in list.
Can you please guide me ..

Thanks,

Raghu

Hi,

I am trying to make a field(s) Required in page layout ?
But the option is greyed out .. FLS is not read only..
Any ideas .. ?

Thanks,

Raghu

Hello experts,

We are planning to create Leads in Salesforce from a external website using REST API ( OAuth JWT bearer token flow).
Created a Connected App.
I am confused about the digital certificate. Should I use a Self Signed Certificate and private key (OR)
Create CA-Signed Certificate ?
If it is CA-Signed Certificate what details should I use for Comman Name ?

Thanks,
Raghu



 

Hi All,

Have anyone integrated with Companies House using API Key ?

String apiKey = 'a-9NflEDUycmO-Rt-2cOXXXXWGSYVxSMZmiXXXXX';
string comp_reg = '06587726';
String requestEndpoint = 'https://a-9NflEDUycmO-Rt-2cOThUCWGSYVxSMZmi67lI5:@api.companieshouse.gov.uk/company/';
//String requestEndpoint = 'https://api.companieshouse.gov.uk';
requestEndpoint += '?q=' + comp_reg;
//requestEndpoint += '&APPID=' + apiKey;

Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint(requestEndpoint);
request.setMethod('GET');
HttpResponse response = http.send(request);

Thanks,
Raghu
Dear All,

I need some help in making a Rest Api Call Out.
When I execute the below code in Execute Anonymous Window, it works fine.

Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://XXXX-dev.XXXXXXX/PSSSSSb/zzzzz/EZApiDEGroupDEVMain/invoice/compsearch');
request.setMethod('POST');
request.setHeader('Content-Type', 'application/json;charset=UTF-8');
// Set the body as a JSON object
request.setBody('{ "company_reg": "06587726"}');

HttpResponse response = http.send(request);

if (response.getStatusCode() != 201) {
    System.debug('The status code returned was not expected: ' +
        response.getStatusCode() + ' ' + response.getStatus());
    System.debug('Response ' + response.getBody());
} else {
    System.debug(response.getBody());
}


But when the tried to put this in a Apex class, its not working. (status code == 500)

public with sharing class ProvenirCsCallout {
    
    @future (callout=true)
    public static void sendRequest(Id accid, String comp_reg){
        
        Http http = new Http();
        HttpRequest request = new HttpRequest();
            request.setEndpoint('https://xxxxxxxx/xxxx/xxxxxxEZApiDEGroupDEVMain/invoice/compsearch');
            request.setMethod('POST');
            request.setHeader('Content-Type', 'application/json;charset=UTF-8');
            //request.setHeader('Accept','application/json');
// Set the body as a JSON object
            JSONGenerator gen = JSON.createGenerator(true);   
                gen.writeStartObject();     
                gen.writeStringField('company_reg ', comp_reg);
                String jsonS = gen.getAsString();
            
                request.setBody(jsonS);
           // request.setBody('company_reg='+EncodingUtil.urlEncode(comp_reg, 'UTF-8'));

            HttpResponse response = http.send(request);
     
            if(response.getstatusCode() == 200 && response.getbody() != null){
               String strResponse = Response.getBody();
                } else {
}

What I am missing ???

Thanks,
Raghu

Hi All,

I am trying to convert attachments into Files using Apex.

I am getting aa error at the below code.
"List<ContentDocument> cds = [Select id,Title,LatestPublishedVersionId from ContentDocument where id IN :ContentDocumentIDs];"

Not sure why?

Thanks,
Raghu

Hi guys,

I need some help in Renendering my VF to a particular Pageblock (or bottom of the page) after using @Remote Action.
Can you please help ?
This is my Controller:

public without sharing class RController1 {
  
   @RemoteAction
  Public static boolean saveSign(String signatureBody, id sobjId){
 
    try{
      Attachment sign = new Attachment();
      sign.parentId = sobjId;
      sign.Body =  EncodingUtil.base64Decode(signatureBody);
      sign.ContentType = 'image/png';
      sign.Name = 'Signature Capture.png';
        insert sign;
      
    }catch(Exception e){
        return false;
      
    return null;
  }


}

My Visualforce Page:

<apex:page standardController="Registration__c" extensions="RController1">

  function saveSign(){
        var strDataURI = canvas.toDataURL();
           console.log(strDataURI);
            strDataURI = strDataURI.replace(/^data:image\/(png|jpg);base64,/, "");
              console.log(strDataURI);
               RegistrationController1.saveSign(strDataURI,parentId,
                         function(result,event){
                                     if (event.status){ 
                                          rerendAction();  }
                                      else{ console.log(event.message); ) } }, {escape:true} );
}

<apex:actionFunction name="rerendAction" rerender="sign"/>
  <apex:pageBlockSection title="Signature" id="sign">
          <c:Signature parentId="{!$CurrentPage.parameters.Id}"/>
            <br />
              <apex:pageBlockSectionItem >
                   <apex:commandButton onclick="javascript:clearArea();return false;" onkeypress="" value="Clear Signature" style="width:60%" /> <apex:commandbutton id="sign" onclick="saveSign()" value="Submit Signature" style="width:60%" />
              </apex:pageBlockSectionItem> <br />
</apex:pageBlockSection>

Thanks,

Raghu

Hi All,

We have 3 record types for Lead Object.
I have to display 3 different page layouts depending on the RecordType ( Create New Lead)
It works fine in Classic, but its not working in Lightning ..

Apex Class:
public classLeadNew{
    
    public LeadNew(ApexPages.StandardController controller) {
        this.controller = controller;
    }
 public PageReference getRedir() {
        PageReference newPage;
        if (ApexPages.currentPage().getParameters().get('RecordType') == '012w00000003BUmAAM') {
            newPage = Page.HCONE_LeadNew;
            System.debug('UserName  ' + Userinfo.getName());
            return newPage.setRedirect(true);                                        
        } else if  (ApexPages.currentPage().getParameters().get('RecordType') == '012200000000Ed8AAE' ){
            newPage = Page.HCTWO_LeadNew;
            return newPage.setRedirect(true);
        
           }else{
            return null;
            
        }

       private final ApexPages.StandardController controller;
}
}

VF Page:
<apex:page standardController="Lead" showHeader="true" sidebar="true" tabStyle="Lead" extensions="LeadNew" action="{!nullValue(redir.url, urlFor($Action.Lead.New, null, null, true))}"> </apex:page>
       
Whats wrong in the above code ?/

Thanks,

Raghu


 

Hi All,

I am facing a issue in the tadorderhint/tabindex of inputcheck/inputField ?
After 58 taborder disappears ?? ( these are checkbox fields )
Also tried inputcheck and taborder but no luck..
The Tab order does not appear on checkbox ( highlighted below)
Any ideas ??

<apex:pageBlockSection  title="Required Prod" columns="1" >
<apex:pageBlockSection id="red5" title="Sales Turnover & Forecasts" columns="1" >
 <apex:inputField Label="What was value of your total sales?" value="{!demo__c.Turnover__c}" taborderhint="56"/>
 <apex:inputField Label="What is forecast for the next 12 months?" value="{!demo__c.Year_1_Turn_Over__c}" taborderhint="57"/> <apex:inputField Label="What is forecast for the next 12 To 24 months?" value="{!demo__c.Year_2_Turn_Over__c}" taborderhint="58"/>
</apex:pageblockSection>
<apex:pageBlockSection  title="Required Prod1" columns="1" >
  <apex:inputField value="{!demo__c.2_Credit__c}" taborderhint="59"/> 
 <apex:inputField value="{!demo__c.1_Credit__c}" taborderhint="60"/>
<apex:inputField value="{!demo__c.3_Credit__c}" taborderhint="61"/>
<apex:inputField value="{!demo__c.4_Credit__c}" taborderhint="62"/>
<apex:inputField value="{!demo__c.Option4__c}" taborderhint="63"/>

</apex:pageblockSection>

Hi All,

I want to created a Lead Conversion Report (Converted Percentage) based on Lead Owner and Lead Source.
How to create this report ??

Thanks,
Raghu

Hello Gurus,

I wanted to overide Edit Opportunity page with a custom Visualforce Page for particular record type. (Reason for this is, want to display around 10 fields in a new section, based on Opportunity StageName)

Done the Overriding part. (with the help of this blog from Jeff   ..http://blog.jeffdouglas.com/2009/06/26/overriding-standard-links-with-visualforce-pages/)

For that particulat record type the custom visualforce page is displayed and the new section appears when the Stage is changed to a particualr one.But the problem is, for other Record types standard page is displayed. when I click on edit and later click Cancel button the users are redirected to Home Page instead of detail page ???
Any idea my this is happening.

Please see my code below ..

Visualforce Page One ( used to override the Edit button)
<apex:page standardController="Opportunity" extensions="DispatcherOpportunityViewController"  
    action="{!nullValue(redir.url, urlFor($Action.Opportunity.Edit, Opportunity.id, null, true))}">
</apex:page>
Controller Class
public with sharing class DispatcherOpportunityViewController {
    
    public Boolean Takeon { get; set; }
    private final Opportunity oppty;
    public String currentRecordId {get;set;}
    public Opportunity oppt{get;set;}

    public DispatcherOpportunityViewController(ApexPages.StandardController controller) {
         
          this.controller = controller;
          takeon = false;
          Opportunity   oppt = [Select id, stageName From Opportunity Where Id = :ApexPages.currentPage().getParameters().get('id')];
           if(oppt.StageName == '10. Deal Paid Out/Win'){
             takeon = true;  
          }
        }
     
    public PageReference getRedir() {
         Opportunity p = [Select id, recordtypeid From Opportunity Where Id = :ApexPages.currentPage().getParameters().get('id')];
         PageReference newPage;
         if (p.recordtypeid == '012w0000000MO5pAAG') {
            newPage = Page.NewEdit_Opportunity;
            newPage.getParameters().put('id', p.id );
        } else {
            newPage = new PageReference('/' + p.id + '/e');
            newPage.getParameters().put('nooverride', '1');
        }
        newPage.getParameters().put('id', p.id );
        return newPage.setRedirect(true);
    }
    
       public PageReference cancel(){
        //PageReference pageref = new PageReference('/006/o');
        ///PageReference pageref = new PageReference('/' + controller.getid());
        ///pageref.setRedirect(true);
        ///return pageref;
        return controller.cancel();
        //PageReference pRef;
        //pRef = controller.cancel();
       // pRef.setRedirect(true);
       // return pRef;
        //return null;
       }

       public PageReference stage(){
        Opportunity opp3 = [Select id, stageName From Opportunity Where Id = :ApexPages.currentPage().getParameters().get('id')];
        system.debug('StageName3 ' + opp3);
        system.debug('apex ' + ApexPages.currentPage().getParameters());
        SObject record = controller.getrecord();
        if(record instanceof Opportunity){
            Opportunity opp = (Opportunity) controller.getrecord();
            System.debug('StageName ' + opp.StageName);
            if(Opp.StageName == '10. Deal Paid Out/Win'){
                takeon = true;      
            }else{
                takeon = false;
            }
        }
        return null;
       }
        private final ApexPages.StandardController controller;
}

Visualforce Page 2 (Edit Page)

<apex:page standardController="Opportunity" showHeader="true" sidebar="true" tabStyle="Opportunity" extensions="DispatcherOpportunityViewController"
          action="{!stage}">

<apex:SectionHeader title="Edit Opportunity" subtitle="{!Opportunity.name}"/>
<apex:form >
 <apex:pageBlock title="Edit Opportunity" id="thePageBlock" mode="Edit">
     <apex:PageBlockButtons >
       <apex:commandButton value="Save" action="{!save}"/>
       <apex:commandButton value="Cancel" action="{!cancel}" immediate="true"/>
     </apex:PageBlockButtons>
     <apex:pageBlockSection title="Opportunity Information" columns="2">
     <apex:outputField value="{!Opportunity.OwnerId}"/>
     <apex:outputField value="{!Opportunity.RecordType.Name}"/>
     
     <apex:inputfield Label="Opportunity Name" value="{!Opportunity.Name}"/>
     <apex:inputfield Label="Close Date" value="{!Opportunity.CloseDate}"/>     
     
     <apex:inputtext Label="Account Name" value="{!Opportunity.account.name}"/>
     <apex:pageblockSectionItem >
        <apex:outputLabel value="Stage" for="Stage" />
            <apex:actionRegion >
                 <apex:inputField value="{!Opportunity.StageName}" id="Stage" required="true">
                  <apex:actionSupport event="onchange" rerender="TakeOn" action="{!stage}"/>
                 </apex:inputField>
            </apex:actionRegion>
    </apex:pageblockSectionItem>

     <apex:inputfield Label="Referred To Introducer" value="{!Opportunity.Referred_to_Introducer__c}"/>
     <apex:inputfield Label="Reason Lost" value="{!Opportunity.Reason_Won_Lost__c}"/>
     <apex:inputfield Label="Description" value="{!Opportunity.Description}"/>
     <apex:inputfield Label="Name Of Introducer Referred" value="{!Opportunity.Name_of_introducer_referred__c}"/>
     
     </apex:pageBlockSection>
     <apex:outputPanel id="TakeOn" >
         <apex:pageBlockSection title="Take On Details" columns="2" rendered="{!takeon}">
            
            <apex:inputfield Label="Executed Date" value="{!Opportunity.Executed_Date__c}"/>
            <apex:inputfield Label="Facility Type" value="{!Opportunity.Facility_Type__c}"/>
            <apex:inputfield Label="Turn Over" value="{!Opportunity.Turnover_HCIF__c}"/>
            <apex:inputfield Label="VOB" value="{!Opportunity.VOB__c}"/>
            <apex:inputfield Label="1st Payment" value="{!Opportunity.X1st_Payment__c}"/>
            <apex:inputfield Label="Setup Fees" value="{!Opportunity.Setup_Fee__c}"/>
            <apex:inputfield Label="Total Income" value="{!Opportunity.Total_Income__c}"/>
            </apex:pageBlockSection>
     </apex:outputPanel>
 </apex:pageBlock>
</apex:form>
</apex:page>






 
Hello Gurus,
Need some understanding of how triggers work.

Wrote this Code (SFDC99)
Trigger

When I did a Debug, I got this ..
Debug
Trigger Executed Twice ???
Tried RunOnce..
RunOnce
And Got this ..

Debug1
Only Before Trigger is Executed .. Very Confused ..
Can someone please explain how triggers work ??

Thanks,
Raghu

Hi Gurus,
I followed the below link to create a Picklist field in the component.

https://naveendhanaraj.wordpress.com/2018/06/19/lightning-picklist-component/

It works fine, the selected value is saved correctly.. But I am not able to display the selected value. It shows the first value in list.
Can you please guide me ..

Thanks,

Raghu

Hi,

I am trying to make a field(s) Required in page layout ?
But the option is greyed out .. FLS is not read only..
Any ideas .. ?

Thanks,

Raghu

Dear All,

I need some help in making a Rest Api Call Out.
When I execute the below code in Execute Anonymous Window, it works fine.

Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://XXXX-dev.XXXXXXX/PSSSSSb/zzzzz/EZApiDEGroupDEVMain/invoice/compsearch');
request.setMethod('POST');
request.setHeader('Content-Type', 'application/json;charset=UTF-8');
// Set the body as a JSON object
request.setBody('{ "company_reg": "06587726"}');

HttpResponse response = http.send(request);

if (response.getStatusCode() != 201) {
    System.debug('The status code returned was not expected: ' +
        response.getStatusCode() + ' ' + response.getStatus());
    System.debug('Response ' + response.getBody());
} else {
    System.debug(response.getBody());
}


But when the tried to put this in a Apex class, its not working. (status code == 500)

public with sharing class ProvenirCsCallout {
    
    @future (callout=true)
    public static void sendRequest(Id accid, String comp_reg){
        
        Http http = new Http();
        HttpRequest request = new HttpRequest();
            request.setEndpoint('https://xxxxxxxx/xxxx/xxxxxxEZApiDEGroupDEVMain/invoice/compsearch');
            request.setMethod('POST');
            request.setHeader('Content-Type', 'application/json;charset=UTF-8');
            //request.setHeader('Accept','application/json');
// Set the body as a JSON object
            JSONGenerator gen = JSON.createGenerator(true);   
                gen.writeStartObject();     
                gen.writeStringField('company_reg ', comp_reg);
                String jsonS = gen.getAsString();
            
                request.setBody(jsonS);
           // request.setBody('company_reg='+EncodingUtil.urlEncode(comp_reg, 'UTF-8'));

            HttpResponse response = http.send(request);
     
            if(response.getstatusCode() == 200 && response.getbody() != null){
               String strResponse = Response.getBody();
                } else {
}

What I am missing ???

Thanks,
Raghu
We have updated the page layout of a Contact Record type. However, when adding new items to old contact records, it shows an error message that we must update the old field (cannot see the field on the new record type). Can someone please help?

Hi All,

I am trying to convert attachments into Files using Apex.

I am getting aa error at the below code.
"List<ContentDocument> cds = [Select id,Title,LatestPublishedVersionId from ContentDocument where id IN :ContentDocumentIDs];"

Not sure why?

Thanks,
Raghu

Hi 

My business case is 

I used to receive a New Account creation request from the end user(Sales Person or Advisor),As soon the request comes to my Support group bucket I have to pick the request and check for the duplicate by the name of the account,EIN & Address.If the account exist i have to mail back to the requester telling that the requested account is exist else i have to create the New Account and mail the requester back.

I am tollay new to salesforce.I am trying to automate this process by Flow.Please explain in detail to attain my need

User-added image
 

 

Hi guys,

I need some help in Renendering my VF to a particular Pageblock (or bottom of the page) after using @Remote Action.
Can you please help ?
This is my Controller:

public without sharing class RController1 {
  
   @RemoteAction
  Public static boolean saveSign(String signatureBody, id sobjId){
 
    try{
      Attachment sign = new Attachment();
      sign.parentId = sobjId;
      sign.Body =  EncodingUtil.base64Decode(signatureBody);
      sign.ContentType = 'image/png';
      sign.Name = 'Signature Capture.png';
        insert sign;
      
    }catch(Exception e){
        return false;
      
    return null;
  }


}

My Visualforce Page:

<apex:page standardController="Registration__c" extensions="RController1">

  function saveSign(){
        var strDataURI = canvas.toDataURL();
           console.log(strDataURI);
            strDataURI = strDataURI.replace(/^data:image\/(png|jpg);base64,/, "");
              console.log(strDataURI);
               RegistrationController1.saveSign(strDataURI,parentId,
                         function(result,event){
                                     if (event.status){ 
                                          rerendAction();  }
                                      else{ console.log(event.message); ) } }, {escape:true} );
}

<apex:actionFunction name="rerendAction" rerender="sign"/>
  <apex:pageBlockSection title="Signature" id="sign">
          <c:Signature parentId="{!$CurrentPage.parameters.Id}"/>
            <br />
              <apex:pageBlockSectionItem >
                   <apex:commandButton onclick="javascript:clearArea();return false;" onkeypress="" value="Clear Signature" style="width:60%" /> <apex:commandbutton id="sign" onclick="saveSign()" value="Submit Signature" style="width:60%" />
              </apex:pageBlockSectionItem> <br />
</apex:pageBlockSection>

Thanks,

Raghu

Hi All,

I want to created a Lead Conversion Report (Converted Percentage) based on Lead Owner and Lead Source.
How to create this report ??

Thanks,
Raghu

Hello Gurus,
Need some understanding of how triggers work.

Wrote this Code (SFDC99)
Trigger

When I did a Debug, I got this ..
Debug
Trigger Executed Twice ???
Tried RunOnce..
RunOnce
And Got this ..

Debug1
Only Before Trigger is Executed .. Very Confused ..
Can someone please explain how triggers work ??

Thanks,
Raghu
My requirement is display account and coressponding contacts in visualforce page.  so i used pageblocksection . I used javascript code for default non-expand of data.  

If any one clicks on "leftside button"  then data expanding and  showing.  Thats well and working.   i want if a person clicks on text of pageblocksection title or pageblocksection  empty area then it should expand.

please help me what to do for it,  i started to write javascript code, but confused what to do write in it.   
 
<apex:page controller="actocons" tabStyle="Account">

<script>

function showdata()
{

}
</script>



    <apex:pageBlock >

    <apex:repeat value="{!acct}" var="a">

       <apex:pageBlockSection id="section1" title="{!a.name}" onclick="showdata()" >
<script>twistSection(document.getElementById("{!$Component.section1}").childNodes[0].childNodes[0]); </script>
           
<apex:outputField value="{!a.Name}"/>
         


       
         <apex:pageBlockTable value="{!a.Contacts}" var="c" id="j1">
                      <apex:column value="{!c.id}" />
            <apex:column value="{!c.lastname}"/>
            <apex:column value="{!c.email}" />
            
        </apex:pageBlockTable>   
        </apex:pageBlockSection>

    </apex:repeat>

    </apex:pageBlock>
</apex:page>







apex code:-




public class actocons
{
public list<account> acct{set;get;}
public actocons()
{
acct=[select id,name,(select id,lastname,email from contacts)from account limit 10 offset 4];
}
}