• Amit K A
  • NEWBIE
  • 135 Points
  • Member since 2015


  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 22
    Replies
Hello,

How to read a HTTPResponse (XML responce). and convert it in to a map.

 
  • October 16, 2015
  • Like
  • 0
Hi All,

I am working on person account , and need to extract contact id so i can link that contact with my others object.
 
Hi,

1.To make responsive design,which one best:salesforce Lighting or Bootstrap with visualforce page.Actually
i need to change page layout and to replace VF page by lighting component framework to make responsive to
other device mobile and tablets.Using lighting framework,i have to make responsive design for exiting web
site so that we have better performance and better look and feel on small devices like mobile and tablets.
Is lighting is best for this kind of change? or Which one is best for responsive design.

2.Can we add visualforce page to lighting for responsive design or we have to replace exiting visualforce page 
with lighting component framwork. Any help would be greatly appreciated.
Thanks!
I am new to SFDC , I want to get the size of string variable into my apex code . How can i do this?
Hi guys,

I wrote a trigger to count the number of child Accounts in the hierarchy and store it in a custom field in the Parent Account.
Trigger works fine, except when I remove the parent-child mapping from one of the child Accounts ("deparent"). The count does not go down.
I'm pretty sure I'm overlooking something here. Any help appreciated.
Thank you !!
 
trigger countChildAcc on Account (after Insert, after Update) {
    Set<Id> Ids= new Set<Id>();
    List<Account> acclist = new List<Account>();
    Integer count = 0;
    
    if(Trigger.isInsert || Trigger.isUpdate){
        for(Account acc: Trigger.new){
            if(acc.ParentId!=null)
                Ids.add(acc.ParentId);
            acclist.add(acc);
        }
    }
    
    if(Trigger.isDelete){
        for(Account acc: Trigger.old){
            if(acc.ParentId!=null)
                Ids.add(acc.ParentId);
            acclist.add(acc);
        }
    }
        
    if(Ids.size()>0){
        List<Account> accChild = new List<Account>([SELECT Id,ParentId FROM Account WHERE ParentId IN: Ids]);
        List<Account> accParent = new List<Account>([SELECT Id,No_of_Child_Accounts__c FROM Account WHERE Id IN: Ids]);
        for(Account ac: accParent){
            count =0;
            for(Account acChild: accChild){
                if(acChild.ParentId == ac.Id)
                    count++;
            }
            ac.No_of_Child_Accounts__c = count;            
        }
        try{
            upsert accParent;
        }catch(DMLException ex){
            System.debug('Exception is '+ex);
        }
    }
}


Hi,

I used Messaging.sendEmail(List_of_50emails, false) to send out emails to 50 different email addresses at the single sendEmail call.
And each email sent have bcc to myself to make sure that all of the 50 recipients get their emails.

I test this on sandbox and I recieved  50 bcc emails just fine. But on production, I recieved only 25 bbc emails back.  No matter how many time I tried.

I check the SF Email Logs for a specefic recipient who didn't get the email, and there is no log on that email delivery either. So I assume the system didn't send out emails to some ppl on the emails list at all.

Any advise on where to look would be really helpful. It's pretty emergency to fix this issue. 

Thank you very much. 

 

Hi,

We can get all details of field using DescribeFieldResult class, but i am not able to find how to get created by and last modified by id for a field

Please advise.

Thanks
krishna
Hi Everyone,

I need the functionality that Pricebook should be automatically assign when a opportunity created(Account Should be mantatory). Account is being created based on the Zipcode. We have a field in Zipcode table as "Pricebook Name"(This is reffered from Pricebook table) .

For example, I have data from Zipcode table Zip=12345 and Pricebook_Name="US Pricebook"(It will be reffered from Pricebook table).
Account have created for the Zip '12345'. Now when i create a new opportunity to this account it should be assign "US Pricebook" automatically. How i can acheive this ? Is it a trigger or Validation rules or Lookup formula.?

Any help on this.

Thanks in advance.

 
Hi, I have been doing fairly simple validation rules but am having a Friday problem!

Essentially I am trying to create a validation rule on a custom object:

If a scheme name is set to a specific text string AND a picklist value is a certain value THEN display the error message - you cant save the record - the scheme name should be something other than CAP VG PH12.


AND( if ( CS_Scheme__r.Name," CAP VG PH12 "), AND( ISPICKVAL(Status__c , "filled"),null )
I know the above is not right but really would value some pointers.
thanks
 
Hi
I Have created one custom LOOKUP RELATIONSHIP page,i didget search by results link and also when i click on search by results it will refersh from server.please tell me as early as possible.
Thanks
RANGA
Hello,

I have string values which i want to put them in to Map
String a = Element: id, text=abcd, attribute #1:idName=name
map
key = 0, [Value1 = abcd, Value2 = name]
Thanks !
 
  • October 16, 2015
  • Like
  • 0
I have two stage ie task and event. My Custom field is "Latest Feedback" once customer create task means i fetch the feedback from task based on the "status" is completed and if the customer is reach event means same as above. My trigger is working fine but is not updated the event feedback it is show only task feedback.

This is my two trigger for update latest feedback on Account Page.

 trigger change_feedback on Task (after insert, after update) { 
        Set accountSet = new Set();
    
        List<Id> accIds = new List<Id>();    
        //variable to hold account id & task feedback
        Map<Id,String> accntValMap = new Map<Id,String>();
    
        //get task Account id & Feedback for tasks with Status "Completed"
        for(Task t : trigger.new){
            if(t.Status == 'Completed') {
                accntValMap.put(t.whatId,t.FEEDBACK__C); 
            }    
        }
    
        //query the accounts that we need to update
        List<Account> acctsToUpdate = [Select Id from Account where id in :accntValMap.keySet()];
    
        //now use the map variable to update the account field
        for(Account acc : acctsToUpdate){
            acc.Feedback__c = accntValMap.get(acc.Id);
        }
    
        //update the accounts back to database
        update acctsToUpdate;
    }

An After Insert trigger on Feedback that writes back to Event, and an After Update trigger on Feedback that waits for a related Latest Feedback to be created.

    trigger change_feedbackOnEvent on Event  (after insert, after update)  {
         Set<String> accountSet = new Set<String>();
         
         List<Event> events = [select Id,Whatid,FEEDBACK__C from Event where
         id in :trigger.newMap.keySet()];
         List<string> accIds = new List<string>();    
         //variable to hold account id & task feedback
         Map<Id,String> accntValMap = new Map<Id,String>();
         
         //get task Account id & Feedback for tasks with Status "Comnpleted"
         for(Event e : trigger.new){
            if(e.Feedback != '') {
              accIds.add(e.whatId);
            accntValMap.put(e.whatId,e.FEEDBACK__C); 
            }    
         }
         
          //query the accounts that we need to update
         List<Account> acctsToUpdate = [Select Id from Account where id in
         :accntValMap.keySet()];
         
         //now use the map variable to update the account field
        for(Account acc : acctsToUpdate){
         acc.Feedback__c = accntValMap.get(acc.Id);
        }
      
        //update the accounts back to database
        update acctsToUpdate;
    }

Both triggers are working fine but after created event that showing the task feedback in latest feedback field(custom field). I want the latest feedback of event.
Hi,
Give me the sample code for web to lead scenario. When web to lead is saved it has to go for the perticular record for example lead government record type.

Thanks,
Swathi
Hi,
i am getting same error as Compile Error: AND operator can only be applied to Boolean expressions at line 5 column 41

Thanks,
Swathi.
Hi,
Trigger SetRecordToFixedRecordType on Lead(before insert)

    Id recId=recordTypeId('Lead','Lead - GOVT'); 

    for(Lead led :Trigger.new)

    { 
    if(led.Status__c='Submitted' && led.Web_To_Lead__c='Lead - GOVT')
        { 
            led.RecordTypeId='012280000005fr1'; 
        } 
    }
 Public static Id recordTypeId(string Lead,string GOVT)

    Id recTypeId; 
    if(Lead!= null && Lead - GOVT != null)
    { 
    recTypeId= Schema.getGlobalDescribe().get(Lead).getDescribe().getRecordTypeInfosByName().get(Lead - GOVT).getRecordTypeId();
    }
     return recTypeId; 
    } 

}


This is the trigger written for web to lead .when the webtolead is saved it has to to perticular record type but i am getting error.

Thanks,
swathi.
I want to write the trigger in such a way that when ever new lead is getting created it automatically sens email and also attch one pdf attchment to it... I written some logic.. which is working fine when ever new lead is created it send the email but wont be able to write the logic for attchment... I am confused.. from where i have to get the attchment.. because while inserting recors.. there is no such filed of attchment... it ony comes when i save the data"Notes and attachment"/...
trigger SendAttchmnt on Lead (before Insert,before update,after Insert) 
{
 if(trigger.isInsert || trigger.isUpdate)
 {
  for(Lead l : trigger.New)
  {  
   if(l.email == null)
   {
   l.addError('Email Req');
   }
  }
 }
 
 if(trigger.isInsert && trigger.isAfter)
 {
  List<Messaging.SingleEmailMessage> mailList = new List<Messaging.SingleEmailMessage>();
  for(Lead ld : trigger.New)
  {
   if(ld.Email != null)
   {   
    Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
    List<String> toAddresses = new List<String>();
    toAddresses.add(ld.Email);
    email.setToAddresses(toAddresses);
    email.setSubject('Lead generated!');
    String message = '<html><body>Hi ' +ld.name + ', <br/>Lead Created '+'You are now customer of our group.<br/><br/> <b>Regards,</b><br/> Admin </body>  </html>';
    email.setHtmlBody(message);
    mailList.add(email);          
   //Messaging.sendEmail(new Messaging.SingleEmailMessage[]{email});
   }   
  }
  Messaging.sendEmail(mailList);   
  
  List<Messaging.Emailfileattachment> fileAttachments = new List<Messaging.Emailfileattachment>(); 
 }
}

​i had wriiten half the code of attachment but I got confused..so i left there,,..a dn one mor thing which i face the problem in line 26 in the body tag Hi, after that it shows Null (Hi Null,) why the name is not getting in email....
Hello,

How to read a HTTPResponse (XML responce). and convert it in to a map.

 
  • October 16, 2015
  • Like
  • 0
Hi All,

I am working on person account , and need to extract contact id so i can link that contact with my others object.
 
When querying the API, I am able to return results for all fields except Lat/Long. When looking that those fields, only a NULL value is returned. Is they any way to change this?
Hi,

1.To make responsive design,which one best:salesforce Lighting or Bootstrap with visualforce page.Actually
i need to change page layout and to replace VF page by lighting component framework to make responsive to
other device mobile and tablets.Using lighting framework,i have to make responsive design for exiting web
site so that we have better performance and better look and feel on small devices like mobile and tablets.
Is lighting is best for this kind of change? or Which one is best for responsive design.

2.Can we add visualforce page to lighting for responsive design or we have to replace exiting visualforce page 
with lighting component framwork. Any help would be greatly appreciated.
Thanks!
I am new to SFDC , I want to get the size of string variable into my apex code . How can i do this?
Hi all, 
I want to get the limited number of records from the custom settings..
How it is possible.. ?

Please help me.

Thanks and Regards
Anji reddy K