• gopinath perumal
  • NEWBIE
  • 25 Points
  • Member since 2014

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

my vf page :

<apex:page controller="ctrl_TestEmailTemplet" >
    <c:comp_ctrl_TestEmailTemplet childcase='5004E0000065R79QAE' />
</apex:page>

 

my component:
<apex:component controller="ctrl_TestEmailTemplet" access="global">
    <apex:attribute name="childcase" type="Id"  assignTo="{!CaseId}" description="This is the value for the component." />
    <apex:dataTable value="{!party}" var="p">
        <apex:column >
            {!p.Existing_Contact__c}
        </apex:column>
        <apex:column >
            {!p.Display_Role__c}
        </apex:column>
        <apex:column >
            {!p.Ownership__c}
        </apex:column>
    </apex:dataTable>
</apex:component>

 

my controller:

public class ctrl_TestEmailTemplet {
    public list<Party_Information__c > party{get;set;}
    public Id CaseId{get; set;}
    public ctrl_TestEmailTemplet() {
        System.debug('CaseId ' + CaseId);
        if(CaseId != NULL){
            system.debug('CaseId->'+CaseId);
        Id parentAccountId = [Select Parent_Account_Id__c FROM Case Where Id =:CaseId].Parent_Account_Id__c;
           system.debug('parentAccountId->'+parentAccountId);
           party = [Select Existing_Contact__c, Display_Role__c, Ownership__c from Party_Information__c Where Account__c=:parentAccountId And Role__c ='Shareholder' AND End_Date__c=null];
           system.debug('party ->'+ party);      
    }
                party= NULL;
    }
    
  
}

Hi,

I have written a trigger, where-in I am assigning Permission set to a user based on his roles.

if a user role name contains Sales Manager or Director, Permission set gets assigned to him at the time of Update and Insert.

When the userrole contains Executive , Permission Set gets Deleted automatically at the time of Update and Insert.

Can anyone help me in writting Test Class for the same.

 

my vf page :

<apex:page controller="ctrl_TestEmailTemplet" >
    <c:comp_ctrl_TestEmailTemplet childcase='5004E0000065R79QAE' />
</apex:page>

 

my component:
<apex:component controller="ctrl_TestEmailTemplet" access="global">
    <apex:attribute name="childcase" type="Id"  assignTo="{!CaseId}" description="This is the value for the component." />
    <apex:dataTable value="{!party}" var="p">
        <apex:column >
            {!p.Existing_Contact__c}
        </apex:column>
        <apex:column >
            {!p.Display_Role__c}
        </apex:column>
        <apex:column >
            {!p.Ownership__c}
        </apex:column>
    </apex:dataTable>
</apex:component>

 

my controller:

public class ctrl_TestEmailTemplet {
    public list<Party_Information__c > party{get;set;}
    public Id CaseId{get; set;}
    public ctrl_TestEmailTemplet() {
        System.debug('CaseId ' + CaseId);
        if(CaseId != NULL){
            system.debug('CaseId->'+CaseId);
        Id parentAccountId = [Select Parent_Account_Id__c FROM Case Where Id =:CaseId].Parent_Account_Id__c;
           system.debug('parentAccountId->'+parentAccountId);
           party = [Select Existing_Contact__c, Display_Role__c, Ownership__c from Party_Information__c Where Account__c=:parentAccountId And Role__c ='Shareholder' AND End_Date__c=null];
           system.debug('party ->'+ party);      
    }
                party= NULL;
    }
    
  
}