• RSK
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 11
    Replies

Hi,

 

I need to connect to twitter and get posts/tweets from twitter.  Has any one connected/integrated to twitter ?, Any help must be highly appreciated.

 

Thanks in advance !

 

 

Regards,

RSK

  • April 16, 2012
  • Like
  • 0

Hi, I'm trying to update a custom field asset_count__c which counts no of assets of an account, when updating account and getting the following error. Any help must me highly appreciated.

 

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger updateAssetCounton caused an unexpected exception, contact your administrator: updateAssetCounton: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 00190000004K1vLAAS; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 00190000004K1vL) is currently in trigger updateAssetCounton, therefore it cannot recursively update itself: []: Trigger.updateAssetCounton: line 20, column 1

 

trigger updateAssetCounton on Account (before update) {

List<Account> updateAssetCountList = new List<Account>();
List<Asset> assId = new List<Asset>();
Map<Id,Integer> mapAccount = new Map<Id,Integer>();
set<Id> accountIds = new set<Id>();


for(Account acc : Trigger.new){
      accountIds.add(acc.Id);
}
mapAccount = foundAsset(accountIds);

updateAssetCountList = [select asset_count__c,id from Account where Id in : mapAccount.KeySet()];
for(Account a: updateAssetCountList)
{
    a.asset_count__c = mapAccount.get(a.Id);
}

update updateAssetCountList;   // line 20




public Map<Id,Integer> foundAsset( set<Id> AccountIds2){

assId = [select id,AccountId from Asset where AccountId in:accountIds2];

if(assId.size()>0)
{
for(Asset accId : assId)
{
    if(mapAccount.containsKey(

accId.AccountId))
    {
        integer sum;
        sum = mapAccount.get(accId.AccountId);
        sum = sum+1;
        mapAccount.put(accId.AccountId,sum);
    }
    else
    {
        integer sum;
        sum = 1;
        mapAccount.put(accId.AccountId,sum);
    }
 }
}

else
{
    for(Id accId : accountIds2)
   {
       mapAccount.put(accId,0);
   }

}

 return mapAccount;
}

}
Thanks a ton in advance !
RSK
  • March 30, 2012
  • Like
  • 0

Hi,

I have a trigger on Asset to update no. of  assests of an Account on a account  custom field, it is working as expcted but failing to update assets when  merge accounts.  Any help must be highly appreciated.

 

Here is my trigger:

trigger updateAssetCountonAccount on Asset(after insert,after update,after delete) {
List<Account> updateAssetCountList = new List<Account>();
List<Asset> assId = new List<Asset>();
Map<Id,Integer> mapAccount = new Map<Id,Integer>();
set<Id> accountIds = new set<Id>();
for(Asset a : Trigger.new){
      accountIds.add(a.AccountId);
}

mapAccount = foundAsset(accountIds);
updateAssetCountList = [select asset_count__c,id from Account where Id in : mapAccount.KeySet()];
for(Account a: updateAssetCountList)
{
    a.asset_count__c = mapAccount.get(a.Id);
}

update updateAssetCountList;

public Map<Id,Integer> foundAsset( set<Id> AccountIds2){

assId = [select id,AccountId from Asset where AccountId in:accountIds2];
for(Asset accId : assId)
{
    if(mapAccount.containsKey(accId.AccountId))
    {
        integer sum;
        sum = mapAccount.get(accId.AccountId);
        sum = sum+1;
        mapAccount.put(accId.AccountId,sum);
    }
    else
    {
        integer sum;
        sum = 1;
        mapAccount.put(accId.AccountId,sum);
    }
 }


 return mapAccount;
}
}

 

Thanks  in advance !

 

Regards,

Rsk

  • March 12, 2012
  • Like
  • 0

Hi, can any one help me how to write a test method for the Apex callout ..

Here is the class:

global public with sharing class HttpCallout_CLS{
 public static String hitNumbertemp,dunstemp,compnametemp,compIdtemp,citytemp,countrytemp;
    String Accid = apexPages.currentPage().getParameters().get('id');
 
 Public static void sendRequest(){
    Integer i=0,j,k;
    String env;
    HttpRequest req = new HttpRequest();
    req.setMethod('GET');
    req.setHeader('content-type','text/xml');
    req.setTimeout(12000);    
    req.setEndpoint('http://xxx.com/API-32');
    String API_KEY = 'xxxx';
    Blob headerValue = Blob.valueOf(API_KEY);
    String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
    req.setHeader('Authorization', authorizationHeader);
    String CName = apexPages.currentPage().getParameters().get('Name');
    env = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://applications.dnb.com/webservice/schema/">'+
            '<soapenv:Header>'+
              '<sch:API-KEY>xxx</sch:API-KEY>'+
            '</soapenv:Header>'+
            '<soapenv:Body>'+
              '<sch:FindCompanyByKeywordRequest>'+
              '<sch:maxRecords>100</sch:maxRecords>'+
              '<sch:sortDirection>Ascending</sch:sortDirection>'+
              '<sch:keyword>'+CName+'</sch:keyword>'+
              '<sch:searchBy>companyName</sch:searchBy>'+
              '<sch:returnSearchNavigation>true</sch:returnSearchNavigation>'+
              '<sch:orderBy>CompanyName</sch:orderBy>'+
               '</sch:FindCompanyByKeywordRequest>'+
              '</soapenv:Body>'+
             '</soapenv:Envelope>';      
    req.setBody(env);
    System.debug(req.getBody());     
    Http http = new Http();
    HTTPResponse res = http.send(req);
              // *******Parsing XML Response *******
        Dom.Document doc = res.getBodyDocument();
    Dom.XMLNode envelope = doc.getRootElement();
    Dom.XMLNode body = envelope.getChildElement('Body','http://schemas.xmlsoap.org/soap/envelope/');
    Dom.XMLNOde keyWordResponse = body.getChildElement('FindCompanyByKeywordResponse','http://applications.dnb.com/webservice/schema/');
     for(Dom.XMLNode h1 : keyWordResponse.getChildElements()){  
          for(Dom.XMLNode child : h1.getChildElements()){      
               for(Dom.XMLNode h2 : child.getChildElements()){ 
                    if(h2.getName() == 'hit'){
                        for(Dom.XMLNode h3 : h2.getChildElements()){   
                           if(h3.getName() != 'companyResults'){
                                  hitNumbertemp = h3.getText();
                                }
                          else{                                           
                              for(Dom.XMLNode  h4 : h3.getChildElements()){
                                 if(i==0 || i==1 || i==2 || i==4 || i== 5 )
                                       {
                                           if(i == 0)
                                           {
                                             compIdtemp = h4.getText();
                                           }
                                           if(i == 1)
                                           {
                                              dunstemp = h4.getText();
                                           }
                                           if(i == 2)
                                           {
                                               compnametemp = h4.getText();    
                                           }
                                           if(i == 4)
                                           {
                                               streettemp = h4.getText();
                                           }
                                           if(i == 5)
                                           {
                                               citytemp = h4.getText();
                                           }
                                                                                     
                                           i++;
                                        }
                                       else if(i==15){
                                          WrapperClassList wrap = New WrapperClassList();
                                           wrap.duNs = dunstemp;
                                           wrap.comPanyName = compnametemp;
                                           wrap.companyId = compIdtemp;
                                           wrap.street = streettemp;
                                           wrap.City = citytemp;
                                           listWrapper.add(wrap);
                                          }
                                           i = 0;
                                       }  
                                       else
                                       {
                                           i++;
                                       }
                                   }
                           }
                        }      
                    }   
                }
                   
       }               
     }
}
  public List<WrapperClassList> getdataList(){
     return listWrapper;
  }
 
  public static List<WrapperClassList> listWrapper = New List<WrapperClassList>();
  public static Map<String,WrapperClassList> mapListWrapper = New Map<String,WrapperClassList>();
  public Class WrapperclassList{
      public String companyId{set;get;}
      public String comPanyName{set;get;}
      public String duNs{set;get;}
      public String street{set;get;}
      public String City{set;get;}
    
  }
 
}

 Thanks a ton in advance!

 

- Kumar

  • December 28, 2011
  • Like
  • 0

Hi,

Hope any one can help me with this.

I wish to generate a report of attachments within emails( from Case Emails).  Is there a way to do this and if so how is it done.

 

Thanks a ton in advance!

 

 

Regards,

Kumar

  • November 02, 2011
  • Like
  • 0

Hi,

 

I am unable to figure out how i can write test methods to cover code for my wrapper/inner class. It covers only 73 % and the highlighted (in red color) part is not covered. Can any one point me in the right direction?



public class showAsPDF_Cls {

  List<Case> cs = new List<Case>();
  Id Assid;
 
   public class WrapperCases{
       public Integer Count{set;get;}
       public Case CaseDetails{set;get;}
    }
    public List<WrapperCases> wrapperlist = new List<WrapperCases>();
 
   
    public showAsPDF_Cls(ApexPages.StandardController controller) {
      Assid = apexPages.currentPage().getParameters().get('id');
      cs = [select Serial_Number__c,Product_Lookup__c,Firmware_Version__c,CaseNumber,OwnerId,Status,CreatedDate,ClosedDate,Description,Resolution_Summary__c,DTS_c__c FROM Case where AssetId =: Assid order by CreatedDate ];
     
     
      for(Integer i=0; i<cs.size();i++){
           WrapperCases wp = new WrapperCases();
           wp.Count= i+1;
           wp.CaseDetails= cs[i];
           wrapperlist.add(wp);     
      }
     
    }
    public List<WrapperCases> getList(){
      return wrapperlist;  
    }
   

     static testMethod void testPDF(){
      Account acc = new Account(Name= 'Sample Acc');
      insert acc;
      pageReference p = system.CurrentPagereference();
      p.getParameters().put('id',acc.Id);
      Case c = new Case(status='test');
      insert c;

      WrapperCases w = New WrapperCases();
      List<WrapperCases> wlist = new List<WrapperCases>();
      w.count = 1;
      w.CaseDetails= c;
      wlist.add(w);
      ApexPages.StandardController QController = new ApexPages.StandardController(c);
      showAsPDF_Cls s = new showAsPDF_Cls(QController);
      s.getList();
    }
}

 

 

Any help is highly appreciated.

 

 

Thanks,

Kumar.

  • August 26, 2011
  • Like
  • 0

Hi,

I have created a VF page as PDF with 'renderAs' attribute. It works good. The issue is, by default it was created in Acrobat 1.4 version,I need to be create a PDF document in 1.6 version, how can we manage versions ?

 

Any help must be highly appreciated.

 

 

Thanks.

Kumar

  • July 27, 2011
  • Like
  • 0

Hi,

 

I want to display a value of Standard Number/currency field without ','.

Example 10000 instead of 10,000 as field value.

How can I do this ?

 

Any help must be highly appreciated.

 

 

Thanks,

Kumar

  • July 21, 2011
  • Like
  • 0

Hi,

 

I'm facing an issue while passing parameters with <apex:outputLink> to a VF page , if the parameter value having the '&' char  ( For example : CompanyName is P & B Computers), it takes '&' as a separator and displays only the text before '&' (ex:  P as the CompanyName).

 

Here is the Code :

 

<apex:outputLink value="/apex/CompanyPage_VF?companyName={!a.companyName}&street={!a.street}&city={!a.City}&state={!a.State}&country={!a.Country}" id="theLink">
             Click Here
          </apex:outputLink> 

 

Any help must be appreciated.

 

Thanks

Kumar




  • July 11, 2011
  • Like
  • 0

Hi,

I'm displaying list of Cases of Account as Pdf by using renderAs attribute on Apex Page, but found lot of garbage at the bottom of the PDF file like

 

JanFeb....Dec,

Sun,Mon...Sat,

Today

I want to clean up all this garbage on the PDF. Any help must be highly appreciated.

 

Thanks In Advance,

Kumar.

  • May 27, 2011
  • Like
  • 0

 Hi, I need to remove special characters in a string ?, do we have any apex methods to remove spl characters ? Or any alternate solution ?.

Any help is highly appreciated.

 

Thanks In Advance,

Kumar

  • April 27, 2011
  • Like
  • 0

Hi, I'm trying to update a custom field asset_count__c which counts no of assets of an account, when updating account and getting the following error. Any help must me highly appreciated.

 

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger updateAssetCounton caused an unexpected exception, contact your administrator: updateAssetCounton: execution of BeforeUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 00190000004K1vLAAS; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = 00190000004K1vL) is currently in trigger updateAssetCounton, therefore it cannot recursively update itself: []: Trigger.updateAssetCounton: line 20, column 1

 

trigger updateAssetCounton on Account (before update) {

List<Account> updateAssetCountList = new List<Account>();
List<Asset> assId = new List<Asset>();
Map<Id,Integer> mapAccount = new Map<Id,Integer>();
set<Id> accountIds = new set<Id>();


for(Account acc : Trigger.new){
      accountIds.add(acc.Id);
}
mapAccount = foundAsset(accountIds);

updateAssetCountList = [select asset_count__c,id from Account where Id in : mapAccount.KeySet()];
for(Account a: updateAssetCountList)
{
    a.asset_count__c = mapAccount.get(a.Id);
}

update updateAssetCountList;   // line 20




public Map<Id,Integer> foundAsset( set<Id> AccountIds2){

assId = [select id,AccountId from Asset where AccountId in:accountIds2];

if(assId.size()>0)
{
for(Asset accId : assId)
{
    if(mapAccount.containsKey(

accId.AccountId))
    {
        integer sum;
        sum = mapAccount.get(accId.AccountId);
        sum = sum+1;
        mapAccount.put(accId.AccountId,sum);
    }
    else
    {
        integer sum;
        sum = 1;
        mapAccount.put(accId.AccountId,sum);
    }
 }
}

else
{
    for(Id accId : accountIds2)
   {
       mapAccount.put(accId,0);
   }

}

 return mapAccount;
}

}
Thanks a ton in advance !
RSK
  • March 30, 2012
  • Like
  • 0

Hi,

I have a trigger on Asset to update no. of  assests of an Account on a account  custom field, it is working as expcted but failing to update assets when  merge accounts.  Any help must be highly appreciated.

 

Here is my trigger:

trigger updateAssetCountonAccount on Asset(after insert,after update,after delete) {
List<Account> updateAssetCountList = new List<Account>();
List<Asset> assId = new List<Asset>();
Map<Id,Integer> mapAccount = new Map<Id,Integer>();
set<Id> accountIds = new set<Id>();
for(Asset a : Trigger.new){
      accountIds.add(a.AccountId);
}

mapAccount = foundAsset(accountIds);
updateAssetCountList = [select asset_count__c,id from Account where Id in : mapAccount.KeySet()];
for(Account a: updateAssetCountList)
{
    a.asset_count__c = mapAccount.get(a.Id);
}

update updateAssetCountList;

public Map<Id,Integer> foundAsset( set<Id> AccountIds2){

assId = [select id,AccountId from Asset where AccountId in:accountIds2];
for(Asset accId : assId)
{
    if(mapAccount.containsKey(accId.AccountId))
    {
        integer sum;
        sum = mapAccount.get(accId.AccountId);
        sum = sum+1;
        mapAccount.put(accId.AccountId,sum);
    }
    else
    {
        integer sum;
        sum = 1;
        mapAccount.put(accId.AccountId,sum);
    }
 }


 return mapAccount;
}
}

 

Thanks  in advance !

 

Regards,

Rsk

  • March 12, 2012
  • Like
  • 0

Hi,

Hope any one can help me with this.

I wish to generate a report of attachments within emails( from Case Emails).  Is there a way to do this and if so how is it done.

 

Thanks a ton in advance!

 

 

Regards,

Kumar

  • November 02, 2011
  • Like
  • 0

Hi,

 

I am unable to figure out how i can write test methods to cover code for my wrapper/inner class. It covers only 73 % and the highlighted (in red color) part is not covered. Can any one point me in the right direction?



public class showAsPDF_Cls {

  List<Case> cs = new List<Case>();
  Id Assid;
 
   public class WrapperCases{
       public Integer Count{set;get;}
       public Case CaseDetails{set;get;}
    }
    public List<WrapperCases> wrapperlist = new List<WrapperCases>();
 
   
    public showAsPDF_Cls(ApexPages.StandardController controller) {
      Assid = apexPages.currentPage().getParameters().get('id');
      cs = [select Serial_Number__c,Product_Lookup__c,Firmware_Version__c,CaseNumber,OwnerId,Status,CreatedDate,ClosedDate,Description,Resolution_Summary__c,DTS_c__c FROM Case where AssetId =: Assid order by CreatedDate ];
     
     
      for(Integer i=0; i<cs.size();i++){
           WrapperCases wp = new WrapperCases();
           wp.Count= i+1;
           wp.CaseDetails= cs[i];
           wrapperlist.add(wp);     
      }
     
    }
    public List<WrapperCases> getList(){
      return wrapperlist;  
    }
   

     static testMethod void testPDF(){
      Account acc = new Account(Name= 'Sample Acc');
      insert acc;
      pageReference p = system.CurrentPagereference();
      p.getParameters().put('id',acc.Id);
      Case c = new Case(status='test');
      insert c;

      WrapperCases w = New WrapperCases();
      List<WrapperCases> wlist = new List<WrapperCases>();
      w.count = 1;
      w.CaseDetails= c;
      wlist.add(w);
      ApexPages.StandardController QController = new ApexPages.StandardController(c);
      showAsPDF_Cls s = new showAsPDF_Cls(QController);
      s.getList();
    }
}

 

 

Any help is highly appreciated.

 

 

Thanks,

Kumar.

  • August 26, 2011
  • Like
  • 0

Hi,

 

I want to display a value of Standard Number/currency field without ','.

Example 10000 instead of 10,000 as field value.

How can I do this ?

 

Any help must be highly appreciated.

 

 

Thanks,

Kumar

  • July 21, 2011
  • Like
  • 0

Hi,

 

I'm facing an issue while passing parameters with <apex:outputLink> to a VF page , if the parameter value having the '&' char  ( For example : CompanyName is P & B Computers), it takes '&' as a separator and displays only the text before '&' (ex:  P as the CompanyName).

 

Here is the Code :

 

<apex:outputLink value="/apex/CompanyPage_VF?companyName={!a.companyName}&street={!a.street}&city={!a.City}&state={!a.State}&country={!a.Country}" id="theLink">
             Click Here
          </apex:outputLink> 

 

Any help must be appreciated.

 

Thanks

Kumar




  • July 11, 2011
  • Like
  • 0

Hi,

I'm displaying list of Cases of Account as Pdf by using renderAs attribute on Apex Page, but found lot of garbage at the bottom of the PDF file like

 

JanFeb....Dec,

Sun,Mon...Sat,

Today

I want to clean up all this garbage on the PDF. Any help must be highly appreciated.

 

Thanks In Advance,

Kumar.

  • May 27, 2011
  • Like
  • 0

 Hi, I need to remove special characters in a string ?, do we have any apex methods to remove spl characters ? Or any alternate solution ?.

Any help is highly appreciated.

 

Thanks In Advance,

Kumar

  • April 27, 2011
  • Like
  • 0

Hi,

I am trying to make a callout from APEX to an HTTP endpoint(Hoover's API)  but am receiving the following error:

 
 500, internal server error'.

Here is my Apex class :



global public with sharing class HttpCallout_CLS {

    Public static void sendRequest(){
   
    String API_KEY = 'XXX';
   
    String env;
    env =  '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://applications.dnb.com/webservice/schema/">'+
             '<soapenv:Header>'+
                '<sch:API-KEY>XXX</sch:API-KEY>'+
             '</soapenv:Header>'+
             '<soapenv:Body>'+
               '<sch:FindCompanyByKeywordRequest>'+
                 '<sch:sortDirection>Ascending</sch:sortDirection>'+

                 '<sch:keyword>xyz</sch:keyword>'+

- Hide quoted text -

                 '<sch:searchBy>companyName</sch:searchBy>'+
                 '<sch:returnSearchNavigation>false</sch:returnSearchNavigation>'+
                 '<sch:orderBy xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>'+
                 '<sch:searchNavigation>'+
                   '<sch:employeeSearchNavigation>'+
                   '</sch:employeeSearchNavigation>'+
                   '<sch:ownershipTypeSearchNavigation>'+
                   '</sch:ownershipTypeSearchNavigation>'+
                   '<sch:locationTypeSearchNavigation>'+
                   '</sch:locationTypeSearchNavigation>'+
                   '<sch:salesSearchNavigation>'+
                   '</sch:salesSearchNavigation>'+
                   '<sch:locationSearchNavigation>'+
                     '<sch:countryNavigation>'+
                       '<sch:countryNavigationValue>${#Project#countryNavigationValue}</sch:countryNavigationValue>'+
                       '<sch:stateNavigation>'+
                        '<sch:stateNavigationValue>${#Project#stateNavigationValue}</sch:stateNavigationValue>'+
                        '<sch:cityNavigation>'+
                          '<sch:cityNavigationValue>${#Project#cityNavigationValue}</sch:cityNavigationValue>'+
                        '</sch:cityNavigation>'+
                      '</sch:stateNavigation>'+
                    '</sch:countryNavigation>'+
                  '</sch:locationSearchNavigation>'+
                  '<sch:industrySearchNavigation>'+
                  '</sch:industrySearchNavigation>'+
                '</sch:searchNavigation>'+
              '</sch:FindCompanyByKeywordRequest>'+
            '</soapenv:Body>'+
          '</soapenv:Envelope>';
 
   Http h = new Http();
    HttpRequest req = new HttpRequest();
    req.setEndpoint('http://hapi.hoovers.com/HooversAPI-32');
    req.setMethod('POST');
    req.setBody(env);
    req.setTimeout(12000);
   
    Blob headerValue = Blob.valueOf(API_KEY);

    String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
    req.setHeader('Authorization',authorizationHeader);

       
    HTTPResponse res = h.send(req);
    System.debug(res.getBody());
    }
}




  I tried with username and password also, even though i'm facing the same issue. Has anyone experienced anything similar to this?.   Any help must be appreciated.

Thanks Inadvance,
Satheesh

I have set up the twitter for chatter & see the postings go back n forth . My question is how do i get the feeds to display on the profile page rather than having to go the twitter tab in salesforce to log in & see updates. Also any ideas on how to set up twitter to case creation?

 

Thanks

  • June 28, 2010
  • Like
  • 0