• Laxmaya Chn
  • NEWBIE
  • 35 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 1
    Likes Given
  • 18
    Questions
  • 5
    Replies
Hello guys, we are trying to create a self service community, where we are going hold some content(solutions/answers to common questions). Customer (we have arund 20k customers) should be able to read the content and if they are not able to find his solution then they should be able submit a case. We don't have community license and trying to create a community, is it possible?. Thank you!! in advance guys.
I am able to create and hold records in big object. Here's my issue with bigobject fields, I am able to insert the data with LongTextArea/TextArea fields, but I am unable to query the field. And even Salesforce is not showing up those fields while querying from workbench as Salesforce is not supporting LongTextArea/TextArea. Anyone suggest me or help me workaround any workaround as I need to store and get the field info(LongTextArea/TextArea).
Can any one suggest me why I am unable to show an alert message onchange of picklist values in Topic and Subtopic. I am also calling onload controller method in the java script which synchronize Topic and Subtopic.

<apex:pageBlockSection columns="1"> <apex:pageBlockSectionItem > <apex:outputLabel >Select Topic:</apex:outputLabel> <apex:inputField value="{!dummyCase.Topic__c}" onchange="loadSet();" id="st" /> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockSection columns="1"> <apex:pageBlockSectionItem rendered="{!TopicSelected}"> <apex:outputLabel >Subtopic:</apex:outputLabel> <apex:inputField value="{!dummyCase.Subtopic__c}" onchange="loadSet();"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> <script> function loadSet() { var myPicklistElement = document.getElementById('{!$Component.frm.st}'); var myPicklistValue = myPicklistElement.options[myPicklistElement.selectedIndex].value; if (myPicklistValue == 'value1') { alert('value 1'); // return; } onload(); } </script>
Hi I am new to salesforce and trying to write a trigger to update field(live to site) in Lead based on some condition.

we have a custom field in Account Account_id__c(ex:25679) which is a number and also similar field(seller_id__c-which is also a number ex:25679) in lead which is also a number. When there is a new account with some account id matches with lead seller id then a field live to site(picklist with values Yes, No) in lead should update with Yes.

Here's is my trigger, please correct me.


trigger LTS_Update1 on Account (after update) {
    set<Id> acctIds = new set<Id>();
    map<Id, Account> mapAccount = new map<Id, Account>();
      List<Lead> listLead = new List<Lead>();
    
    for(Account acct : trigger.new) {
        acctIds.add(acct.Id);
        mapAccount.put(acct.Id, acct);
    }
    
    listLead = [SELECT Id, Live_to_site__c, Account__c FROM Lead WHERE Account__c IN : acctIds];    
    
    List<Account> acc=new List<Account>();
    for(Account acct: acc)
    {
    if(acc[0].Account_ID__c == listLead[0].seller_id__c) {
        for(Lead ld : listLead) {
            ld.Live_to_site__c = 'Yes';
          }  
        }
        update listLead;
    }
}
I am unable to login into my salesforce dataloader even after using correct username and password, the error I am getting while trying to login is "com.sforce.ws.connectorconfig.getNtmlDomain()Ljava/lang/String". Verified my login histroy and it's showing was able to login into dataloader successfully.
Any one have resolution?.
Thanks in Advance
Hi I have writter a trigger for updating child object(CTOpportunity__c) records if there is an update in opportunity(parent) record then the related field should update in the child record(CTOpportunity__c object). While saving the record, It's giving the following error (Update failed. First exception on row 0 with id a0dP0000000S6tRIAS; first error: INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST, Category: bad value for restricted picklist field: Phone, Electronics & Accessories: [Category__c]: Trigger.Intg_Opty_Update: line 29, column 1) here field Category__c is picklist . What might be the cause?. Thanks in Advance.

Trigger Code
trigger CTOpty_Update on Opportunity(after update) {
 
    set<Id> OptIds = new set<Id>();
    
    map<Id, Opportunity> mapOpty = new map<Id, Opportunity>();       
      
    List<CTOpportunity__c> lstIntgopt = new List<CTOpportunity__c>();  
    
    for(Opportunity Opt : Trigger.New) {
         OptIds.add(Opt.Id);
         mapOpty.put(Opt.Id, Opt);
         }        
     
    lstctopt = [SELECT Name, Amount__c, Total__c,Category__c,Commission__c,
                  Opportunity__c FROM CTOpportunity__c WHERE Opportunity__c IN: OptIds];
                   
    if(lstctopt.size() > 0) {
        for(CTOpportunity__c ctop : lstIntgopt) {
            ctop.Amount__c = mapOpty.get(ctop.Opportunity__c).Amount__c;
            ctop.Total__c  = mapOpty.get(ctop.Opportunity__c).Total__c;           
            ctop.Category__c = mapOpty.get(ctop.Opportunity__c).Category__c;            
            ctop.Commission__c = mapOpty.get(ctop.Opportunity__c).Commission__c;           
            }
        update lstctopt;
    }
}
In my current project we need to send data from salesforce to hadoop through integration. I have basic knowledge on integration but never done hadoop integration. Anyone have done this before, kindly share your comments and appreciate your help here. Thank you in advance.
Hi guys, I'm unable to cover code for my trigger. As I'm new in coding I'm facing issues. Here unable to cover the code in bold format and I'm getting only 37% code coverage. Can you please suggest/give tips/code your ideas?. Thanks in Advance.

TRIGGER::
trigger Commission_Trigger on Commission__c (after insert, after update) {
    try{
        if(Trigger.isAfter && Trigger.isInsert && !CommissionHelper.isCommissionTgrAlreadyRunning){
            
            CommissionHelper.isCommissionTgrAlreadyRunning = true;
            set<id> accountids = new set<ID>();
            List<string> ruleIDs = new List<string>();
            map<id,account> existingaccountmap = new map<id,account>();
            
            List<ID> toDeleteCommission = new List<ID>();
            Map<string,Commission__c> triggerCommissionsMap = new Map<string,Commission__c> ();
            List<Commission__c> finalUpdate = new List<Commission__c>();
            
            for(Commission__c cm : Trigger.new){
                if(string.isNotBlank(cm.Rule_ID__c)&& (accountids <> NULL) ){
                    triggerCommissionsMap.put(cm.Rule_ID__c+cm.account__c,cm); 
                    ruleIDs.add(cm.Rule_ID__c);
                    accountids.add(cm.account__c);               
                }
            }
List<Commission__c> existingCommissions = [SELECT Id, Name__c, Sales__c, Status__c, Account__c, Description__c, Rule_ID__c FROM Commission__c where Rule_ID__c IN :ruleIDs and account__c IN :accountids and ID NOT IN :trigger.new limit 10000];

            for(Commission__c cm : existingCommissions){
            string keypoint = cm.Rule_ID__c+cm.account__c;
                Commission__c cmNew = triggerCommissionsMap.get(keypoint);
                if(cmNew != null && string.isNotBlank(cmNew.Rule_ID__c) && string.isNotBlank(cmNew.Account__c) && cmNew.Rule_ID__c.equals(cm.Rule_ID__c) && cmNew.Account__c.equals(cm.Account__c) ){

                    if(string.isNotBlank(cmNew.Rule_ID__c))cm.Rule_ID__c = cmNew.Rule_ID__c;
                    if(string.isNotBlank(cmNew.Name__c))cm.Name__c = cmNew.Name__c;
                    if((cmNew.Sales__c != null))cm.Sales__c = cmNew.Sales__c;
                    if(string.isNotBlank(cmNew.Status__c))cm.Status__c = cmNew.Status__c;
                    if(string.isNotBlank(cmNew.Description__c))cm.Description__c = cmNew.Description__c;

            finalUpdate.add(cm);                    
            todeleteCommission.add(cmNew.id);
             
}
            }
            system.debug('The finalUpdate Info::'+finalUpdate);
            if(finalUpdate.size() > 0){
                system.Database.update(finalUpdate);
                CommissionHelper.toDeleteCommission(toDeleteCommission);    
            }
            
        }else{
            //Do nothing
            system.debug('This trigger logic is not executing 2nd time');
        }
    }catch(Exception ex){
        system.debug('Some thing went wrong::EX:'+ex);
    }
}
    
TEST CLASS:
@isTest
public class Commission_Trigger_Test {
    public static testMethod void testCommissiontrigger() {
               
        List<Account> act = new List<Account>{ new Account(
            Name = 'Jeffy',
            Brands = 'Appliances',
            Account_Manager__c = 'DougBolo') };
                  
        insert act;
                 
        List<Commission__c> comtr = new List<Commission_Meter__c>{ new Commission__c(
            Description__c = 'Books',
            Rule_ID__c = 'R5522',
            Sales__c = 122,
            Status__c = 145,
            Account__c = [SELECT id FROM Account LIMIT 1][0].id,
            Name__c = 'Active')};
                 
        insert comtr; 
        update comtr;
        
      List<Commission__c> updtcomtr = New List<Commission__c>{
            [SELECT Id, Name__c, Status__c, Account__c, Description__c, Sales__c, Description__c FROM Commission__c where id in :comtr]                for(Commission__c ucomtr:updtcomtr){               
                ucomtr.Name__c = 'zhan11';
               ucomtr.Status__c = 'Processing';
               ucomtr.Description__c = 'New Rule';
               ucomtr.Sales__c = 1000;                
               ucomtr.Rule_ID__c = 'Z443';                           
        }        
        update ucomtr;                
    }
}
For my trigger I'm getting only 40% code coverage. I'm unbale to cover the following code, though I wrote some code here. Guys can you please help me here what should be the test class code for the following piece of code.

List<Commission__c> existingCommissions = [SELECT Id, Name__c, Sales__c, Status__c, Account__c, Description__c, Rule_ID__c FROM Commission_Meter__c where Rule_ID__c IN :ruleIDs and account__c IN :accountids and ID NOT IN :trigger.new limit 10000]; for(Commission__c cm : existingCommissions){ string keypoint = cm.Rule_ID__c+cm.account__c; Commission_Meter__c cmNew = triggerCommissionMetersMap.get(keypoint); if(cmNew != null && string.isNotBlank(cmNew.Rule_ID__c) && string.isNotBlank(cmNew.Account__c) && cmNew.Rule_ID__c.equals(cm.Rule_ID__c) && cmNew.Account__c.equals(cm.Account__c) ){ if(string.isNotBlank(cmNew.Rule_ID__c))cm.Rule_ID__c = cmNew.Rule_ID__c; if(string.isNotBlank(cmNew.Name__c))cm.Name__c = cmNew.Name__c; if((cmNew.Sales__c != null))cm.Sales__c = cmNew.Sales__c; if(string.isNotBlank(cmNew.Status__c))cm.Status__c = cmNew.Status__c; if(string.isNotBlank(cmNew.Description__c))cm.Description__c = cmNew.Description__c; finalUpdate.add(cm); } }
In my project as the data is coming from third party where they are sending data from their end with Salesforce ID(Account). Sometimes they are sending invalid id's(which are not existed in our database for Accounts), hence I need to cross check new incoming ID with existing ID and want to through an error if the ID doesn't exist.
Hi Guys,
Everything is fine with my trigger which updates child object(Commissions__c) records under Accounts based on Rule_ID in Commission object. If the new record is having new Rule_ID__C it just inserts new record if the Rule_ID doesn't match with existing record or if it matches with existing Commission records then it will update the existing child object(Commission) record. As the data is coming from third party 
through integration, some times they are sending invalid account ids which leads to create duplicate records in the child object, if I'm 
able to compare the existing salesforce Account id's with new incoming salesforce Account id's my issue will resolve.

Thanks in Advance and here is my code. I'm not providing related apex class code(commissionHelper).

Trigger Commissions_Trigger on Commission__c (after insert, after update) {

    try{
        if(Trigger.isAfter && Trigger.isInsert && !CommissionHelper.isCommissionTgrAlreadyRunning){            
            CommissionHelper.isCommissionTgrAlreadyRunning = true;
            
            set<id> accountids = new set<ID>();
            List<string> ruleIDs = new List<string>();
            
            List<ID> toDeleteCommission = new List<ID>();
            Map<string,Commission___c> triggerCommissionMap = new Map<string,Commission__c> ();
            List<Commission__c> finalUpdate = new List<Commission__c>();

            for(Commission_Meter__c cm : Trigger.new){
                if(string.isNotBlank(cm.Rule_ID__c)){
                    triggerCommissionMetersMap.put(cm.Rule_ID__c+cm.account__c,cm); 
                    ruleIDs.add(cm.Rule_ID__c);
                    accountids.add(cm.account__c);               
                }
            }

            List<Commission__c> existingCommissions = [SELECT Id, Name__c, Sales__c, Status__c, Account__c, Description__c, Rule_ID__c FROM Commission_Meter__c where Rule_ID__c IN :ruleIDs and account__c IN :accountids and ID NOT IN :trigger.new limit 10000];

            for(Commission__c cm : existingCommissions){
            
            string keypoint = cm.Rule_ID__c+cm.account__c;
                Commission_Meter__c cmNew = triggerCommissionMetersMap.get(keypoint);
                if(cmNew != null && string.isNotBlank(cmNew.Rule_ID__c) && string.isNotBlank(cmNew.Account__c) && cmNew.Rule_ID__c.equals(cm.Rule_ID__c) && cmNew.Account__c.equals(cm.Account__c) ){
                    
                    if(string.isNotBlank(cmNew.Rule_ID__c))cm.Rule_ID__c = cmNew.Rule_ID__c;
                    if(string.isNotBlank(cmNew.Name__c))cm.Name__c = cmNew.Name__c;
                    if((cmNew.Sales__c != null))cm.Sales__c = cmNew.Sales__c;
                    if(string.isNotBlank(cmNew.Status__c))cm.Status__c = cmNew.Status__c;
                    if(string.isNotBlank(cmNew.Description__c))cm.Description__c = cmNew.Description__c;
            
        finalUpdate.add(cm);
                todeleteCommission.add(cmNew.id);                   
                }
            }
            system.debug('The finalUpdate Info::'+finalUpdate);
            if(finalUpdate.size() > 0){
                system.Database.update(finalUpdate);
                CommissionHelper.toDeleteCommission(toDeleteCommission);    
            }
            
        }else{
            //Do nothing
            system.debug('This trigger logic is not executing 2nd time');
        }
    }catch(exception ex){
        system.debug('Some thing went wrong::EX:::'+ex);
    }
}
1.I have one custom object Commission(child to Accounts) with fields Rule_id, name, sales etc.
2.My requirement is whenever there is a new record in Commission it must insert, but for subsequent records it must check Rule_id in existing Commission records. If the Rule_id is same for existing and new(incoming) record it must update existing record.and also it must check commission record Account wise not all the commission records existed in the Commission object.
DETAILED INFO:
Need to add some trigger code to the following trigger as per our new requirement. For example consider there are 2 Account records Account1 and Account2 till now Account1 can't contain duplicate commission records based on Rule_id like this Account2 can't contain duplicate commission records based on Rule_id. For your understanding if Account1 is having a commission record with Rule_id 3344, in Account2 it must accept a new commission record with Rule_id 3344 but as per this code it's not accepting(deleting) any new commission record with existing Rule_id.


Trigger Commissions_Trigger_AfterInsert on Commission__c (after insert) { try{ if(Trigger.isAfter && Trigger.isInsert && !CommissionHelper.isCommissionTgrAlreadyRunning){ CommissionHelper.isCommissionTgrAlreadyRunning = true; List<ID> toDeleteCommission = new List<ID>(); Map<string,Commission___c> triggerCommissionMap = new Map<string,Commission__c> (); List<Commission__c> finalUpdate = new List<Commission__c>(); for(Commission__c cm : Trigger.new){ if(string.isNotBlank(cm.Rule_ID__c)){ triggerCommissionMap.put(cm.Rule_ID__c,cm); } } List<Commission__c> existingCommissions = [SELECT Id, Name, Name__c, Status__c, Account__c, Description__c, Rule_ID__c FROM Commission__c where Rule_ID__c IN :triggerCommissionMetersMap.keySet() and ID NOT IN :trigger.new limit 10000]; for(Commission__c cm : existingCommissions){ Commission__c cmNew = triggerCommissionMap.get(cm.Rule_ID__c); if(cmNew != null){ //cm.Account__c = cmNew.Account__c; if(string.isNotBlank(cmNew.Name__c))cm.Name__c = cmNew.Name__c; if(string.isNotBlank(cmNew.Status__c))cm.Status__c = cmNew.Status__c; if(string.isNotBlank(cmNew.Description__c))cm.Description__c = cmNew.Description__c; if(string.isNotBlank(cmNew.Rule_ID__c))cm.Rule_ID__c = cmNew.Rule_ID__c; finalUpdate.add(cm); todeleteCommission.add(cmNew.id); } } system.debug('The finalUpdate Info::'+finalUpdate); if(finalUpdate.size() > 0){ system.Database.update(finalUpdate); CommissionHelper.toDeleteCommission(toDeleteCommission); } }else{ //Do nothing system.debug('This trigger logic is not executing 2nd time'); } }catch(exception ex){ system.debug('Some thing went wrong::EX:::'+ex); }

HELPER CLASS

public class CommissionMeterHelper { public static boolean isCommissionMeterTgrAlreadyRunning = false; @future public static void toDeleteCommissionMeter(List<ID> toDelete ){ try{ system.debug('toDelete:::::'+toDelete); List<Commission_Meter__c> cmToDelete = [select ID from Commission_Meter__c where ID IN :toDelete]; System.Database.delete(cmToDelete); }catch(exception ex){ system.debug('Some thing went wrong::EX:::'+ex); } } }
 
Hi 
I have a picklist field that should disable upon checking check box, can any one help me here. Thanks in advance.
Hi
Currently we are using REST PUT service to integrate with third party technology(Java) for sending csv files from salesforce to third party client. At the time of connecting to my client we are getting the error code 415 unsupported media type. We went through salesforce documentation and came to know that salesforce currently doesn't support requests of content-type multipart/form-data. Any one have solution to this issue?.

Thanks ind Advance
Hi Guys can anyone please help(explain) me the following formula. As I have very basic knowledge, it is hard to me understand the formula. We are using this formula in case management system. Here FLAGS__ViewedFlag__c is Date/Time field(object type). Please explain me how it works.

Thanks in advance
RPAD(
RPAD(
RPAD(
text(CASE(VALUE(TRIM(LEFT(TRIM(RIGHT(TEXT(FLAGS__ViewedFlag__c),9)),2))),
13,13,
12,13,
11,13,
10,13,
9,13,
8,13,
7,13,
6,13,
5,22,
4,22,
3,22,
2,22,
1,22,
0,22,
24,22,
23,22,
VALUE(TRIM(LEFT(TRIM(RIGHT(TEXT(FLAGS__ViewedFlag__c),9)),2)))))
,3,":"),
5,
IF(VALUE(TRIM(LEFT(TRIM(RIGHT(TEXT(FLAGS__ViewedFlag__c),9)),2)))>=22,
'00',
IF(VALUE(TRIM(LEFT(TRIM(RIGHT(TEXT(FLAGS__ViewedFlag__c),9)),2)))<13,
'00',
TRIM(RIGHT(TRIM(LEFT(TEXT(FLAGS__ViewedFlag__c),16)),2))))),8,
':00')))
Hi
I am getting APEX HEAP SIZE IS TOO LARGE error while attaching files to send emails to customers in cases. Here I am getting error cause "Error is in expression '{!save}' in component <apex:commandButton> in page e2cp:new_comment" i.e I am getting heap size error due to sav/send button which is in managed package where I can't modify any code. Guys pleae don't tell me do modifications in relative apex/vf page, as I am using managed package I can't do any modification. 

Revert me if any one have solution to this one.

Thanks in advance
Hi Dudes
I am getting apex heap size problem while attaching 9 MB file and sending it to my customers in cases; I am able to attach a file up to 25 MB but I am unable to send a file with that size.
Hi guys please reply to my question as soon as possible.

1.Our organization has installed unmanaged package 2 years back with some licenses.
2.They are not using this package from past 1 year & didn't renewal the license.
3.Now we are getting deployment errors with that package which has some dependencies.
4.Finally I just want to know how to uninstall that package in production as we can't do any changes to classes in production
Hi Guys,
Everything is fine with my trigger which updates child object(Commissions__c) records under Accounts based on Rule_ID in Commission object. If the new record is having new Rule_ID__C it just inserts new record if the Rule_ID doesn't match with existing record or if it matches with existing Commission records then it will update the existing child object(Commission) record. As the data is coming from third party 
through integration, some times they are sending invalid account ids which leads to create duplicate records in the child object, if I'm 
able to compare the existing salesforce Account id's with new incoming salesforce Account id's my issue will resolve.

Thanks in Advance and here is my code. I'm not providing related apex class code(commissionHelper).

Trigger Commissions_Trigger on Commission__c (after insert, after update) {

    try{
        if(Trigger.isAfter && Trigger.isInsert && !CommissionHelper.isCommissionTgrAlreadyRunning){            
            CommissionHelper.isCommissionTgrAlreadyRunning = true;
            
            set<id> accountids = new set<ID>();
            List<string> ruleIDs = new List<string>();
            
            List<ID> toDeleteCommission = new List<ID>();
            Map<string,Commission___c> triggerCommissionMap = new Map<string,Commission__c> ();
            List<Commission__c> finalUpdate = new List<Commission__c>();

            for(Commission_Meter__c cm : Trigger.new){
                if(string.isNotBlank(cm.Rule_ID__c)){
                    triggerCommissionMetersMap.put(cm.Rule_ID__c+cm.account__c,cm); 
                    ruleIDs.add(cm.Rule_ID__c);
                    accountids.add(cm.account__c);               
                }
            }

            List<Commission__c> existingCommissions = [SELECT Id, Name__c, Sales__c, Status__c, Account__c, Description__c, Rule_ID__c FROM Commission_Meter__c where Rule_ID__c IN :ruleIDs and account__c IN :accountids and ID NOT IN :trigger.new limit 10000];

            for(Commission__c cm : existingCommissions){
            
            string keypoint = cm.Rule_ID__c+cm.account__c;
                Commission_Meter__c cmNew = triggerCommissionMetersMap.get(keypoint);
                if(cmNew != null && string.isNotBlank(cmNew.Rule_ID__c) && string.isNotBlank(cmNew.Account__c) && cmNew.Rule_ID__c.equals(cm.Rule_ID__c) && cmNew.Account__c.equals(cm.Account__c) ){
                    
                    if(string.isNotBlank(cmNew.Rule_ID__c))cm.Rule_ID__c = cmNew.Rule_ID__c;
                    if(string.isNotBlank(cmNew.Name__c))cm.Name__c = cmNew.Name__c;
                    if((cmNew.Sales__c != null))cm.Sales__c = cmNew.Sales__c;
                    if(string.isNotBlank(cmNew.Status__c))cm.Status__c = cmNew.Status__c;
                    if(string.isNotBlank(cmNew.Description__c))cm.Description__c = cmNew.Description__c;
            
        finalUpdate.add(cm);
                todeleteCommission.add(cmNew.id);                   
                }
            }
            system.debug('The finalUpdate Info::'+finalUpdate);
            if(finalUpdate.size() > 0){
                system.Database.update(finalUpdate);
                CommissionHelper.toDeleteCommission(toDeleteCommission);    
            }
            
        }else{
            //Do nothing
            system.debug('This trigger logic is not executing 2nd time');
        }
    }catch(exception ex){
        system.debug('Some thing went wrong::EX:::'+ex);
    }
}
Hi Dudes
I am getting apex heap size problem while attaching 9 MB file and sending it to my customers in cases; I am able to attach a file up to 25 MB but I am unable to send a file with that size.
Hi,

I have  a custom object like objectA(like lead) i need to conver lead account and contact using button ..how it is possible
In my current project we need to send data from salesforce to hadoop through integration. I have basic knowledge on integration but never done hadoop integration. Anyone have done this before, kindly share your comments and appreciate your help here. Thank you in advance.
Hi guys, I'm unable to cover code for my trigger. As I'm new in coding I'm facing issues. Here unable to cover the code in bold format and I'm getting only 37% code coverage. Can you please suggest/give tips/code your ideas?. Thanks in Advance.

TRIGGER::
trigger Commission_Trigger on Commission__c (after insert, after update) {
    try{
        if(Trigger.isAfter && Trigger.isInsert && !CommissionHelper.isCommissionTgrAlreadyRunning){
            
            CommissionHelper.isCommissionTgrAlreadyRunning = true;
            set<id> accountids = new set<ID>();
            List<string> ruleIDs = new List<string>();
            map<id,account> existingaccountmap = new map<id,account>();
            
            List<ID> toDeleteCommission = new List<ID>();
            Map<string,Commission__c> triggerCommissionsMap = new Map<string,Commission__c> ();
            List<Commission__c> finalUpdate = new List<Commission__c>();
            
            for(Commission__c cm : Trigger.new){
                if(string.isNotBlank(cm.Rule_ID__c)&& (accountids <> NULL) ){
                    triggerCommissionsMap.put(cm.Rule_ID__c+cm.account__c,cm); 
                    ruleIDs.add(cm.Rule_ID__c);
                    accountids.add(cm.account__c);               
                }
            }
List<Commission__c> existingCommissions = [SELECT Id, Name__c, Sales__c, Status__c, Account__c, Description__c, Rule_ID__c FROM Commission__c where Rule_ID__c IN :ruleIDs and account__c IN :accountids and ID NOT IN :trigger.new limit 10000];

            for(Commission__c cm : existingCommissions){
            string keypoint = cm.Rule_ID__c+cm.account__c;
                Commission__c cmNew = triggerCommissionsMap.get(keypoint);
                if(cmNew != null && string.isNotBlank(cmNew.Rule_ID__c) && string.isNotBlank(cmNew.Account__c) && cmNew.Rule_ID__c.equals(cm.Rule_ID__c) && cmNew.Account__c.equals(cm.Account__c) ){

                    if(string.isNotBlank(cmNew.Rule_ID__c))cm.Rule_ID__c = cmNew.Rule_ID__c;
                    if(string.isNotBlank(cmNew.Name__c))cm.Name__c = cmNew.Name__c;
                    if((cmNew.Sales__c != null))cm.Sales__c = cmNew.Sales__c;
                    if(string.isNotBlank(cmNew.Status__c))cm.Status__c = cmNew.Status__c;
                    if(string.isNotBlank(cmNew.Description__c))cm.Description__c = cmNew.Description__c;

            finalUpdate.add(cm);                    
            todeleteCommission.add(cmNew.id);
             
}
            }
            system.debug('The finalUpdate Info::'+finalUpdate);
            if(finalUpdate.size() > 0){
                system.Database.update(finalUpdate);
                CommissionHelper.toDeleteCommission(toDeleteCommission);    
            }
            
        }else{
            //Do nothing
            system.debug('This trigger logic is not executing 2nd time');
        }
    }catch(Exception ex){
        system.debug('Some thing went wrong::EX:'+ex);
    }
}
    
TEST CLASS:
@isTest
public class Commission_Trigger_Test {
    public static testMethod void testCommissiontrigger() {
               
        List<Account> act = new List<Account>{ new Account(
            Name = 'Jeffy',
            Brands = 'Appliances',
            Account_Manager__c = 'DougBolo') };
                  
        insert act;
                 
        List<Commission__c> comtr = new List<Commission_Meter__c>{ new Commission__c(
            Description__c = 'Books',
            Rule_ID__c = 'R5522',
            Sales__c = 122,
            Status__c = 145,
            Account__c = [SELECT id FROM Account LIMIT 1][0].id,
            Name__c = 'Active')};
                 
        insert comtr; 
        update comtr;
        
      List<Commission__c> updtcomtr = New List<Commission__c>{
            [SELECT Id, Name__c, Status__c, Account__c, Description__c, Sales__c, Description__c FROM Commission__c where id in :comtr]                for(Commission__c ucomtr:updtcomtr){               
                ucomtr.Name__c = 'zhan11';
               ucomtr.Status__c = 'Processing';
               ucomtr.Description__c = 'New Rule';
               ucomtr.Sales__c = 1000;                
               ucomtr.Rule_ID__c = 'Z443';                           
        }        
        update ucomtr;                
    }
}
Hi 
I have a picklist field that should disable upon checking check box, can any one help me here. Thanks in advance.
Hi guys please reply to my question as soon as possible.

1.Our organization has installed unmanaged package 2 years back with some licenses.
2.They are not using this package from past 1 year & didn't renewal the license.
3.Now we are getting deployment errors with that package which has some dependencies.
4.Finally I just want to know how to uninstall that package in production as we can't do any changes to classes in production
Hi Guys can anyone please help(explain) me the following formula. As I have very basic knowledge, it is hard to me understand the formula. We are using this formula in case management system. Here FLAGS__ViewedFlag__c is Date/Time field(object type). Please explain me how it works.

Thanks in advance.
RPAD(
RPAD(
RPAD(
text(CASE(VALUE(TRIM(LEFT(TRIM(RIGHT(TEXT(FLAGS__ViewedFlag__c),9)),2))),
13,13,
12,13,
11,13,
10,13,
9,13,
8,13,
7,13,
6,13,
5,22,
4,22,
3,22,
2,22,
1,22,
0,22,
24,22,
23,22,
VALUE(TRIM(LEFT(TRIM(RIGHT(TEXT(FLAGS__ViewedFlag__c),9)),2)))))
,3,":"),
5,
IF(VALUE(TRIM(LEFT(TRIM(RIGHT(TEXT(FLAGS__ViewedFlag__c),9)),2)))>=22,
'00',
IF(VALUE(TRIM(LEFT(TRIM(RIGHT(TEXT(FLAGS__ViewedFlag__c),9)),2)))<13,
'00',
TRIM(RIGHT(TRIM(LEFT(TEXT(FLAGS__ViewedFlag__c),16)),2))))),8,
':00')))