• Navees Ahmed
  • NEWBIE
  • 35 Points
  • Member since 2014

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
Hello,

I have a multi picklist called Product Focus which contains 70 products.  Based on the product focus selection I have a trigger which will check off various checkboxes.

I was wondering how I could update my trigger so when a user deselects a product focus from the multi pick list, the corresponding checkbox will be unchecked.
public void getProductFocusValues(Account[] oldAccount, Account[] updatedAccount, Map<ID, Account> oldAccountMap)
	{		
		for(Account acc : updatedAccount)
		{
			List<String> productFocusSplit = new list<String>();
			map<string,string> productFocusPrefix = new map<string,string>();
			if(acc.ProductFocus__c != null)
			{
				productFocusSplit = Util.CleanSplit(acc.ProductFocus__c,';');
			}
			
			if(productFocusSplit.size() > 0)
			{			
				for(string pfs :productFocusSplit)
				{
					system.debug('pfs.substring(0,2)='+pfs.substring(0,2));
					productFocusPrefix.put(pfs.substring(0,2),pfs.substring(0,2));
				}
			}
			if(productFocusPrefix.size()>0)
			{
				for(string pfprefix :productFocusPrefix.keyset())
				{
					if(pfprefix == 'BP')
					{
						acc.BPM__c = true;
					}
					else if(pfprefix == 'CE')
					{
						acc.CEM__c = true;
					}
					else if(pfprefix == 'CL')
					{
						acc.Cloud__c = true;
					}
					else if(pfprefix == 'DI')
					{
						acc.Discovery__c = true;
					}
					else if(pfprefix == 'PO')
					{
						acc.Portfolio__c = true;
					}
					else if(pfprefix == 'EC')
					{
						acc.ECM__c = true;
					}
					else if(pfprefix == 'MS')
					{
						acc.MSFT__c = true;
					}						
					else if(pfprefix == 'SA')
					{
						acc.SAP__c = true;
					}	
					else if(pfprefix == 'IX')
					{
						acc.IX__c = true;
					}	
																					
				}
				
			}
		}
		
	}
Thanks!


Hello,

I have a multi picklist called Product Focus which contains 70 products.  Based on the product focus selection I have a trigger which will check off various checkboxes.

I was wondering how I could update my trigger so when a user deselects a product focus from the multi pick list, the corresponding checkbox will be unchecked.
public void getProductFocusValues(Account[] oldAccount, Account[] updatedAccount, Map<ID, Account> oldAccountMap)
	{		
		for(Account acc : updatedAccount)
		{
			List<String> productFocusSplit = new list<String>();
			map<string,string> productFocusPrefix = new map<string,string>();
			if(acc.ProductFocus__c != null)
			{
				productFocusSplit = Util.CleanSplit(acc.ProductFocus__c,';');
			}
			
			if(productFocusSplit.size() > 0)
			{			
				for(string pfs :productFocusSplit)
				{
					system.debug('pfs.substring(0,2)='+pfs.substring(0,2));
					productFocusPrefix.put(pfs.substring(0,2),pfs.substring(0,2));
				}
			}
			if(productFocusPrefix.size()>0)
			{
				for(string pfprefix :productFocusPrefix.keyset())
				{
					if(pfprefix == 'BP')
					{
						acc.BPM__c = true;
					}
					else if(pfprefix == 'CE')
					{
						acc.CEM__c = true;
					}
					else if(pfprefix == 'CL')
					{
						acc.Cloud__c = true;
					}
					else if(pfprefix == 'DI')
					{
						acc.Discovery__c = true;
					}
					else if(pfprefix == 'PO')
					{
						acc.Portfolio__c = true;
					}
					else if(pfprefix == 'EC')
					{
						acc.ECM__c = true;
					}
					else if(pfprefix == 'MS')
					{
						acc.MSFT__c = true;
					}						
					else if(pfprefix == 'SA')
					{
						acc.SAP__c = true;
					}	
					else if(pfprefix == 'IX')
					{
						acc.IX__c = true;
					}	
																					
				}
				
			}
		}
		
	}
Thanks!