• Firas Taamallah 18
  • NEWBIE
  • 10 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 6
    Replies
Hello , 

I'm trying to give Edit access to System Admin but i couldn't
It's an indexing Field

User-added imageHow can i achieve this ?
Thanks,
Hello , 

When i activated SF-Release :  Enforce Access Modifiers on Apex Properties in Lightning Component Markup  ,  and  i runned all Test Class ,  Managed Package test classes didn't pass for some reason .

why ? what's the impact on Org?

Thanks,
Firas
Hello ,

I want to develop an soql which will return number of time a field being changed since september 2020 .
  • Soql : SELECT count(Case.Subject), count(Case.OwnerId)  FROM CaseHistory where case.LastModifiedDate  >= 2020-09-01T00:00:00Z 
Does this soql true? how can i aggregate Checkbox field as i can not use Count on checkbox field .. 

Thanks,
Hello ,

There's Page layout which contain many component in , the goal is to make field (which is present in some of component) Mandatory for certain RecordType - How can i achieve this ? 

Using Aura:if ?
Hi , 

I want the case record type to be changed automatically every time it's related object's field which is picklist change 

Example : 
  • Case A , Record Type  = B
  • Custom Object C , Picklist value = C
In this case , the case record type should be changed to C - How can i achieve this using Apex ? 
Id devRecordTypeId = Schema.SObjectType.Case.getRecordTypeInfosByName().get(era.EmailRule__r.CaseRecordType__c).getRecordTypeId();

This line seems doesn't work , i tried to get ID of the custom object's field ( picklist value ) and assign it to Case recordType  ..

Thanks,​​​​​​​
Hello ,

Why i can't find  Apex Classes when i search for it in Setup ?
User-added image
Hi ,

Given this diagram , how can i retrieve case recordtype from Email_Rule object ?

User-added imageThanks,
Firas
Hi , 

There's path in Case record type 
I want to lock field from editing when Path is equal " Distribued" 

How can i achieve this?
Rgds,
Firas
Hi ,
  • My parent objet Test_Campaign__c have lookup Core_Campaign_Model__c on itself.
  • My child object have lookup field Test_Campaign__c to Test_Campaign__c 
My need is to link child records to parent every time new parent is created with Core_Campaign_Model__c   equal child.Test_Campaign__c

Here's my trigger : 
 
trigger TRG_LinkCampaing on Test_Campaign__c (after insert,after update) {

    
    set<Id> ParID = new set<Id>();
    
    
    for(Test_Campaign__c TestCamp : Trigger.new)
    {
      ParID.add(TestCamp.Core_Campaign_Model__c);
    }
    List<Test_Scenario__c> TS = [Select Id , Test_Campaign__c from Test_Scenario__c where  Test_Campaign__c In :ParID ];
    List<Test_Campaign__c> TC = [Select Id,name from Test_Campaign__c where Id = : Trigger.new];

     List<Test_Scenario__c> TestCampaToUpdate = new List<Test_Scenario__c>();
    for (Test_Scenario__c Testsc : TS){
         
       Testsc.Test_Campaign__c = TC[0].Id;
        TestCampaToUpdate.add(Testsc);
        
    }
    update TestCampaToUpdate;
}

This trigger works fine but only one time due to TC[0].Id , how can i avoid this?
I have this method
 
Public void Method(){
for (AccountContactRelation accountContactRelation : (List<AccountContactRelation>) Trigger.new) {
            String oldRoles = (Trigger.isUpdate) ? ((AccountContactRelation) Trigger.oldMap.get(accountContactRelation.Id)).Roles : null;

            if (accountContactRelation.Roles != null && accountContactRelation.Roles.contains(Label1) && (Trigger.isInsert ||
                    (Trigger.isUpdate && (oldRoles == null || !oldRoles.contains(Label1))))) {
                if (!accountContactRelationIdsMap.containsKey(accountContactRelation.AccountId)) {
                    accountContactRelationIdsMap.put(accountContactRelation.AccountId, new List<Id>());
                }
                accountContactRelationIdsMap.get(accountContactRelation.AccountId).add(accountContactRelation.ContactId);
            }
        }

i want to remove Trigger.New and Trigger.Old and replace them with parameters like : 
 
Public void Method(List<AccountContactRelation> NewAccCont , List<AccountContactRelation> OldAccCont){

for (AccountContactRelation accountContactRelation : NewAccCont ) {

//How can i declare OldRoles using the parameter OldAccCont

            String oldRoles = (Trigger.isUpdate) ? ((AccountContactRelation) Trigger.oldMap.get(accountContactRelation.Id)).Roles : null;

            if (accountContactRelation.Roles != null && accountContactRelation.Roles.contains(Label1) && (Trigger.isInsert ||
                    (Trigger.isUpdate && (oldRoles == null || !oldRoles.contains(Label1))))) {
                if (!accountContactRelationIdsMap.containsKey(accountContactRelation.AccountId)) {
                    accountContactRelationIdsMap.put(accountContactRelation.AccountId, new List<Id>());
                }
                accountContactRelationIdsMap.get(accountContactRelation.AccountId).add(accountContactRelation.ContactId);
            }
        }

How can i declare OldRoles using the new parameter OldAccCont
Hi , 

I want to create a validation rule on Case when : 
  • When new created with Record type X , picklist field should be filled automatically with value
How can i achieve this?
Hi , 

Once opportunity is passed to Closed Won , i want to lock it from editing 
How can i achieve this?
Hello ,

I want to develop an soql which will return number of time a field being changed since september 2020 .
  • Soql : SELECT count(Case.Subject), count(Case.OwnerId)  FROM CaseHistory where case.LastModifiedDate  >= 2020-09-01T00:00:00Z 
Does this soql true? how can i aggregate Checkbox field as i can not use Count on checkbox field .. 

Thanks,
Hi ,
  • My parent objet Test_Campaign__c have lookup Core_Campaign_Model__c on itself.
  • My child object have lookup field Test_Campaign__c to Test_Campaign__c 
My need is to link child records to parent every time new parent is created with Core_Campaign_Model__c   equal child.Test_Campaign__c

Here's my trigger : 
 
trigger TRG_LinkCampaing on Test_Campaign__c (after insert,after update) {

    
    set<Id> ParID = new set<Id>();
    
    
    for(Test_Campaign__c TestCamp : Trigger.new)
    {
      ParID.add(TestCamp.Core_Campaign_Model__c);
    }
    List<Test_Scenario__c> TS = [Select Id , Test_Campaign__c from Test_Scenario__c where  Test_Campaign__c In :ParID ];
    List<Test_Campaign__c> TC = [Select Id,name from Test_Campaign__c where Id = : Trigger.new];

     List<Test_Scenario__c> TestCampaToUpdate = new List<Test_Scenario__c>();
    for (Test_Scenario__c Testsc : TS){
         
       Testsc.Test_Campaign__c = TC[0].Id;
        TestCampaToUpdate.add(Testsc);
        
    }
    update TestCampaToUpdate;
}

This trigger works fine but only one time due to TC[0].Id , how can i avoid this?
I have this method
 
Public void Method(){
for (AccountContactRelation accountContactRelation : (List<AccountContactRelation>) Trigger.new) {
            String oldRoles = (Trigger.isUpdate) ? ((AccountContactRelation) Trigger.oldMap.get(accountContactRelation.Id)).Roles : null;

            if (accountContactRelation.Roles != null && accountContactRelation.Roles.contains(Label1) && (Trigger.isInsert ||
                    (Trigger.isUpdate && (oldRoles == null || !oldRoles.contains(Label1))))) {
                if (!accountContactRelationIdsMap.containsKey(accountContactRelation.AccountId)) {
                    accountContactRelationIdsMap.put(accountContactRelation.AccountId, new List<Id>());
                }
                accountContactRelationIdsMap.get(accountContactRelation.AccountId).add(accountContactRelation.ContactId);
            }
        }

i want to remove Trigger.New and Trigger.Old and replace them with parameters like : 
 
Public void Method(List<AccountContactRelation> NewAccCont , List<AccountContactRelation> OldAccCont){

for (AccountContactRelation accountContactRelation : NewAccCont ) {

//How can i declare OldRoles using the parameter OldAccCont

            String oldRoles = (Trigger.isUpdate) ? ((AccountContactRelation) Trigger.oldMap.get(accountContactRelation.Id)).Roles : null;

            if (accountContactRelation.Roles != null && accountContactRelation.Roles.contains(Label1) && (Trigger.isInsert ||
                    (Trigger.isUpdate && (oldRoles == null || !oldRoles.contains(Label1))))) {
                if (!accountContactRelationIdsMap.containsKey(accountContactRelation.AccountId)) {
                    accountContactRelationIdsMap.put(accountContactRelation.AccountId, new List<Id>());
                }
                accountContactRelationIdsMap.get(accountContactRelation.AccountId).add(accountContactRelation.ContactId);
            }
        }

How can i declare OldRoles using the new parameter OldAccCont
Suppose there is an inputfield/picklist field.........i want to populate an output textbox with the value of input field or value selected in picklist.
how to do this?