• Jaseem Pookandy
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
I am applying apex sharing rule on master record wchich should be applied on its child. It is working fine on Master Object but Not working on Child Object.

PROJECT(Master)->ASSIGNMENT(detail)
PROJRCT(Master)->RESOURCE(detail)

on adding resources to project i wrote a trigger(after insert,after update) to creating sharing rule on PROJECT RECORD which give READ or EDIT access to User on Project, It implies this user will get same access on Assignment. But it is not happening.

If i give READ access then user can not edit Project but still edit Assigment.

Is it related to sharing reason or reason is just a reason(why have access)?
I am relatively new to Apex triggers and classes. I have 2 Custom Objects Merchant Applications__c and MerchOpps__c what I need is to create a new MerchOpps__c record when a field value on Merchant Applications__c is met. As the only other trigger I ever deployed was code I lifted from another admin and I don't have ability to take the Developer course, I am hoping some of you will pity me and help me with this trigger and class. Basically, if field "Envelope Status" = Completed on Merchant Applications__c, I need a MerchOpps__c record created using Account Name for the related Lookup field.

I figure it may be similar to this example I found here. But I still wouldn't be able to determine the Class I would have to write.

trigger CreateClass on Opportunity (after insert , before update)
02 {
03     if(!myStaticClass.flag)
04     {
05         List<CS__c> listCS = new List<CS__c>();
06         
07         for(Opportunity o : trigger.new)
08         {
09             if(Trigger.isUpdate)
10             {
11                 if(o.StageName == 'Closed Won' && o.StageName != trigger.oldMap.get(o.Id).StageName)
12                 {
13                   listCS.add(new CS__c(name = 'Addendum '+ o.Name + ' Closed' , Opportunity__c = o.id));
14                 }
15             }
16             if(Trigger.isInsert)
17             {
18                 if(o.StageName == 'Closed Won')
19                 {
20                   listCS.add(new CS__c(name = 'Addendum '+ o.Name + ' Closed' , Opportunity__c = o.id));
21                 }
22             }
23         }
24     
25         if(listCS.size() > 0)
26         {
27             insert listCS;
28         }
29         myStaticClass.flag = true ;
30     }
31 }