• Shiva Ramesh @ xcdhr
  • NEWBIE
  • 198 Points
  • Member since 2012
  • Salesforce Developer
  • XCD HR: Global HR Software & Solutions


  • Chatter
    Feed
  • 6
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 3
    Questions
  • 88
    Replies
HI,
I'm getting error"Too many SOQL queries: 101" in line User user1 = [Select id, Profile.Name from User where Id= :UserInfo.getUserId() ]; of code below :-
I have highlighted the line below.

//Method added for Sending AFD to Siebel
  if(trigger.isBefore && trigger.isUpdate){
    Set<String> caOwnerId = new Set<String>();
    Map<Id,User> ownerRole = new Map<Id,User>();
    String s_profile = null; //Addition for Defect 13928
    for(Credit_Approval__c ca:trigger.new){
        caOwnerId.add(ca.OwnerId);
    } 
    if(caOwnerId.size()>0){
        ownerRole = new Map<Id,User>([select id,UserRole.Name from User where id = :caOwnerId]);  
    }
     
        User user1 = [Select id, Profile.Name from User where Id= :UserInfo.getUserId() ];
        s_profile = user1.Profile.Name;
     for(Credit_Approval__c ca:trigger.new){
         
          if(OwnerRole.get(ca.OwnerId)!=null && !'GE Integration User'.equalsIgnoreCase(s_profile)){
          //if(OwnerRole.get(ca.OwnerId)!=null{
                   if(OwnerRole.get(ca.OwnerId).UserRole!=null && OwnerRole.get(ca.OwnerId).UserRole.Name.contains('HFS')&& OwnerRole.get(ca.OwnerId).UserRole.Name.contains('Zone')){// HFS Project Change - Add null check
              ca.Flow_Struc__c = 'Flow';
            }
            if(OwnerRole.get(ca.OwnerId).UserRole!=null && OwnerRole.get(ca.OwnerId).UserRole.Name.contains('HFS')&& !OwnerRole.get(ca.OwnerId).UserRole.Name.contains('Zone')){// HFS Project Change - Add null check
              ca.Flow_Struc__c = 'Structured';
            }       
          }  
    }
  }


}



Can you please help me out on this to acheive this.
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;
    }
}

Hello,

 

Basically what I am trying to do is make it so when an opportunity is transfered to a different owner, the associated tasks with that opportunity are also transfered to the new owner. The problem I have is I get a list of the opportunities to transfer, then for each of those opportunities I get a list of the tasks and then I try to move everything over. However I get this error and I am not sure how to handle the error outside of the outer loop.

 

For(All Opportunities to Update Owner)

{

    For(All Tasks of Opporunitiy)

          Change Owner)

{

I have a requirement where in I create some contact records which should not visible to anyone except 2 people.  We have territory based role heirarchy We have CEO1 and CEO2 at same level .Also we have 3 different system admin profiles which have view all and modify all permission . I tried to create a new object (as these need not part of the system) but I guess Modify all and View all will make it visible to all who have this permission .

I am not an expert on this , it could be small thing which I am not aware may be . Any suugestions would be helpful. 

Hi Experts,

 

I am implementing SSO, where both the identity Provider and Service Provider are my different- different developer org. I have done all the setup and following this:

http://wiki.developerforce.com/page/Implementing_Single_Sign-On_Across_Multiple_Organizations

 

I am adding  service provider in Identuty provider Org by  using connected app, But I am not able to see the Service Provider listed under Identity Provider.

 

Please help me.

 

Regards,

Prashant

Hi,

 

I have created a custom mandatory field for Opportunity object.

 

When i tried to convert leads in the system it is throwing below error.

 

Error: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Test]: [Test] (System Code)

 

Please suggest whet can be done here...

 

Regards,

Prasanth.

I have a record whose id (let's say "https://cs5.salesforce.com/006O0000003Jd6R" ) needs to be extracted and stored in a field of the same record everytime a new record is created and the same should happen if an old record is edited and saved.

How do I go about doing that.

Pls help.

 

page:

 

<apex:form id ="myForm">
<apex:inputHidden value="{!value1}" id="theHiddenInput"/>
<apex:commandLink value="Save" action="{!save}"/>
<script>
document.getElementById('{!$Component.myForm.theHiddenInput}').value= "lalala";
</script>

 

controller:

public String value1{get;set;}
public PageReference save(){ system.debug('invalue1 ' + value1); return null; }

 

 

question:

when i try to submit this form about 30 times, i will meet the value1's value in log is empty 1 time, and also use fiddler to watch form data, also found the theHiddenInput's value is empty. why? a low percentage to lost the hiddeninput value? anyonu meet this issue before?

 

tks

 

what is difference between case and solution.what are advantages.could u tel me mini project.....

Hi,

 I have created a manage package, in which I am displaying chatter feeds for login user. I want this feeds need to be displayed for only community user not for portal user, so i want to hide the component for portal users. So how can I identify is the loged in user is a community user or portal user.

 

Thanks 

Anu

Hi,

 

I have a visualforce page and a outputpanel on it. I need to render the page without refreshing the page. See below for the code.

 

Visualforce page:

<apex:page controller="SchedulerHomePageController">  
  <style>h3 { color: black; font-size: 16px; }</style>
  <apex:form >
   <apex:actionFunction name="send" action="{!renderAppointmentScreen}" reRender="none">
     <apex:param name="p1" assignto="{!expertId}" value=""/>
   </apex:actionFunction>
   
    <apex:outputpanel id="selectText">
      <apex:outputpanel rendered="{!disableExperts}" id="selectPub1">
      <h2><apex:outputText value="Name of the Service" escape="false"/></h2>
        <apex:selectRadio layout="pageDirection" value="{!selectedService}">
          <apex:selectOption itemValue="1" itemLabel="service 1<br/><div style='font-size: 14px; padding-left: 25px;'>Service description 1</div>" itemEscaped="false" />  
          <apex:selectOption itemValue="2" itemLabel="Service 2<br/><div style='font-size: 14px; padding-left: 25px;'>Service description 2</div>" itemEscaped="false" />
          <apex:selectOption itemValue="3" itemLabel="Service 3<br/><div style='font-size: 14px; padding-left: 25px;'>Service description 3</div>" itemEscaped="false" />
        </apex:selectRadio>
         <div align="center">
            <apex:commandLink styleClass="button" action="{!redirectToServiceType}" rerender="selectText,selectValues">
                <span><apex:outputText value="Submit" escape="false"/></span>
            </apex:commandLink>
      </apex:outputpanel>
      </apex:outputpanel>

      <apex:outputPanel id="selectValues">
       <apex:outputpanel rendered="{!enableExperts}" id="selectPub2">
        <div>
        <tr>
            <apex:repeat value="{!experts}" var="expert">
            <td>
                <p><apex:outputField value="{!expert.Image__c}" /></p>
                <apex:commandLink onclick="send('{!expert.Id}')" style="color:blue;text-decoration:underline" rerender="appScreen"><h4>{!expert.Name}</h4>
                </apex:commandLink>                
             </td><td width="100px"></td>
            </apex:repeat>
          </tr>
        </div>
       </apex:outputpanel>
       </apex:outputPanel>
       
      <apex:outputPanel id="appScreen">
       <apex:outputPanel rendered="{!enableAppScreen}">
        <h4> Appointment Screen </h4>
       </apex:outputPanel>
      </apex:outputPanel>
  </apex:form>
</apex:page>

Controller:

public without sharing class SchedulerHomePageController {
    public Theme__c theme {get;set;}
    public String selectedService {get;set;}
    public boolean enableExperts {get;set;}
    public boolean disableExperts {get;set;}
    public boolean enableAppScreen {get;set;}
    public String expertId {get;set;}
    public List<Experts__c> experts = new List<Experts__c>();
    
    public SchedulerHomePageController(){
            disableExperts = true;
            enableExperts = false;     
            enableAppScreen = false;
    }
        
    public string getselectedService(){
        return selectedService;
    }
            
    public List<Experts__c> getExperts() {
        List<ID> ExpertIds = ExpertUtils.getExpertIdsForUser(UserInfo.getUserId());
        
        if(selectedService == '1'){
            Experts =
              [SELECT
                Id,
                Name,
                Description__c,
                Expert_Bio__c,
                Image__c,
                Service_One__c,
                Service_Two__c,
                Service_Three__c,
                User__c
              FROM
                Experts__c
              WHERE
                is_active__c = true
              AND
                Service_One__c = true
              AND
                User__c in :Expertds
              ORDER By
                User__r.LastName];
        }
        
        if(selectedService == '2'){
           experts =
              [SELECT
                Id,
                Name,
                Description__c,
                Expert_Bio__c,
                Image__c,
                Service_One__c,
                Service_Two__c,
                Service_Three__c,
                User__c
              FROM
                Experts__c
              WHERE
                is_active__c = true
              AND
                Service_Two__c = true
              AND
                User__c in :ExpertIds
              ORDER By
                User__r.LastName];
        }
        
        if(selectedService == '3'){
            experts =
              [SELECT
                Id,
                Name,
                Description__c,
                Expert_Bio__c,
                Image__c,
                Service_One__c,
                Service_Two__c,
                Service_Three__c,
                User__c
              FROM
                Experts__c
              WHERE
                is_active__c = true
              AND
                Service_Three__c = true
              AND
                User__c in :ExpertIds
              ORDER By
                User__r.LastName];
        }
        return experts;
    }
    public void redirectToServiceType(){
        disableExperts = false;
        enableExperts = true;
        enableAppScreen = false;
    }
    
    public PageReference renderAppointmentScreen(){
        system.debug('expertId is ***:'+expertId);
        disableExperts = false;
        enableExperts = false;
        enableAppScreen = true;
        system.debug('enableAppScreen*****:::'+enableAppScreen);
        system.debug('disableExperts*****:::'+disableExperts);
        return null;
    }
}

 

 

The last outputpanel(<apex:outputPanel id="appScreen">) is not rendering. Can some one guide me what mistakes I am doing here?

 

Thanks.

Hi ,

 

 

I am using a barseries in my page, and i want to reset the highlightColor and highlightStroke color of the bar.

 

I tried it with using the below syntax:

 

  <apex:barSeries orientation="vertical" axis="bottom" xField="month" yField="average" title="Avg SLA" highlight="true" highlightStroke="rgb(206,222,29)" highlightColor="rgb(206,222,29)" />

 

But it is not working,still it is using the default color.

 

Any one experienced the same problem? Please help me with this.. Urgent..

Hi,

Please provide some help on this.

I need to bring standard links (chatter tab and their links - feeds, people, group, files, topic) into our custom page.

Currently we are planning to include the chatter tab into our custom page using iframe. But unfortunatley the usage of iframe had been blocked in our production enviroment. So could you please provide some idea how we can proceed this wiht other alternative?

 

Thanks, Preya