• Tanuja J
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 9
    Replies
Hi
I have a  requirement regarding the matrix reports adding to the dashboard.As it is not possible to add Matrix report to the dashboard,the only solution left is to take help of visualforce and make look alike matrix report and add it to the dashboard.
It should have
sum of the amount,
the report should contain filtered products,
Grouped by etc etc
 In short it should work exactly the way we chose the data in matrix report through drag and drop in reports.
I hope I am clear.
​Many Thanks
Hi
I am unable to increase the size of the logo on home page in lightning.I have tried to increase the size of the logo and upload it.But the size looks the same.Please help
Hi Guys,
Requirement: Update Contact Mailing address with Account Address when a link is clicked in contacts pagelayout
What I have done: I have created a link in contact (when clicked it update the mailing address of contacts with accounts Updated address).
                             Execute Javascript with the code

{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")}

//alert('{!Contact.Id}{!Account.BillingCity}{!Account.BillingCountry}');

callback = sforce.apex.execute("MyWebService","myMethod",{billingcity:'{!Account.BillingCity}'},{billingCountry:'{!Account.BillingCountry}'},{billingState:'{!Account.BillingState}'},{contactId:'{!Contact.Id}'});

if(callback== 'OK'){
window.location.reload();
}
else{

alert('Error:' + callback);
}

And Have written an Apex code :

global class MyWebService {
    
/*    webservice static void myMethod(String billingcity, String billingCountry, String billingState,Id contactId ){
        Contact con = new Contact(Id=contactId,
                                  mailingCity=billingcity,
                                  mailingCountry=billingCountry,
                                  mailingState =billingState);
        update con;
    }*/
    
  //  webservice static void updateContact(Id contactId ){
    webservice static void myMethod(Id contactId ){
        List<Contact> conList = [select id, Account.billingcity,
                                   Account.billingCountry,Account.billingState
                                   From Contact Where id=:contactId ];
        Contact con = new Contact(Id=contactId,
                                  mailingCity=conList[0].Account.billingcity,
                                  mailingCountry=conList[0].Account.billingCountry,
                                  mailingState =conList[0].Account.billingState);
        update con;
    }

}

It gives errors and not updating the address.
Please help.Though the code looks small I am unable to debug where I am going wrong.

Error message is:OnSuccess not defined in the callBack.
 
Please help 
Doubt:Cant I use synchronoue or asynchronous ajax tool method..

I have also tried 
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 

// identify the record 
//var o = new sforce.SObject("Contact"); 
//var a= new sforce.SObject("Account"); 

var result = sforce.connection.query("SELECT "c.accountId " + "FROM Contact c, c.account a"); 



// make the field change 
c.mailingCity=c.account.billingcity; 
c.mailingCountry=c.account.billingCountry; 
c.mailingState =c.account.billingState; 


// save the change 
sforce.connection.update([c]); 

//refresh the page 
//window.location.reload();
Error for this code is :Unexpected token illegal.
 
Hi,
I am newbie learning Apex.
I have  gone through the Force.com developer guide.
Could you please explin me 
public static void applyDiscount(Book__c[] books)  what this means?
I have understood everything in that sentence exept bracket part(Book__c[] books)
I just want to know the meaning of book__c[] books.
Hi
I have a  requirement regarding the matrix reports adding to the dashboard.As it is not possible to add Matrix report to the dashboard,the only solution left is to take help of visualforce and make look alike matrix report and add it to the dashboard.
It should have
sum of the amount,
the report should contain filtered products,
Grouped by etc etc
 In short it should work exactly the way we chose the data in matrix report through drag and drop in reports.
I hope I am clear.
​Many Thanks
Hi All

I have one requirment on which i want to send a newsletter mail to contact.i am panning to integrate mailchimp with salesforce for achieve this solution.can anybody share step or guide for this.

 
Hello, 

I would like to avoid our users from creating PTO records with pto_date__c of January 10 onwards (of next year). PTO Records of current year is only counted if pto_date__c is within January 11 (current Year) until January 10 of next year.

I would also like to avoid them deleting these PTO records. They cannot delete their PTO records with pto_date__c from January 11 (last Year) to january 10 of this year. 

I am not sure how to do this. 
hal all
this is my trigger code& test class
getting code coverage 100% but method doesnot pass
trigger Accountactive on Account (after update) {
map<id,account>newmap=trigger.newmap;
map<id,account>oldmap=trigger.oldmap;
    list<id>listid=new list<id>();
for(id ids:oldmap.keyset())
{
    if(oldmap.get(ids).Actives__c=='Yes'&&newmap.get(ids).Actives__c=='No')
    {
        listid.add(ids);
    }

 list<contact>cons=[select id,lastname,phone,accountid from contact where accountid=:listid];
 delete cons;
}

testclass
@istest
public class Accountactivefortestclass {
@istest
    static void testme(){
        Account sc=new Account(name='NNN',Actives__c='Yes');
        insert sc;
        contact cs=new contact(lastname='NMN',Accountid=sc.id);
        insert cs;
        string ratings='No';
        account accs=[select id,name,Actives__c from account where id=:sc.id];
        accs.Actives__c=ratings;
       
        update accs;
          system.assertequals(accs.Actives__c,sc.Actives__c);
       
        //account ac=[select id,name,Actives__c from account where id=:sc.id];
       //system.assertEquals('No',ac.Actives__c);
       
        
    }
}
Hai hall  I am not getting code coverage please helpme
Trigger code
 
trigger Assignannualrevenue on Account (before update)

    if(trigger.isBefore && trigger.isupdate)
{
    for(account a:trigger.new){
        if(a.industry=='Banking')
        a.AnnualRevenue=1000;
         else if(a.industry=='Energy')
        a.AnnualRevenue=5000;
        else
            a.AnnualRevenue=50000;
    }
    }
}

testclass
@istest
public class AssignAnnualrevenue_Test {
@istest
    static void testme(){
       
        Account a1=new account(name='lll',industry='banking',Annualrevenue=null);
        Account a2=new account(name='kkkk',industry='energy' ,Annualrevenue=null);
        Account a3=new account(name='jjj',Annualrevenue=null);
        insert a1;
           insert a2;
           insert a3;
        
        decimal an=1000;
        account ac=[select id,name,industry,Annualrevenue from account where id=:a1.id];
       ac.AnnualRevenue=an;
        system.assertEquals(1000, ac.AnnualRevenue);
        update ac;
          decimal a=5000;
        account ae=[select id,name,industry,Annualrevenue from account where id=:a2.id];
       ae.AnnualRevenue=a;
        system.assertEquals(5000, ae.AnnualRevenue);
        update ae;
        decimal aa=50000;
        account ad=[select id,name,industry,Annualrevenue from account where id=:a3.id];
       ad.AnnualRevenue=aa;
        system.assertEquals(50000, ad.AnnualRevenue);
        update ad;
       
        
        //system.assertEquals(1000, ac.AnnualRevenue);
        //system.assertEquals(5000, ae.AnnualRevenue);
        //system.assertEquals(50000, ad.AnnualRevenue);
     
        
  
    }
}
 
Hi All,

I have created a custom checkbox field in the Opportunity object called "Confidential". The purpose of this checkbox is to restrict access to the record to only the Opportunity owner and any listed team members in that Opportunity when the checkbox is selected.

Please advise on how I can do this.

Thanks
Hello,

---------TRIGGER----------

trigger UpdateReportName on ActivityPlanningAndReport__c (before insert) {
     Map<Id,User> ownerMap;
     Set<Id> oppOwnerIds = new Set<Id>();
     String nameOfOwner;
     for(ActivityPlanningAndReport__c p : trigger.new)
    {
        oppOwnerIds.add(p.OwnerId);
    }
     ownerMap = new Map<Id,User>([SELECT Id, Name FROM User WHERE Id IN :oppOwnerIds]);
     for(ActivityPlanningAndReport__c p : trigger.new)
     {
          nameOfOwner = ownerMap.get(p.OwnerId).Name;
        if(p.Name!=null)
        {
            p.Name = p.Country_txt__c+'_'+ p.Display_Engagement_Date__c+'_'+nameOfOwner;
     }
     }   
   }