• Alisa Zhurova
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies
Hello, I need to create web-to-lead form, in which instead of a product interest, there should be a product(lookup). How correctly to do this ?
 
I to create in Lead object custom field Product (Lookup) , but in web-to lead in Advanced fields this not watched(
User-added imageUser-added image
trigger UpdatePrice on Product2 (after insert) {
	
    list<PricebookEntry> pblist=new list<PricebookEntry>();
    PricebookEntry pr=new PricebookEntry();  
      
    for(Product2 ps:trigger.new){
        if(ps.isActive==false){
            pr.Product2Id = ps.id;
            pr.Pricebook2Id = '01s5g00000JO516AAD';
            pr.isActive = true;
            
            Integer len = 5;
            final String chars = '123456789';
            String randStr = '';
            
            while(randStr.length()<len){
                Integer idx = Math.mod(Math.abs(Crypto.getRandomInteger()), chars.length());
                randStr += chars.substring(idx,idx+1);
            }
            
            pr.UnitPrice = Integer.valueOf(randStr);
        }
    }         
    
    pblist.add(pr);
    insert pblist;

    system.debug('***'+pr);

}
User-added imageUser-added imageUser-added imageUser-added image
 
Hi, I to create process builder and I need to create random number?
Help me, please
 
MATH.ROUND(MATH.RANDOM()*1000)
 
In this formula no correct function Math.random(
 
Hello, I need to create web-to-lead form, in which instead of a product interest, there should be a product(lookup). How correctly to do this ?
 
I to create in Lead object custom field Product (Lookup) , but in web-to lead in Advanced fields this not watched(
User-added imageUser-added image