• masthan khan
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 8
    Replies
Hai, 
       Lead Assignment- Round Robin Process,  I Want to create a custom Button in listview page Assignment in Manager Profile, By  clicking on Assignment Button the leads should be distributed to the  users under the manager with Round Robin Process. How to achieve this.

With Regards
Masthan Khan.
Hai,
        I am trying to find the manager and managers.Manager when ever a record is inserted using trigger but it throwing error variable does not exist.

Code
public class Opportunity_handler {
    public string opname{set;get;}
    public static void afterInsert(List<Opportunity> optylist){
        for(opportunity a:optylist){
            string opname;
            opname=a.name;
        }
         opportunity op=[select id,ownerid from opportunity where name=:opname];
        user ow=[select id,manager.name,manager.id from user where  id=:op.ownerid];
         user mg1=[select id,manager.id from user where   id=:ow.manager.id];
           user vp1=[select id,manager.id from user where id=:mg1.manager.id];    
 }

}

Error:  Variable opname doesnot exist
Hai,
 A team is  to be  created whenever an opportunity is created with priority high checkbox high then, manager, regional manager and vp should be created as team member for opportunity.
How to create it using trigger.
 
Hai,
In object case i want to update a page layout with all the buttons disabled when ever the case status is closed.

With Regards
Masthan Khan
Hai,
       We have scenario like this when ever new lead is created lead score should be calculated   and inserted in feild name Leadscore__c  using before Trigger.

considering
Email -10 points,
Date of Birth- 10 points
Annual Revevenue 10points
Phone--10  Points
Contact Address - 10 Points
Company -10 points
Position__c- 10 points.

With Regards
Masthan Khan.
Hai,
   I am trying following sceanrio
Trgger  when ever opportunity stagename =closedwon automatically update the account field rating=hot.

the account field rating is not updating automatically.

trigger stage_closedwon_account_hot on Opportunity (after insert, after update) {
   set<id> ids=new set<id>();
    list<account> accs=new List<account>();
    for(opportunity a:trigger.new){
        if(a.stagename=='closed won'){
        id keys=a.account.id;
           ids.add(keys); 
        }
    }
    accs=[select id,rating from account where id=:ids];
    
    for(account ac:accs){
        ac.rating='hot';
    
    }update accs;
}
Regards
Masthan
hai,
   i had tried this in badge from trailhead, though i had created apex trigger it is showing error.
Error
Challenge not yet complete... here's what's wrong:
No Apex trigger named 'AccountAddressTrigger' was found

Apex Trrigger
trigger AccountAddressTrigger on Account (before insert) {
    for ( Account a : Trigger.new ) {
        if ( a.BillingPostalCode != NULL && a.Match_Billing_Address__c == true )
            a.shippingPostalCode = a.billingpostalcode;
        insert a;
    }
}

Regards
Masthan Khan
Hai, 
Iam Getting following error:
Line: 1, Column: 8
Invalid constructor syntax, name=value pairs can only be used for SObjects: Lead

Lead l=new Lead(lastname='Ch',FirstName='Satish',Company='Capital',leadSource='Web');
            insert l;
            Database.LeadConvert  lc =new Database.LeadConvert();
            lc.setLeadId(l.id);
            LeadStatus stat= [select id,MasterLabel  from LeadStatus where isConverted=true];
            lc.setConvertedStatus(stat.MasterLabel);
            Database.convertLead(lc);
With Regards
Masthan
Hai,
       When inserting arecord it is gthrowing following error :
 
System.DmlException: Insert failed. First exception on row 0; first error: STANDARD_PRICE_NOT_DEFINED, No standard price defined for this product: [];
public class DML_Practice_Usercase4 {
    public List<PriceBookEntry> pbe{set;get;}
    public List<product2> pb{set;get;}
    public list<Pricebook2> pb2{set;get;}
    public DML_Practice_Usercase4(){
       pbe=new list<PriceBookEntry>();
product2  pb=[select id from product2 where name='salesforce' ];
Pricebook2 pb2=[SELECT id FROM Pricebook2 WHERE Name = 'IndianPricebook'];
        PriceBookEntry p1=new PriceBookEntry();
        p1.Product2id=pb.id;
        p1.Pricebook2ID=pb2.id;
        p1.unitprice=10000;
         pbe.add(p1);  
        insert pbe;   
    }
}
hai,  i want to print Map<string,List<Account>> in Vf page. kindly  guide how to do it.
I am trying write a query 
string query='select id, rating,active__c from account where active__c=' '/';
but it is showing an error 
Extra ';', at '/'.
 
                                                                 
                                                                                                   
                                                                  
                                                                  accesskey="
                                accesskey="
                                           ""                    accesskey="
                                accesskey="
                                           ""
                                accesskey="
                                           ""
Hai, 
       Lead Assignment- Round Robin Process,  I Want to create a custom Button in listview page Assignment in Manager Profile, By  clicking on Assignment Button the leads should be distributed to the  users under the manager with Round Robin Process. How to achieve this.

With Regards
Masthan Khan.
Hello everyone,

I need to send data to a partner webservice through a callout. This will be done through a trigger that invokes this class.

Thanks
Hai,
       We have scenario like this when ever new lead is created lead score should be calculated   and inserted in feild name Leadscore__c  using before Trigger.

considering
Email -10 points,
Date of Birth- 10 points
Annual Revevenue 10points
Phone--10  Points
Contact Address - 10 Points
Company -10 points
Position__c- 10 points.

With Regards
Masthan Khan.
Hai,
   I am trying following sceanrio
Trgger  when ever opportunity stagename =closedwon automatically update the account field rating=hot.

the account field rating is not updating automatically.

trigger stage_closedwon_account_hot on Opportunity (after insert, after update) {
   set<id> ids=new set<id>();
    list<account> accs=new List<account>();
    for(opportunity a:trigger.new){
        if(a.stagename=='closed won'){
        id keys=a.account.id;
           ids.add(keys); 
        }
    }
    accs=[select id,rating from account where id=:ids];
    
    for(account ac:accs){
        ac.rating='hot';
    
    }update accs;
}
Regards
Masthan
Hai,
       When inserting arecord it is gthrowing following error :
 
System.DmlException: Insert failed. First exception on row 0; first error: STANDARD_PRICE_NOT_DEFINED, No standard price defined for this product: [];
public class DML_Practice_Usercase4 {
    public List<PriceBookEntry> pbe{set;get;}
    public List<product2> pb{set;get;}
    public list<Pricebook2> pb2{set;get;}
    public DML_Practice_Usercase4(){
       pbe=new list<PriceBookEntry>();
product2  pb=[select id from product2 where name='salesforce' ];
Pricebook2 pb2=[SELECT id FROM Pricebook2 WHERE Name = 'IndianPricebook'];
        PriceBookEntry p1=new PriceBookEntry();
        p1.Product2id=pb.id;
        p1.Pricebook2ID=pb2.id;
        p1.unitprice=10000;
         pbe.add(p1);  
        insert pbe;   
    }
}
I am trying write a query 
string query='select id, rating,active__c from account where active__c=' '/';
but it is showing an error 
Extra ';', at '/'.