• Selvakumar Anbazhagan 7
  • NEWBIE
  • 20 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 12
    Replies
Hi,

I have tried to deploy a trigger which based on assign pricebook to the opportunity. When i deploying it throws "code coverage error" as follows.

Code Coverage Failure
The following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.
CarrierChannelPB


Last time when i deployed a same type of trigger i don't get any issues. I have even tried various test class modules and got failed.
For the reference, I have given below my trigger and Testclass for that. 

Any help on this. Code coverage should change in trigger or test class? Anything need to change in my coding ?

Apex Trigger :

trigger CarrierPB on Opportunity (Before insert, Before update) {
if(Trigger.isBefore && (Trigger.isInsert || Trigger.isUpdate))
            {
                 List<Pricebook2> prcbooklist = [select id,name from pricebook2];
                 Map<String,Id> prcbookMap = new Map<String,Id>();
                 Map<Id,String> abbAccmap = new Map<Id,String>();
                 List<RecordType> recordtypId =  [Select Id,Name From RecordType Where SobjectType = 'Opportunity'];
                 Map<Id,String> recMap = new Map<Id,String>();
                 Set<Opportunity> OppItrortunityUpdateIds = new Set<Opportunity>();
                 Set<Id> accountIds = new Set<Id>();
                 Set<Id> RectypIds = new Set<Id>();
                              
                if(!prcbooklist.isEmpty())
                {
                    for(Pricebook2 prcIter : prcbooklist)
                    {
                        prcbookMap.put(prcIter.name,prcIter.id);
                    }
                }
                System.debug('==prcmap'+prcbookMap);
                
                for(RecordType rectyp : recordtypId)
                {
                    recMap.put(rectyp.Id,rectyp.name);
                }
                
                for(Opportunity OppIdsItr : Trigger.new)
                {
                    accountIds.add(OppIdsItr.accountid);
                    
                }
                for(Account AccItr : [SELECT id,Region__C FROM Account WHERE Id IN:accountIds])
                {
                    abbAccmap.put(AccItr.id,AccItr.Region__C);
                }
            
                for(Opportunity OppItr : Trigger.new)
                {
                    if(prcbookMap.size() > 0)
                    { 
                         
                        if (recMap.get(OppItr.RecordTypeId) == 'p)Carrier-South')
                        {
                            OppItr.Pricebook2Id = prcbookMap.get('SouthPB');
                        }
                        else if(Trigger.isUpdate)
                        {
                          if(OppItr.RecordTypeId!=Trigger.oldMap.get(OppItr.Id).RecordTypeId)
                            {
                            if(recMap.get(OppItr.RecordTypeId) == 'p)Carrier-South')
                            OppItr.Pricebook2Id = prcbookMap.get('SouthPB');
                            else if(abbAccmap.get(OppItr.accountId) == 'North - D3')
                            {
                             OppItr.Pricebook2Id = prcbookMap.get('NorthPB');
                            }
                            System.debug('====assign'+OppItr.Pricebook2Id);
                
                        }
              }
              }

            }
}



Apex Test Class : 

@isTest (SeeAllData = true)
public class TestNewcarrier {
    Public static testmethod void validatepric(){
  
  Zip_Code__c zipRec = new Zip_Code__c(name = '12345',Opp_System__c = 'South', PriceBook_Name__c = 'SouthPB',
                                              Service_Type__c = 'D3',City__c = 'Taren',State__c = 'MA',System__c = 'South');
        insert zipRec;
    
    Id pbID = null;

    pbID = [Select Name, Description From Pricebook2 where Name = 'Carrier-South'].Id;
    List<RecordType> recordtypId =  [Select SobjectType, Name, Id, DeveloperName From RecordType  Where SobjectType = 'Opportunity' And  Name = 'p)Carrier-South'];
    Account acc = new Account(name='TestAcc',BillingPostalCode= zipRec.Name);
        insert acc;
    
    Pricebook2  standardPb = [SELECT id, name, isActive FROM Pricebook2 WHERE IsStandard = true LIMIT 1];
        
        Pricebook2 customPb;
        List<Pricebook2> customPbList = [SELECT id, name, isActive FROM Pricebook2 WHERE Name = 'SouthPB' LIMIT 1];
        if(customPbList.isEmpty()) {
            customPb = new Pricebook2 (Name='SouthPB', Description='Test Pricebook Entry 1', isActive=true);
            insert customPb;
        }else {
            customPb = customPbList[0];
        }

Opportunity objOpp = new Opportunity(Name = 'newTest',recordtypeId=recordtypId[0].Id,AccountId = acc.Id,StageName ='Prospecting',CloseDate=Date.today());
        objOpp.Pricebook2Id=pbID;       
insert objOpp;

Opportunity objUOppt = new opportunity(Id =objOpp.Id );
update objUOppt ;

}
}



Thanks in advance.

Thanks,
Selva
Hi,

I have created a Trigger and trying to deploy to production. But am getting Deployment error because of Test Coverage as follows:

Code Coverage Failure
The following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.
CarrierChannelPB


My Trigger and Test classes is given below. How i can resolve this?

Trigger :

/* Assign CarrierChanne Pricebook whenever CarrierChanne recordtype chosen */
trigger CarrierChannelPB on Opportunity (Before insert, Before update) {
if(Trigger.isBefore && (Trigger.isInsert || Trigger.isUpdate))
            {
                 List<Pricebook2> prcbooklist = [select id,name from pricebook2];
                 Map<String,Id> prcbookMap = new Map<String,Id>();
                 Map<Id,String> abbAccmap = new Map<Id,String>();
                 List<RecordType> recordtypId =  [Select Id,Name From RecordType Where SobjectType = 'Opportunity'];
                 Map<Id,String> recMap = new Map<Id,String>();
                 Set<Opportunity> OppItrortunityUpdateIds = new Set<Opportunity>();
                 Set<Id> accountIds = new Set<Id>();
                 Set<Id> RectypIds = new Set<Id>();
                              
                if(!prcbooklist.isEmpty())
                {
                    for(Pricebook2 prcIter : prcbooklist)
                    {
                        prcbookMap.put(prcIter.name,prcIter.id);
                    }
                }
                System.debug('==prcmap'+prcbookMap);
                
                for(RecordType rectyp : recordtypId)
                {
                    recMap.put(rectyp.Id,rectyp.name);
                }
                
                for(Opportunity OppIdsItr : Trigger.new)
                {
                    accountIds.add(OppIdsItr.accountid);
                    
                }
                for(Account AccItr : [SELECT id,ABB_Region__c FROM Account WHERE Id IN:accountIds])
                {
                    abbAccmap.put(AccItr.id,AccItr.ABB_Region__c);
                }
            
                for(Opportunity OppItr : Trigger.new)
                {
                    if(prcbookMap.size() > 0)
                    { 
                         
                        if (recMap.get(OppItr.RecordTypeId) == 'p) Carrier')
                        {
                            OppItr.Pricebook2Id = prcbookMap.get('Carrier');
                        }
                        else if(Trigger.isUpdate)
                        {
                          if(OppItr.RecordTypeId!=Trigger.oldMap.get(OppItr.Id).RecordTypeId)
                            {
                            if(recMap.get(OppItr.RecordTypeId) == 'p) Carrier')
                            OppItr.Pricebook2Id = prcbookMap.get('Carrier');
                            else if(abbAccmap.get(OppItr.accountId) == 'a)Support')
                            {
                             OppItr.Pricebook2Id = prcbookMap.get('support');
                            }
                            else if(abbAccmap.get(OppItr.accountId) == 'b) Standalone')
                               
                           }
                           
                      
                          } 
                      System.debug('====assign'+OppItr.Pricebook2Id);
                
                        }
              }
              }

            }
}



Test Class:

@isTest (SeeAllData = true)
public class TestcarrierPricebookOpp {
    Public static testmethod void validatepric(){
    Id pbID = null;

    pbID = [Select Name, Description From Pricebook2 where Name = 'Carrier'].Id;
    List<RecordType> recordtypId =  [Select SobjectType, Name, Id, DeveloperName From RecordType  Where SobjectType = 'Opportunity' And  Name = 'p) Carrier'];
Account obj = new Account( Name = 'Test123', BillingPostalCode='78945');
insert obj;

Opportunity objOpp = new Opportunity(Name = 'newTest',recordtypeId=recordtypId[0].Id,AccountId = obj.Id,StageName ='Prospecting',CloseDate=Date.today());
        objOpp.Pricebook2Id=pbID;       
insert objOpp;

Opportunity objUOppt = new opportunity(Id =objOpp.Id );
update objUOppt ;

}
}




Any help on this?


Thanks,
Selva
 
Hi,

I have created a process builder which assign pricebook based on Zipcode. In "Zipcode" object having pricebookname assigned to each zipcode. I have inherited this field to Accounts. Using Account's i have cretaed process builder and it  is working fine.

But here my concern is that, Some cases when am using different Recordtype, i should assign particular recordtype's pricebook rather than actual.

I have also tried to build a seperate processflow. But it shows error as "The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID .."

How i can resolve it. I have attached my process flow for the reference.
1.Zipcode's Processflow
2.Zipcode's Processflow
User-added imageUser-added imageUser-added imageUser-added image

How can resolve this. Any help on this.


Thanks,
Selva
Hi Everyone,
 
I would like to get any idea or help for my new task.

I have a requirement that Pricebook should get select based on the zipcode to the account. Is it way to approach through trigger or any functionality available in SF?

I have a field "Pricebookname" in “Zipcode” object. But this is not related to Pricebook object. Can We have make lookup relationship with Zipcode object? Through that how i can assign pricebook to the zipcode.
For ex, Zipcode 00001,00005,00025,00123 having pricebook name as Region-D and Zipcode 00002,04583,07894 having Region-C then these accounts should choose correct pricebook for their zipcodes.

As a part, in some cases i also need to choose some other pricebook rather than to particular pricebook. 

For example, Zipcode 12345 actual pricebook is Region-A but it should choose Region-Others.
 
 
It could be done through any functionality or Trigger? 
 
 
Thanks in advance.
 
Hi Everyone,

I have developed few reports in salesforce. But Report builder have so many limitations.Basically I need to design a tailored report to meet my requirement.

I would like to customize a report in a various ways. Few of them given below.

1.Last 8 week historical data snapshot in a same table.

2.By placing column and rows in a particular order.

3.Need to apply various filters.

4.% of calculation by compare two different tables(Different Reports)

So far,Am exporting data from SF using data loader and Preparing report in Excel Pivot Tables. But i need all these to done within salesforce.

How can I do this? Can I do it with Apex and VF? 

Thanks!
Hi All,

I tried making a few modifications to the OWD’s, Profiles settings, and Role settings, but didn’t have any luck with the expected outcome.  Please review the info given below – perhaps you can make better sense of it than I’ve been able to. 

We are attempting to set up user groups in SalesForce to control permissions with certain profiles.

Our “Internal” group contains users within an “Account Executive” profile.

For these users, we’d like them to be able to have the following permissions:
- Read/write access to their own Accounts
- Read/write access to their own Opportunities
- Read/write access to Accounts owned by other members of the “Internal” group
- Read only access to Opportunities owned by other members of the “Internal” group
- No access to Accounts or Opportunities owned by members in the “External” group


With these permissions set up in the group configuration, they appear to work as long as the specific user does not have a “Role” assigned to them. When a role is assigned to a specific user, the permissions allow this user to have read/write access to Opportunities within their group that they do not own.

I think our major hurdle is the combination of security settings in the OWD, Profile, Role, and Public Group settings. This combination is difficult to tweak to get the exact desired effect. Any suggestions on this?

Thanks in advance.
Hi All,

I have created a validation rule in Opportunity that some profile users doesn't edit opportunity which he not owns. Meanwhile, some users should still be allowed to make changes to any Opportunity, even if they don’t own it (e.g. System Administrator, Sales Directors).  However, the way this validation code is currently written, it restricts ALL users who aren’t the owner.  

My validation rule is given below.
AND( 
OR( 
Owner.Profile.Name = "Account Executive", 
Owner.Profile.Name = "Inbound Sales", 
Owner.Profile.Name = "Outbound Sales", 
Owner.Profile.Name = "Commercial Bulk Executive" 
), 
Owner.Id <> $User.Id 
)


Can anyone suggest me how to acheive it?

Thanks in advance.
Hi Everyone,

I need to convert opportunity formula into SOQL Query. Can anyone help me on this.

My Opportunity formula is,

AND(
  AND(
       ISBLANK(Last_Stage_Change__c),
       NOW() - LastModifiedDate > 30,
       Probability < 0.91,
       Probability > 0.01
      ),
   AND(
       NOW() - Last_Stage_Change__c  > 30,
       Probability < 0.91,
       Probability > 0.01
      )
  )

My query is that,


select Id,StageName,LastModifiedDate from Opportunity Where "Formula Condition"

Thanks in advance.
 
Hi Everyone,

I have a opportunity formula. I need to convert it into a SOQL Query.When i have tried it it throws me parsing error. 
Can anyone help me on this.

My Opportunity formula is :

AND(
  AND(
       ISBLANK(Last_Stage_Change__c),
       NOW() - LastModifiedDate > 30,
       Probability < 0.91,
       Probability > 0.01
      ),
   AND(
       NOW() - Last_Stage_Change__c  > 30,
       Probability < 0.91,
       Probability > 0.01
      )
  )

I have tried this Query as 


select Id,Name,StageName,LastModifiedDate,Last_Stage_Change__c from Opportunity where 
where Last_Stage_Change__c == null and TimeSinceLastModified__c > 30 and TimeSinceLastStageChange__c > 30 and Probability < 91 and Probability > 1

Please any one assist me on this.

Thanks in advane.
Hi,

I have tried to deploy a trigger which based on assign pricebook to the opportunity. When i deploying it throws "code coverage error" as follows.

Code Coverage Failure
The following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.
CarrierChannelPB


Last time when i deployed a same type of trigger i don't get any issues. I have even tried various test class modules and got failed.
For the reference, I have given below my trigger and Testclass for that. 

Any help on this. Code coverage should change in trigger or test class? Anything need to change in my coding ?

Apex Trigger :

trigger CarrierPB on Opportunity (Before insert, Before update) {
if(Trigger.isBefore && (Trigger.isInsert || Trigger.isUpdate))
            {
                 List<Pricebook2> prcbooklist = [select id,name from pricebook2];
                 Map<String,Id> prcbookMap = new Map<String,Id>();
                 Map<Id,String> abbAccmap = new Map<Id,String>();
                 List<RecordType> recordtypId =  [Select Id,Name From RecordType Where SobjectType = 'Opportunity'];
                 Map<Id,String> recMap = new Map<Id,String>();
                 Set<Opportunity> OppItrortunityUpdateIds = new Set<Opportunity>();
                 Set<Id> accountIds = new Set<Id>();
                 Set<Id> RectypIds = new Set<Id>();
                              
                if(!prcbooklist.isEmpty())
                {
                    for(Pricebook2 prcIter : prcbooklist)
                    {
                        prcbookMap.put(prcIter.name,prcIter.id);
                    }
                }
                System.debug('==prcmap'+prcbookMap);
                
                for(RecordType rectyp : recordtypId)
                {
                    recMap.put(rectyp.Id,rectyp.name);
                }
                
                for(Opportunity OppIdsItr : Trigger.new)
                {
                    accountIds.add(OppIdsItr.accountid);
                    
                }
                for(Account AccItr : [SELECT id,Region__C FROM Account WHERE Id IN:accountIds])
                {
                    abbAccmap.put(AccItr.id,AccItr.Region__C);
                }
            
                for(Opportunity OppItr : Trigger.new)
                {
                    if(prcbookMap.size() > 0)
                    { 
                         
                        if (recMap.get(OppItr.RecordTypeId) == 'p)Carrier-South')
                        {
                            OppItr.Pricebook2Id = prcbookMap.get('SouthPB');
                        }
                        else if(Trigger.isUpdate)
                        {
                          if(OppItr.RecordTypeId!=Trigger.oldMap.get(OppItr.Id).RecordTypeId)
                            {
                            if(recMap.get(OppItr.RecordTypeId) == 'p)Carrier-South')
                            OppItr.Pricebook2Id = prcbookMap.get('SouthPB');
                            else if(abbAccmap.get(OppItr.accountId) == 'North - D3')
                            {
                             OppItr.Pricebook2Id = prcbookMap.get('NorthPB');
                            }
                            System.debug('====assign'+OppItr.Pricebook2Id);
                
                        }
              }
              }

            }
}



Apex Test Class : 

@isTest (SeeAllData = true)
public class TestNewcarrier {
    Public static testmethod void validatepric(){
  
  Zip_Code__c zipRec = new Zip_Code__c(name = '12345',Opp_System__c = 'South', PriceBook_Name__c = 'SouthPB',
                                              Service_Type__c = 'D3',City__c = 'Taren',State__c = 'MA',System__c = 'South');
        insert zipRec;
    
    Id pbID = null;

    pbID = [Select Name, Description From Pricebook2 where Name = 'Carrier-South'].Id;
    List<RecordType> recordtypId =  [Select SobjectType, Name, Id, DeveloperName From RecordType  Where SobjectType = 'Opportunity' And  Name = 'p)Carrier-South'];
    Account acc = new Account(name='TestAcc',BillingPostalCode= zipRec.Name);
        insert acc;
    
    Pricebook2  standardPb = [SELECT id, name, isActive FROM Pricebook2 WHERE IsStandard = true LIMIT 1];
        
        Pricebook2 customPb;
        List<Pricebook2> customPbList = [SELECT id, name, isActive FROM Pricebook2 WHERE Name = 'SouthPB' LIMIT 1];
        if(customPbList.isEmpty()) {
            customPb = new Pricebook2 (Name='SouthPB', Description='Test Pricebook Entry 1', isActive=true);
            insert customPb;
        }else {
            customPb = customPbList[0];
        }

Opportunity objOpp = new Opportunity(Name = 'newTest',recordtypeId=recordtypId[0].Id,AccountId = acc.Id,StageName ='Prospecting',CloseDate=Date.today());
        objOpp.Pricebook2Id=pbID;       
insert objOpp;

Opportunity objUOppt = new opportunity(Id =objOpp.Id );
update objUOppt ;

}
}



Thanks in advance.

Thanks,
Selva
Hi,

I have created a Trigger and trying to deploy to production. But am getting Deployment error because of Test Coverage as follows:

Code Coverage Failure
The following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.
CarrierChannelPB


My Trigger and Test classes is given below. How i can resolve this?

Trigger :

/* Assign CarrierChanne Pricebook whenever CarrierChanne recordtype chosen */
trigger CarrierChannelPB on Opportunity (Before insert, Before update) {
if(Trigger.isBefore && (Trigger.isInsert || Trigger.isUpdate))
            {
                 List<Pricebook2> prcbooklist = [select id,name from pricebook2];
                 Map<String,Id> prcbookMap = new Map<String,Id>();
                 Map<Id,String> abbAccmap = new Map<Id,String>();
                 List<RecordType> recordtypId =  [Select Id,Name From RecordType Where SobjectType = 'Opportunity'];
                 Map<Id,String> recMap = new Map<Id,String>();
                 Set<Opportunity> OppItrortunityUpdateIds = new Set<Opportunity>();
                 Set<Id> accountIds = new Set<Id>();
                 Set<Id> RectypIds = new Set<Id>();
                              
                if(!prcbooklist.isEmpty())
                {
                    for(Pricebook2 prcIter : prcbooklist)
                    {
                        prcbookMap.put(prcIter.name,prcIter.id);
                    }
                }
                System.debug('==prcmap'+prcbookMap);
                
                for(RecordType rectyp : recordtypId)
                {
                    recMap.put(rectyp.Id,rectyp.name);
                }
                
                for(Opportunity OppIdsItr : Trigger.new)
                {
                    accountIds.add(OppIdsItr.accountid);
                    
                }
                for(Account AccItr : [SELECT id,ABB_Region__c FROM Account WHERE Id IN:accountIds])
                {
                    abbAccmap.put(AccItr.id,AccItr.ABB_Region__c);
                }
            
                for(Opportunity OppItr : Trigger.new)
                {
                    if(prcbookMap.size() > 0)
                    { 
                         
                        if (recMap.get(OppItr.RecordTypeId) == 'p) Carrier')
                        {
                            OppItr.Pricebook2Id = prcbookMap.get('Carrier');
                        }
                        else if(Trigger.isUpdate)
                        {
                          if(OppItr.RecordTypeId!=Trigger.oldMap.get(OppItr.Id).RecordTypeId)
                            {
                            if(recMap.get(OppItr.RecordTypeId) == 'p) Carrier')
                            OppItr.Pricebook2Id = prcbookMap.get('Carrier');
                            else if(abbAccmap.get(OppItr.accountId) == 'a)Support')
                            {
                             OppItr.Pricebook2Id = prcbookMap.get('support');
                            }
                            else if(abbAccmap.get(OppItr.accountId) == 'b) Standalone')
                               
                           }
                           
                      
                          } 
                      System.debug('====assign'+OppItr.Pricebook2Id);
                
                        }
              }
              }

            }
}



Test Class:

@isTest (SeeAllData = true)
public class TestcarrierPricebookOpp {
    Public static testmethod void validatepric(){
    Id pbID = null;

    pbID = [Select Name, Description From Pricebook2 where Name = 'Carrier'].Id;
    List<RecordType> recordtypId =  [Select SobjectType, Name, Id, DeveloperName From RecordType  Where SobjectType = 'Opportunity' And  Name = 'p) Carrier'];
Account obj = new Account( Name = 'Test123', BillingPostalCode='78945');
insert obj;

Opportunity objOpp = new Opportunity(Name = 'newTest',recordtypeId=recordtypId[0].Id,AccountId = obj.Id,StageName ='Prospecting',CloseDate=Date.today());
        objOpp.Pricebook2Id=pbID;       
insert objOpp;

Opportunity objUOppt = new opportunity(Id =objOpp.Id );
update objUOppt ;

}
}




Any help on this?


Thanks,
Selva
 
Hi,

I have created a process builder which assign pricebook based on Zipcode. In "Zipcode" object having pricebookname assigned to each zipcode. I have inherited this field to Accounts. Using Account's i have cretaed process builder and it  is working fine.

But here my concern is that, Some cases when am using different Recordtype, i should assign particular recordtype's pricebook rather than actual.

I have also tried to build a seperate processflow. But it shows error as "The record couldn’t be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID .."

How i can resolve it. I have attached my process flow for the reference.
1.Zipcode's Processflow
2.Zipcode's Processflow
User-added imageUser-added imageUser-added imageUser-added image

How can resolve this. Any help on this.


Thanks,
Selva
Hi Everyone,
 
I would like to get any idea or help for my new task.

I have a requirement that Pricebook should get select based on the zipcode to the account. Is it way to approach through trigger or any functionality available in SF?

I have a field "Pricebookname" in “Zipcode” object. But this is not related to Pricebook object. Can We have make lookup relationship with Zipcode object? Through that how i can assign pricebook to the zipcode.
For ex, Zipcode 00001,00005,00025,00123 having pricebook name as Region-D and Zipcode 00002,04583,07894 having Region-C then these accounts should choose correct pricebook for their zipcodes.

As a part, in some cases i also need to choose some other pricebook rather than to particular pricebook. 

For example, Zipcode 12345 actual pricebook is Region-A but it should choose Region-Others.
 
 
It could be done through any functionality or Trigger? 
 
 
Thanks in advance.
 
Hi Everyone,

I have developed few reports in salesforce. But Report builder have so many limitations.Basically I need to design a tailored report to meet my requirement.

I would like to customize a report in a various ways. Few of them given below.

1.Last 8 week historical data snapshot in a same table.

2.By placing column and rows in a particular order.

3.Need to apply various filters.

4.% of calculation by compare two different tables(Different Reports)

So far,Am exporting data from SF using data loader and Preparing report in Excel Pivot Tables. But i need all these to done within salesforce.

How can I do this? Can I do it with Apex and VF? 

Thanks!
Hi All,

I have created a validation rule in Opportunity that some profile users doesn't edit opportunity which he not owns. Meanwhile, some users should still be allowed to make changes to any Opportunity, even if they don’t own it (e.g. System Administrator, Sales Directors).  However, the way this validation code is currently written, it restricts ALL users who aren’t the owner.  

My validation rule is given below.
AND( 
OR( 
Owner.Profile.Name = "Account Executive", 
Owner.Profile.Name = "Inbound Sales", 
Owner.Profile.Name = "Outbound Sales", 
Owner.Profile.Name = "Commercial Bulk Executive" 
), 
Owner.Id <> $User.Id 
)


Can anyone suggest me how to acheive it?

Thanks in advance.