• VishalNickName
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
I am trying to setup the reputation levels in our community. It works fine for all chatter posts. But, the user is not rewarded for any activity in Q&A. Not sure what is wrong Any help appreciated.
<apex:page standardController="Restaurant_Supp_App__c" showHeader="true">
<head>
    <link rel="stylesheet" type="text/css" href="https://www.insynergyconnect.com/tables.css"/>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" ></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
    <script>
        var j$ = jQuery.noConflict();
        j$(document).ready(function() {
        });
        j$(function() {
            j$("#show").click(function(){
                 j$("#protection").show("slow");
            });
            j$("#hide").click(function() {
                 j$("#protection").hide("slow");
             });
            j$("#toggle").click(function() {
                j$("#protection").toggle("slow");
             });
          });
    </script>
</head>
<body>
    <p>
    What about this style
    </p>
    <apex:form >
        <div id="protection">
        <table align="center" id="bldgprotect">
            <caption>
                Common Protection Questions
            </caption>
          <tr>
            <td id="question">Are any Banquets or Functions?</td>
            <td id="answer"><apex:inputfield value="{!Restaurant_Supp_App__c.Lodging_Banquet_or_Function__c}"/></td>
            <td id="question">Is the lodging area sprinkled?</td>
            <td id="answer"><apex:inputfield value="{!Restaurant_Supp_App__c.Lodging_Area_Sprinklered__c}"/></td>
          </tr>
          <tr>
            <td id="question">Describe Banquets And Functions</td>
            <td id="answer"><apex:inputfield value="{!Restaurant_Supp_App__c.Lodging_Describe_Banquet_or_Functions__c}"/></td>
            <td id="question">Does emergency lighting exist?</td>
            <td id="answer"><apex:inputfield value="{!Restaurant_Supp_App__c.Lodging_Does_Emergency_Lighting_Exist__c}"/></td>
          </tr>
          <tr>
            <td id="question">Does each room have smoke detectors?</td>
            <td id="answer"><apex:inputfield value="{!Restaurant_Supp_App__c.Lodging_Ea_Room_Smoke_Detectors__c}"/></td>
            <td id="question">Are evacuation routes well marked?</td>
            <td id="answer"><apex:inputfield value="{!Restaurant_Supp_App__c.Lodging_Evac_Routes__c}"/></td>
          </tr>
          <tr>
            <td id="question">Is there a second means of egress?</td>
            <td id="answer"><apex:inputfield value="{!Restaurant_Supp_App__c.Lodging_Second_Means_Egress__c}"/></td>
            <td id="question">Are evacuation routes well marked?</td>
            <td id="answer"><apex:inputfield value="{!Restaurant_Supp_App__c.Lodging_Evac_Routes__c}"/></td>
          </tr>
          <tr>
            <td id="question">Describe the security for lodging:</td>
            <td id="answer"><apex:inputfield value="{!Restaurant_Supp_App__c.Lodging_Security__c}"/></td>
            <td id="question">Are smoke detectors in common areas?</td>
            <td id="answer"><apex:inputfield value="{!Restaurant_Supp_App__c.Lodging_Smoke_Det_Common_Areas__c}"/></td>
          </tr>
          <tr>
            <td id="question">What type of smoke detectors?</td>
            <td id="answer"><apex:inputfield value="{!Restaurant_Supp_App__c.Lodging_Smoke_Det_Type__c}"/></td>
            <td id="question">Are smoke detectors in common areas?</td>
            <td id="answer"><apex:inputfield value="{!Restaurant_Supp_App__c.Lodging_Smoke_Det_Common_Areas__c}"/></td>
          </tr>
        </table>
        </div>
        <p>
        </p>
        <div align="center">
            <button id="show">Show</button>
            <button id="hide">Hide</button>
            <button id="toggle">Toggle</button>
        </div>
    </apex:form>
</body>
</apex:page>
I have a SOQL limit problem which I'm not sure how to fix,  it concerns this class but I've tried to make it with lists and maps so the SOQL limit wouldn't exceed. And it's only that underlined part which doesn't work .

public class UpdateMainAccountTechnologyList
{  
    public Boolean UpdateList(Account acc)
    {
        Boolean hasPolycom = false;
        Boolean hasDS = false;
        Boolean hasCisco = false;
        Boolean hasVidyo = false;
       
        List<String> codecdetails = new List<String>();
       
        List<String> polycoms = new List<String>();
        polycoms.add('Polycom');
        polycoms.add('HDX');
        polycoms.add('VSX');
        polycoms.add('QDX');
        polycoms.add('Group');
       
        List<String> vidyos = new List<String>();
        vidyos.add('Vidyo');
        vidyos.add('HD50');
        vidyos.add('HD100');
        vidyos.add('HD200');
       
        List<String> ciscos = new List<String>();
        ciscos.add('Cisco');
        ciscos.add('Cx');
        ciscos.add('Cxx');
        ciscos.add('EXxx');
        ciscos.add('MXxx');
        ciscos.add('SXxx');
        ciscos.add('MXP');
        ciscos.add('Profile');
       
        List<String> signages = new List<String>();
        signages.add('Signage');
       
        List<Asset__c> assets = [select Codec_Model__c, Codec_Details__c from Asset__c where Setup__c in (select Id from Setup__c Where Main_Account__c = :acc.Name and RecordType.Name != 'Infra') and (Codec_Model__c != null or Codec_Details__c != null)];
        for(Asset__c assetti : assets)
        {
            codecdetails.add(assetti.Codec_Model__c + ' : ' + assetti.Codec_Details__c);
        }
           
        List<Setup__c> setupit = [select Platform_Manufacturer__c, Name, RelatedMCU__c from Setup__c where Main_Account__c = :acc.Name];
        List<Setup__c> infrasetupit = [select Id, Platform_Manufacturer__c from Setup__c where Platform_Manufacturer__c != null];
       
         // Mika R 2013-Dec-13: Map the infra setups
        Map<Id, String> infraSetupMap = New Map<Id, String>();
        for (Setup__c s: infrasetupit) if (!infraSetupMap.containsKey(s.Id)) infraSetupMap.put(s.Id, s.Platform_Manufacturer__c);
       
        for(Setup__c setuppi : setupit)
        {
            if(setuppi.Platform_Manufacturer__c != null)
            {
                codecdetails.add(setuppi.Platform_Manufacturer__c);
            }
            //if the account has only virtual meeting rooms, we must find setup that has vmr as related mcu and find in what platform that vmr is
            if(setuppi.RelatedMCU__c != null)
            {
                // Mika R 2013-Dec-13: Fetch infra from map
                if (infraSetupMap.containsKey(setuppi.RelatedMCU__c)) codecdetails.add(infraSetupMap.get(setuppi.RelatedMCU__c));
              
                //Setup__c MCUSetup = [select Platform_Manufacturer__c from Setup__c where Id = :setuppi.RelatedMCU__c];              
                /*
                if(MCUSetup.Platform_Manufacturer__c != null)
                {
                    codecdetails.add(MCUSetup.Platform_Manufacturer__c);
                }
                */
            }
        }

        for(String detail : codecdetails)
        {
             for(String polycom : polycoms)
             {
                 if(detail.contains(polycom))
                 {
                     hasPolycom = true;
                     break;
                 }
             }
               
            for(String vidyo : vidyos)
            {
                if(detail.contains(vidyo))
                {
                    hasVidyo = true;
                    break;
                }
            }
               
            for(String cisco : ciscos)
            {
                if(detail.contains(cisco))
                {
                    hasCisco = true;
                    break;
                }
            }
              
            for(String signage : signages)
            {
                if(detail.contains(signage))
                {
                    hasDS = true;
                    break;
                }
            }         
        }
            
        String accountData = acc.Service_Type_List__c;

        if(hasPolycom)
        {
            if(String.isBlank(accountData))
            {
                accountData = 'Polycom';
            }
            else if(!accountData.contains('Polycom'))
            {
                accountData += ';Polycom';
            }
        }
           
        if(hasVidyo)
        {
            if(String.isBlank(accountData))
            {
                accountData = 'Vidyo';
            }
            else if(!accountData.contains('Vidyo'))
            {
                accountData += ';Vidyo';
            }
        }
               
        if(hasCisco)
        {
            if(String.isBlank(accountData))
            {
                accountData = 'Cisco';
            }
            else if(!accountData.contains('Cisco'))
            {
                accountData += ';Cisco';
            }
        }
        if(hasDS)
        {
            if(String.isBlank(accountData))
            {
                accountData = 'DS';
            }
            else if(!accountData.contains('DS'))
            {
                accountData += ';DS';
            }
        }
           
        acc.Service_Type_List__c = accountData;
        update acc;
        return true;
    }
}
  • January 02, 2014
  • Like
  • 0