• selvakumar Anbazhagan
  • NEWBIE
  • 30 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 6
    Replies
Hi Everyone,

I need the functionality that Pricebook should be automatically assign when a opportunity created(Account Should be mantatory). Account is being created based on the Zipcode. We have a field in Zipcode table as "Pricebook Name"(This is reffered from Pricebook table) .

For example, I have data from Zipcode table Zip=12345 and Pricebook_Name="US Pricebook"(It will be reffered from Pricebook table).
Account have created for the Zip '12345'. Now when i create a new opportunity to this account it should be assign "US Pricebook" automatically. How i can acheive this ? Is it a trigger or Validation rules or Lookup formula.?

Any help on this.

Thanks in advance.

 
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 am working on opportunity custom formula field that need to flag the Older opportunities. My filter criteria is given below.

-    Opportunity is owned by Inbound Sales
-    Opportunity is SMB 
-    Opportunity Age is 60 days or older
-    Opportunity is in an open status (not Closed Won or Closed Lost)
-    Contract hasn’t been signed
-    Override hasn’t been triggered by management

I used the following formula : 

OR( 
AND( 
Cleanup_Category__c = 1, 
Owner.Profile.Name = "Inbound Sales", 
Opportunity_Age__c > 60, 
Probability < 0.91, 
Probability > 0.01, 
Inactive_Override__c = FALSE 
)

Def:


Cleanup_Category__c = 1 - Refers SMB
Inactive_Override__c = FALSE - This is revert back for the management changes.

But this doesn't flag all the possible old opportunities. I might stucked up some logic in my formula. I suspect it can be either "OR/AND" condition or else Probability (Since Closed Won (100%) and Closed Lost (0%)). Is any other way to acheive this. Any help on this will be great.

Thanks in advance.
Hi All,

I need to create a new custom Text formula  for "createdDate". When i converting my date has been changed to GMT timezone. But actually my region belongs to EST US Timezone. SO it converting it 4Hrs behind of actual time. How i can sort out this thing. Any help on this.

My formula is given below.

TEXT(DATEVALUE(CreatedDate))

I have even tried as TEXT(DATEVALUE(CreatedDate + ( 4 * 0.04167))) . But it doesn't work.


Thanks in advance.
Hi Everyone,

I have a trigger that have the following functionality.

If a  specific recordtype ("Bulk Record Type" ) opportunity is created,then it should select “k) Bulk  PriceBook".

After Save,If i change Bulk to some other record type,then  it should be changed to particular pricebook(Non Bulk Pricebook) .
As well as if other Recordtype to Bulk Record type it should change to "Bulk Pricebook" .
So i have created trigger regarding this requirement.

It is working for that,
1)  Bulk Record Type Choosen --> Bulk Pricebook Assigned
2) Other Record Type to Bulk Change -->Bulk Pricebook Assigned

My only issue with this is,
If i Change Bulk Record type to Other Record Type Pricebook doesn't change.It remains in same Bulk Pricebook.

Is it cases related to where use insert,update in a if else statements? I have tried to debugging. I couldn't make a way.

Please any one help me in my coding to find out.

My trigger is given below.

trigger BulkPricebookOpp on Opportunity (before insert,before update)
{
          if(trigger.isInsert || trigger.isUpdate) {
                 List<Pricebook2> prcbooklists = [select id,name from pricebook2];
                 Map<String,Id> prcbookMaps = new Map<String,Id>();
                 List<RecordType> recordtypId =  [Select Id,Name From RecordType Where SobjectType = 'Opportunity'];
                 Map<Id,String> recMap = new Map<Id,String>();
                  Set<Opportunity> OppItrortunityUpdatesIds = new Set<Opportunity>();
                                               
                if(!prcbooklists.isEmpty()){
                    for(Pricebook2 prcIter : prcbooklists){
                        prcbookMaps.put(prcIter.name,prcIter.id);
                    }
                }
                System.debug('==prcmap'+prcbookMaps);
                
                              
                  for(RecordType rectyp : recordtypId){
                        recMap.put(rectyp.Id,rectyp.name);
                    }       
                 
                            
                for(Opportunity OppItrs : Trigger.new){
                    if(prcbookMaps.size() > 0) {    
                            
                        if (recMap.get(OppItrs.RecordTypeId) == 'k) Bulk Services'){
                            OppItrs.Pricebook2Id = prcbookMaps.get('Bulk Price Book');
                        }
                    }    
        
        else if(Trigger.isAfter)
        {
        if(Trigger.isUpdate)
        {
                List<Pricebook2> prcbooklist = [select id,name from pricebook2];
                 Map<String,Id> prcbookMap = new Map<String,Id>();
                 Map<Id,String> Accmap = new Map<Id,String>();
                 Set<Opportunity> OppItrortunityUpdateIds = new Set<Opportunity>();
                 Set<Id> accountIds = new Set<Id>();
                              
                if(!prcbooklist.isEmpty()){
                    for(Pricebook2 prcIter : prcbooklist){
                        prcbookMap.put(prcIter.name,prcIter.id);
                    }
                }
                System.debug('==prcmap'+prcbookMap);
                
                for(Opportunity OppIdsItr : Trigger.new){
                    accountIds.add(OppIdsItr.accountid);
                    
                }
                for(Account AccItr : [SELECT id,Region__c FROM Account WHERE Id IN:accountIds]){
                    Accmap.put(AccItr.id,AccItr.Region__c);
                }
            
                for(Opportunity OppItr : Trigger.new){
                    if(prcbookMap.size() > 0){    
                            
                        if (Accmap.get(OppItr.accountId) == 'Service 3'){
                            OppItr.Pricebook2Id = prcbookMap.get('Non Bulk Price Book - 3');
                        }
                        else if(Accmap.get(OppItr.accountId) == ' Service 2'){
                            OppItr.Pricebook2Id = prcbookMap.get('Non Bulk Price Book - 2');
                       }
                     }
                 }
             }
        }
    }
  }
}


Thanks in advance.

Regards,
Selva

 
Hi ,

I need test class for this trigger . Please help me on this.

trigger BulkPricebookOpp on Opportunity (before insert,before update)
{   
    Id pbID = null;
    Id recordtypId = null;   
    pbID = [Select Name, Description From Pricebook2 where Name =: 'Bulk Price Book'].Id;
    recordtypId =  [Select SobjectType, Name, Id, DeveloperName From RecordType  Where SobjectType = 'Opportunity' And  Name = 'k) Bulk Services'].Id;   
   for(Opportunity obj : trigger.new)
   {
        if(obj.RecordTypeId  == recordtypId)
        {
            obj.Pricebook2Id = pbID;
        }
        else
        {
        if(Trigger.isUpdate){
                List<Pricebook2> prcbooklist = [select id,name from pricebook2];
                 Map<String,Id> prcbookMap = new Map<String,Id>();
                 Map<Id,String> cccAccmap = new Map<Id,String>();
                 Set<Opportunity> OppItrortunityUpdateIds = new Set<Opportunity>();
                 Set<Id> accountIds = new Set<Id>();                             
                if(!prcbooklist.isEmpty()){
                    for(Pricebook2 prcIter : prcbooklist){
                        prcbookMap.put(prcIter.name,prcIter.id);
                    }
                }
                System.debug('==prcmap'+prcbookMap);               
                for(Opportunity OppIdsItr : Trigger.new){
                    accountIds.add(OppIdsItr.accountid);
                    
                }
                for(Account AccItr : [SELECT id,Region__c FROM Account WHERE Id IN:accountIds]){
                    cccAccmap.put(AccItr.id,AccItr.Region__c);
                }           
                for(Opportunity OppItr : Trigger.new){
                    if(prcbookMap.size() > 0){    
                            
                        if (cccAccmap.get(OppItr.accountId) == 'P1'){
                            OppItr.Pricebook2Id = prcbookMap.get('Price Book - 1');
                        }
                        else if(cccAccmap.get(OppItr.accountId) == 'P2'){
                            OppItr.Pricebook2Id = prcbookMap.get('Price Book - 2');
                       }
                                            
                      }
                      System.debug('====assign'+OppItr.Pricebook2Id);
                }
            }
        }
   }
}
 
Hi Everyone,

I need test calss coding for the trigger involved lead object. Can anyone please write me test class coding.

My trigger is given below.

trigger ReferralPartner_Lead on Lead (before Insert,before update) {   
    Set<String> referrerNames=new Set<String>();   
    for (Lead ld : trigger.new)
    {
        referrerNames.add(ld.Referral_Text__c);
    }
     System.debug('+++referaltext'+referrerNames);
    Map<String, Referral_Partner__c> refPtrsByName=new Map<String, Referral_Partner__c>();
    for (Referral_Partner__c refPtr : [select id, Name from Referral_Partner__c where name in :referrerNames])
    {
        refPtrsByName.put(refPtr.Name, refPtr);
    }
     System.debug('+++===referalName'+refPtrsByName);   
    for (Lead ld : trigger.new)
    {
        Referral_Partner__c refPtr=refPtrsByName.get(ld.Referral_Text__c);
        if (null!=refPtr)
        {
            ld.Referral_Partner__c=refPtr.id;
        }
       System.debug('+++++++++referalPart'+ld.Referral_Partner__c);
    }
}


Please help me on this.

Thanks in advance.

 
Hi everyone,

Can anyone please help to me create a trigger for the following condition.

I have a Pricebook called  "Bulk Price Book". I need to assign this pricebook for the opportunity only when a particular Opportunity Record Type (Bulk Services) is choosen. I need the coding . Since i don't have much knowledge about triggers and coding.

PriceBook  -  Id,Name('Bulk Price Book')
Opportunity - RecordTypeId,PricebookId

It will be very useful to me in future to buildup my own.

Thanks in advance.


Thanks,
Selva
Hi All,

I am working on opportunity custom formula field that need to flag the Older opportunities. My filter criteria is given below.

-    Opportunity is owned by Inbound Sales
-    Opportunity is SMB 
-    Opportunity Age is 60 days or older
-    Opportunity is in an open status (not Closed Won or Closed Lost)
-    Contract hasn’t been signed
-    Override hasn’t been triggered by management

I used the following formula : 

OR( 
AND( 
Cleanup_Category__c = 1, 
Owner.Profile.Name = "Inbound Sales", 
Opportunity_Age__c > 60, 
Probability < 0.91, 
Probability > 0.01, 
Inactive_Override__c = FALSE 
)

Def:


Cleanup_Category__c = 1 - Refers SMB
Inactive_Override__c = FALSE - This is revert back for the management changes.

But this doesn't flag all the possible old opportunities. I might stucked up some logic in my formula. I suspect it can be either "OR/AND" condition or else Probability (Since Closed Won (100%) and Closed Lost (0%)). Is any other way to acheive this. Any help on this will be great.

Thanks in advance.
Hi Everyone,

I need test calss coding for the trigger involved lead object. Can anyone please write me test class coding.

My trigger is given below.

trigger ReferralPartner_Lead on Lead (before Insert,before update) {   
    Set<String> referrerNames=new Set<String>();   
    for (Lead ld : trigger.new)
    {
        referrerNames.add(ld.Referral_Text__c);
    }
     System.debug('+++referaltext'+referrerNames);
    Map<String, Referral_Partner__c> refPtrsByName=new Map<String, Referral_Partner__c>();
    for (Referral_Partner__c refPtr : [select id, Name from Referral_Partner__c where name in :referrerNames])
    {
        refPtrsByName.put(refPtr.Name, refPtr);
    }
     System.debug('+++===referalName'+refPtrsByName);   
    for (Lead ld : trigger.new)
    {
        Referral_Partner__c refPtr=refPtrsByName.get(ld.Referral_Text__c);
        if (null!=refPtr)
        {
            ld.Referral_Partner__c=refPtr.id;
        }
       System.debug('+++++++++referalPart'+ld.Referral_Partner__c);
    }
}


Please help me on this.

Thanks in advance.

 
Hi everyone,

Can anyone please help to me create a trigger for the following condition.

I have a Pricebook called  "Bulk Price Book". I need to assign this pricebook for the opportunity only when a particular Opportunity Record Type (Bulk Services) is choosen. I need the coding . Since i don't have much knowledge about triggers and coding.

PriceBook  -  Id,Name('Bulk Price Book')
Opportunity - RecordTypeId,PricebookId

It will be very useful to me in future to buildup my own.

Thanks in advance.


Thanks,
Selva