• jishan roy
  • NEWBIE
  • 40 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 45
    Questions
  • 40
    Replies

Hii everyone,

10 digit Phone number format is (xxx) xxx-xxxx but i want less than 10 digit then also format should be work. If suppose my phone field have 9 digit 123456789 then i want this type of format like (123) 456-789
is it possible? it should be work between 7 number.

i have formula given below:
IF( NOT(ISBLANK(Phone)), IF( LEN(Phone) >= 7, "(" & LEFT(Phone,3) & ") " & MID(Phone,4,3) & "-" & RIGHT(Phone, LEN(Phone)-6), Phone ), "" )

this formula i use on flow builder its working good when record is created but not working when record is updated. when i updated record format had not correct.

Thanks in advance!
 

Hii all,

can anyone help me out of this question?

10 digit Phone number format is (xxx) xxx-xxxx but i want less than 10 digit then also format should be work. If suppose my phone field have 9 digit 123456789 then i want this type of format like (123) 456-789
is it possible? it should be work between 7 number.
hii @all can you please help me out of this 

i have lead custom field which is "signup date" whenever lead signup date is not null then lead is automatically converted and created account, contact, and opportunity.
hii @all

my que is when i create lead record like lastname ? as question mark then record is saved on 001 as last name same as created 2nd lead record and last name ? as questionmark then after saved record last name is 002 so ..... 
but this is worked well when i create single single record but when i insert bulk record 10 record using data loader then all record lastname is 001,001,001 like this i want for 1st record 001,for 2nd record 002,for 3rd record 003 like this please help me out of this  
i Wrote code :

this is my code:
helper:
trigger LeadTriggerLastName on Lead (before insert, before update) {
    if(trigger.isbefore && trigger.isinsert ){
        system.debug('isinsert fired AutoNumberLead');
        AutoNumberLeadhandler.countNo(trigger.new, null);
    }
    else if(trigger.isbefore && trigger.isupdate){
        system.debug('isupdate fired AutoNumberLead');
        AutoNumberLeadhandler.countNoUpdate(trigger.new, trigger.oldmap);
    }
}


handler:
public class AutoNumberLeadhandler {
public static void countNo(List<Lead> newLead, Map<Id,lead> OldLead){
        for (Lead l : newLead) {
            if (l.LastName == '?' && OldLead == null) {
                system.debug('isinsert fired ');
                // Generate the auto-numbered last name
                String autoLastName = 'Lead' + String.valueOf([SELECT count() FROM Lead WHERE LastName LIKE '%Lead%']).leftPad(3, '0');
                l.LastName = autoLastName;
            }
        }
    }
    
    public static void countNoUpdate(List<Lead> newLead, Map<Id,lead> OldLead){
        for(lead le : newLead){
            if(le.lastname == '?' && OldLead.get(le.Id).lastname != le.lastName){
                system.debug('isupdate fired ' );
                String autoLastName = 'Lead' + String.valueOf([SELECT count() FROM Lead WHERE LastName LIKE '%Lead%']).leftPad(3, '0');
                le.LastName = autoLastName;
            }
        }
    }
}



Thank you!
hello,

my requirement is when lead lastname is ? questionmark the display lastname is lead 001, lead002 like this so i write trigger but it will work only single record crerated then it will run perfect when i insert record in bulk like data loader then all record lastname had showed lead001, lead001 like that so i want lead001, lead002.

this is my code:
helper:
trigger LeadTriggerLastName on Lead (before insert, before update) {
    if(trigger.isbefore && trigger.isinsert ){
        system.debug('isinsert fired AutoNumberLead');
        AutoNumberLeadhandler.countNo(trigger.new, null);
    }
    else if(trigger.isbefore && trigger.isupdate){
        system.debug('isupdate fired AutoNumberLead');
        AutoNumberLeadhandler.countNoUpdate(trigger.new, trigger.oldmap);
    }
}


handler:
public class AutoNumberLeadhandler {
public static void countNo(List<Lead> newLead, Map<Id,lead> OldLead){
        for (Lead l : newLead) {
            if (l.LastName == '?' && OldLead == null) {
                system.debug('isinsert fired ');
                // Generate the auto-numbered last name
                String autoLastName = 'Lead' + String.valueOf([SELECT count() FROM Lead WHERE LastName LIKE '%Lead%']).leftPad(3, '0');
                l.LastName = autoLastName;
            }
        }
    }
    
    public static void countNoUpdate(List<Lead> newLead, Map<Id,lead> OldLead){
        for(lead le : newLead){
            if(le.lastname == '?' && OldLead.get(le.Id).lastname != le.lastName){
                system.debug('isupdate fired ' );
                String autoLastName = 'Lead' + String.valueOf([SELECT count() FROM Lead WHERE LastName LIKE '%Lead%']).leftPad(3, '0');
                le.LastName = autoLastName;
            }
        }
    }
}
hii everyone,

I write trigger for opportunity description field display on account description field, but my trigger working for only latest opportunity description i want all account related opportunity description showed in account description.

this is my code:
trigger UpdateAccountDescription on Opportunity (before insert, before update, after insert, after update) {
    List<Opportunity > oppList =new List<Opportunity >();
    Set<Id> setid = new  Set<Id>();
    
    if(trigger.isBefore){
        system.debug('trigger before event');
        oppList = trigger.new;
        
    }else if(trigger.isAfter){
        oppList=trigger.new;
        for(Opportunity opp:oppList){
            setid.add(opp.AccountId); 
        }
        
        system.debug('setid ' + setid);
        
        List<Account> accList = [Select Id, Name, Description From Account  Where Id=:setid];
        
        if(trigger.isInsert){                     
            
            for(Opportunity opp1:trigger.new){
                for(Account a1:accList){
                    a1.Description= opp1.Description+ ' ';
                    update a1;
                }   
            }
            
        }else if(trigger.isUpdate){
            for(Opportunity opp2:trigger.new){
                for(Account a2:accList){
                    a2.Description= opp2.Description+ ' ' ;
                    update a2;
                }   
            }
            }
        }
    }




Thanks in advance!
Hii @all

can anybody help me to out of this question,

when opportunity description field update then all opportunity description field shows in account description field using trigger.
hello,
There is a button on leads home page called "Send list email" where a user can select multiple leads and send emails to all of them using this button. My task is when i click on this button and emails are sent then I want to automatically change the status of leads from Open - Not Contacted to Working - Contacted.


can anyone help me out of this question?

thanks in advanced.
hello,
i want which is the best azure connector for salesforce to integrate and pricing and benefits.
Any body give me any suggestion for this
In Production in email showing "Connect Your Email and Calendar"
whenever i connect with account then after it will connect but sometime later its dissconnect how to fix this.

thanks in advance.

Detail : in lead object there are account linkedin field and on that field there are linkedin url but whenever i clicked on this link it will not redirect on linkedin page i think link is not generated.

so for that i created 1 formula field and on that my formula is like:
HYPERLINK("https://www.linkedin.com/in/FirstName" ,"https://www.linkedin.com","__blank"

 

this is my formula but its not working 

if account linkedin field had link then redirect to linkedin page

thanks in advance,

hi,
When a recipient replies to an email, then the contact is removed from the workflow,
can anybody give me any suggestion regarding this workflow rule?
I want to create helper and handler of this trigger:

trigger oppOwnerTrigger on Opportunity (before insert,before update) {
    set<id> setAccountId = new set<id>();
    for(Opportunity opp: trigger.new){
        if(opp.AccountId !=Null){
            setAccountId.add(opp.AccountId); 
        }
    }
    Map<id,Account> mappaccidwithvalues = new map<id,Account>();
    
    for(Account acc:[select id,ownerid from Account where id=:setAccountId]){
        mappaccidwithvalues.put(acc.id,acc);
    }
    for (Opportunity op:trigger.new){
        if(mappaccidwithvalues.containskey(op.accountid)){
            op.ownerId = mappaccidwithvalues.get(op.accountid).ownerid;
        }
    }
}
This is my trigger:
Whats wrong in this trigger please help me out of this problem.

code:
trigger oppOwnerTrigger on Opportunity (after insert) {
    set<id> setAccountId = new set<id>();
    list<Opportunity> oppolist = new list<Opportunity>();
    for(Opportunity opp: trigger.new){
        setAccountId.add(opp.AccountId); 
    }
list<Account> acclist=[select id, Name, (select id ,Owner.Name from opportunities) from account where Name != 'null'];
    for (Opportunity op:trigger.new){
    for(Account accc : acclist){
        op.Name = accc.Owner.Name;
        system.debug('Account' + accc);
        oppolist.add(op);
    }
    }
    insert oppolist;
     }


thanks in advance.
When a is Account record is checked for Non Qualified checkbox to true the related Contacts for that  Account should also get  non -qualified check box as true.
Create field Non-Qualified on Account and Contact
how can i achieve its done on process builder or need to write trigger?
thanks in advance.
I have 2 user user 1 and user 2 when i create a account in user 1 and in user 2 i am open that account and create related opportunity then how to display the user 1 in opportunity record.
hello i want to help in flow like,
Add a tab related to Account and in that Tab there are 2 picklist Options - 1- Contact, 2- Opportunity
When clicked contact then open screen for creating contact and after inserted all required fields contacts have created.
and for opportunity --same like contact
hello can anybody help to find the solution of
Data types of trigger.new i m confuse.
How to display opportunity associated all products in trigger.
Here is my code:
trigger opportunityProductCount on Product2 (after insert, after update, after delete, after undelete) {
    set<Id> setIds = new set<Id>();
    list<Opportunity> opplist= new list<Opportunity>();
    if(trigger.isafter){
        if(trigger.isinsert|| trigger.isUpdate|| trigger.isUndelete){
            for(Product2 p: trigger.new){
                setIds.add(p.OpportunityId);
            }
        }
        if(trigger.isupdate|| trigger.isdelete){
            for(Product2 po:trigger.old){
                setIds.add(po.OpportunityId);
            }
        }
    }
    List<Opportunity> oplist = [Select Id,Name,Number_of_Product__c,(select id,name from Products2)from Opportunity where Id in:setIds];
    system.debug('show products'+ oplist);
    for (Opportunity opp: oplist){
        Integer count = opp.Products2.size();
        opp.Number_of_Product__c = count;
        opplist.add(opp);
        
    }
    update opplist;

}
Can anybody help to out of this que how to associated record and count display in oppoprtunity in trigger.I just started to learn development.
When a is Account record is checked for Non Qualified checkbox to true the related Contacts for that  Account should also get  non -qualified check box as true.
Create field Non-Qualified on Account and Contact
how can i achieve its done on process builder or need to write trigger?
thanks in advance.
Hii all,

can anyone help me out of this question?

10 digit Phone number format is (xxx) xxx-xxxx but i want less than 10 digit then also format should be work. If suppose my phone field have 9 digit 123456789 then i want this type of format like (123) 456-789
is it possible? it should be work between 7 number.
hii @all can you please help me out of this 

i have lead custom field which is "signup date" whenever lead signup date is not null then lead is automatically converted and created account, contact, and opportunity.
hello,

my requirement is when lead lastname is ? questionmark the display lastname is lead 001, lead002 like this so i write trigger but it will work only single record crerated then it will run perfect when i insert record in bulk like data loader then all record lastname had showed lead001, lead001 like that so i want lead001, lead002.

this is my code:
helper:
trigger LeadTriggerLastName on Lead (before insert, before update) {
    if(trigger.isbefore && trigger.isinsert ){
        system.debug('isinsert fired AutoNumberLead');
        AutoNumberLeadhandler.countNo(trigger.new, null);
    }
    else if(trigger.isbefore && trigger.isupdate){
        system.debug('isupdate fired AutoNumberLead');
        AutoNumberLeadhandler.countNoUpdate(trigger.new, trigger.oldmap);
    }
}


handler:
public class AutoNumberLeadhandler {
public static void countNo(List<Lead> newLead, Map<Id,lead> OldLead){
        for (Lead l : newLead) {
            if (l.LastName == '?' && OldLead == null) {
                system.debug('isinsert fired ');
                // Generate the auto-numbered last name
                String autoLastName = 'Lead' + String.valueOf([SELECT count() FROM Lead WHERE LastName LIKE '%Lead%']).leftPad(3, '0');
                l.LastName = autoLastName;
            }
        }
    }
    
    public static void countNoUpdate(List<Lead> newLead, Map<Id,lead> OldLead){
        for(lead le : newLead){
            if(le.lastname == '?' && OldLead.get(le.Id).lastname != le.lastName){
                system.debug('isupdate fired ' );
                String autoLastName = 'Lead' + String.valueOf([SELECT count() FROM Lead WHERE LastName LIKE '%Lead%']).leftPad(3, '0');
                le.LastName = autoLastName;
            }
        }
    }
}
hii everyone,

I write trigger for opportunity description field display on account description field, but my trigger working for only latest opportunity description i want all account related opportunity description showed in account description.

this is my code:
trigger UpdateAccountDescription on Opportunity (before insert, before update, after insert, after update) {
    List<Opportunity > oppList =new List<Opportunity >();
    Set<Id> setid = new  Set<Id>();
    
    if(trigger.isBefore){
        system.debug('trigger before event');
        oppList = trigger.new;
        
    }else if(trigger.isAfter){
        oppList=trigger.new;
        for(Opportunity opp:oppList){
            setid.add(opp.AccountId); 
        }
        
        system.debug('setid ' + setid);
        
        List<Account> accList = [Select Id, Name, Description From Account  Where Id=:setid];
        
        if(trigger.isInsert){                     
            
            for(Opportunity opp1:trigger.new){
                for(Account a1:accList){
                    a1.Description= opp1.Description+ ' ';
                    update a1;
                }   
            }
            
        }else if(trigger.isUpdate){
            for(Opportunity opp2:trigger.new){
                for(Account a2:accList){
                    a2.Description= opp2.Description+ ' ' ;
                    update a2;
                }   
            }
            }
        }
    }




Thanks in advance!
Hii @all

can anybody help me to out of this question,

when opportunity description field update then all opportunity description field shows in account description field using trigger.
hello,
There is a button on leads home page called "Send list email" where a user can select multiple leads and send emails to all of them using this button. My task is when i click on this button and emails are sent then I want to automatically change the status of leads from Open - Not Contacted to Working - Contacted.


can anyone help me out of this question?

thanks in advanced.
This is my trigger:
Whats wrong in this trigger please help me out of this problem.

code:
trigger oppOwnerTrigger on Opportunity (after insert) {
    set<id> setAccountId = new set<id>();
    list<Opportunity> oppolist = new list<Opportunity>();
    for(Opportunity opp: trigger.new){
        setAccountId.add(opp.AccountId); 
    }
list<Account> acclist=[select id, Name, (select id ,Owner.Name from opportunities) from account where Name != 'null'];
    for (Opportunity op:trigger.new){
    for(Account accc : acclist){
        op.Name = accc.Owner.Name;
        system.debug('Account' + accc);
        oppolist.add(op);
    }
    }
    insert oppolist;
     }


thanks in advance.
I have 2 user user 1 and user 2 when i create a account in user 1 and in user 2 i am open that account and create related opportunity then how to display the user 1 in opportunity record.
How to display opportunity associated all products in trigger.
Here is my code:
trigger opportunityProductCount on Product2 (after insert, after update, after delete, after undelete) {
    set<Id> setIds = new set<Id>();
    list<Opportunity> opplist= new list<Opportunity>();
    if(trigger.isafter){
        if(trigger.isinsert|| trigger.isUpdate|| trigger.isUndelete){
            for(Product2 p: trigger.new){
                setIds.add(p.OpportunityId);
            }
        }
        if(trigger.isupdate|| trigger.isdelete){
            for(Product2 po:trigger.old){
                setIds.add(po.OpportunityId);
            }
        }
    }
    List<Opportunity> oplist = [Select Id,Name,Number_of_Product__c,(select id,name from Products2)from Opportunity where Id in:setIds];
    system.debug('show products'+ oplist);
    for (Opportunity opp: oplist){
        Integer count = opp.Products2.size();
        opp.Number_of_Product__c = count;
        opplist.add(opp);
        
    }
    update opplist;

}
Can anybody help to out of this que how to associated record and count display in oppoprtunity in trigger.I just started to learn development.
Can anyone help me out inwriting wrapper class to fetch fields from different objects to show it on Lighning web component.

For an account I want to fetch fields from Contact, Case,Opportunity objects so that thosevales will be shown on LWC.

Can anyone help me out in this.