• juhi dhiver
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 2
    Questions
  • 2
    Replies
So my Opportunity are private and there is secondary owner field(lookup user) in Account. I want that my secondary owner can also view that particular Accounts  opportunities.

trigger Accountshare on Account (After insert, after update) {


List<AccountShare> sharesToCreate = new List<AccountShare>();
User us = new User();

    if (Trigger.isInsert) {
        set<ID> accwnerBranch=new set<Id>();
        For(Account acc:[SELECT Id,Owner.Branch__c FROM Account WHERE ID IN:Trigger.New]){
            accwnerBranch.add(acc.Owner.Branch__c);
            system.debug('The Branch owner Value is'+accwnerBranch);
        }
     
        for (Account ac : Trigger.new) {
            system.debug('The Owner Branch is'+ac.Owner.Branch__c);
                    IF(ac.Owner.Branch__c =='HYDERABAD'){ 
                        system.debug('The Owner Branch is'+ac.Owner.Branch__c);
                        AccountShare cs = new AccountShare();
                        cs.AccountAccessLevel = 'Read';
                        cs.OpportunityAccessLevel='Edit';                
                        cs.AccountId = ac.Id;
                        cs.UserOrGroupId = us.Id;
                        sharesToCreate.add(cs);    
                        
                    }
                    If(ac.Branch__c =='PUNE'){
                        AccountShare cs = new AccountShare();
                        cs.AccountAccessLevel = 'Read';
                        cs.OpportunityAccessLevel='Edit';                
                        cs.AccountId = ac.Id;
                        cs.UserOrGroupId = us.Id;
                        sharesToCreate.add(cs);         
                    }
                    
                    if (ac.Secondary_Owner__c != null) {
                        // create the new share for group
                        AccountShare cs = new AccountShare();
                        cs.AccountAccessLevel = 'Read';
                        cs.OpportunityAccessLevel='Edit';                
                        cs.AccountId = ac.Id;
                        cs.UserOrGroupId =  us.Id;
                        sharesToCreate.add(cs);
                    }
Need Suggestion...What can be done for this .
Here this trigger is not working .
Any other solution for this ???
NOT (ISPICKVAL( Transfer_ID__r.Transfer_Type__c , 'Store to WHS') AND (Shipping_Quantity__c > Serial_No__r.Quantity_available__c ))

I am getting ) missing in thie validation rule, Can someone help?
Hi guys, 

Im setting up some email alerts for my org. 

I need to set an alert 75 days before a client turns certain age.

I have set a time triggered action send me an email alert when this happens and here goes my question. 

If a contact has been recently added to the org and this contact is only 40 days away from its birthday. will the workflow still send me the alert even tho is past the 75 day mark ?

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.