• muriel
  • NEWBIE
  • 10 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 4
    Replies
HI,

I have trying to put the subquery into a second map as so:


Map<id,Case> caseToUpdate = new Map<id,Case>([select id, status,recordtypeid,Response_Time_Remaining__c,(select id , timeremaininginmins  from CaseMilestones where MilestoneType.Name like '%response%') from case where status='new' and recordtypeid='012200000005ZLF']);

Map<id,CaseMilestone> CaseMilestoneMap = new Map<id,CaseMilestone>();

for(Case tempCase:caseToUpdate){

  for(CaseMilestone cm:caseToUpdate.CaseMilestones){
 
    CaseMilestoneMap.put(cm.id,cm);
  }
}



i am getting "Compile Error: Initial term of field expression must be a concrete SObject: Map<Id,Case>" .  It is pointing to "  for(CaseMilestone cm:caseToUpdate.CaseMilestones){" .

i am pretty sure we can retrieve the subqeury and put it in a diff map...

what am i doing wrong? 
  • March 31, 2015
  • Like
  • 0
HI,

We have been implementing live agent recently in our organisation.  It works fine except when it comes to the pre chat form.

The pre chat form doesn’t pickup the value of the current user.

I have found several articles online but nothing seems to work.

When I try to retrieve the current user using ‘:UserInfo.getUserId’, I get the chat site guess account instead.

Basically the chat button lives in the customer portal.  Customer portal users need to be logged in to access the portal. 

Once they click on the chat button, it redirects them to the chat site. And somewhere along there, the login information is lost.

I was just wondering if anyone has had the same problem and if they are aware of a workaround. 

We don’t want to ask users to log in again into the chat site.  We should be able to pick this information from the customer portal, shouldn’t we?

i have tried changing the code behind the button script to something like that:

<script type='text/javascript'>
            liveagent.addCustomDetail('Contact Email', '{!liveAgentUserEmail}').map('Contact', 'Email', false, true);
            liveagent.addCustomDetail('Contact Name', '{!liveAgentUserName}').map('Contact', 'Name', true, false);
            liveagent.setName('{!liveAgentUserName}');
            liveagent.init('https://d.la7cs.salesforceliveagent.com/chat', '{!LEFT(liveChatDepId, 15)}&userId={!$User.id}', '{!LEFT($Organization.id, 15)}');

        </script>

but it doesn't do much.

Please let me know if you have any suggestions,

Thanks

This is a bit odd but i am sure there is a logical explanation....i just dont know which one...so please help if you can

basically:

in my own developer env, this code

<apex:outputLink value="{!rel.Id}" target="_blank">{!rel.casenumber}</apex:outputLink>

will produce the following URL "https://eu2.salesforce.com/500b0000005dAtVAAU".  Obviously the Id might change depending on the record selected


However in the full sandbox, the same code produces:

 https://c.cs8.visual.force.com/apex/500D000000ZF8b0IAD


it is keeping the "apex".  and the URL fails


I just need to understand why it is doing that. I could change it to a fix URL but i would like to understand why first before moving it to production


Thanks

Muriel
HI,

I am using a wrapper class to display a list of cases with checkbox.  only the selected cases should be processed

public class ParentCasestest {
    public List<cCase> related {get; set;}  
   
    public String mysearchtext {get; set;}
    public boolean selected {get; set;}
    public Case setCtrl{get; set;}
 
 
    //initialize controller
   
     public ParentCasestest(ApexPages.StandardController stdController) {
        this.setCtrl = (Case)stdController.getRecord();
    }
   

    public List <cCase> GetChildCases() {    
        if (related==null)
        {
        related = new list <cCase>();
         System.debug('the value is: '+ setCtrl.id);
        for(Case c : [select id, CaseNumber,  Subject, description, Status,UpdateChildcases__c , child_update__c, account.name from Case where parentId=:setCtrl.id])
             {
       
        related.add(new cCase(c));
             }
        }
        return related;
        }
             
     public PageReference processSelected() {
    
                    //We create a new list of Contacts that we be populated only with Contacts if they are selected
            List<Case> selectedChild = new List<Case>();
             System.debug('the value is: ');
                
            //We will cycle through our list of cContacts and will check to see if the selected property is set to true, if it is we add the Contact to the selectedContacts list
            for(cCase cCon: GetChildCases()) {
                if(cCon.selected == true) {
                    selectedChild.add(cCon.con);
                }
            }
    
            // Now we have our list of selected contacts and can perform any type of logic we want, sending emails, updating a field on the Contact, etc
            System.debug('These are the selected Contacts...');
            for(Case con: selectedChild) {
                  List<CaseComment> childCom = new List<CaseComment>();
                for(integer i=0;i<selectedChild.size();i++){

                     CaseComment newCom = new CaseComment();
                    newCom.CommentBody = mysearchtext;
                    newCom.IsPublished = TRUE;
                    newCom.ParentId = con.id;
                childCom.add(newcom);
                         }

                if(!childCom.isEmpty()){
                insert childCom;
       
                }     
            }
           
            related=null; // we need this line if we performed a write operation  because getContacts gets a fresh list now
            return null;
      }
    
    
    
    
   
    
    public class cCase {
            public Case con {get; set;}
            public Boolean selected {get; set;}
    
            //This is the contructor method. When we create a new
// object we pass a Contact that is set to the con property. We also set the selected value to false
            public cCase(Case c) {
                con = c;
                selected = false;
            }
        }
    }



visual page



<apex:page standardController="Case" extensions="ParentCasestest">
    <apex:pageBlock title="Child Cases"  />
    <apex:form >
       <apex:pageBlock >
        <apex:pageBlockButtons >         
        <apex:commandButton value="Process Selected" action="{!processSelected}" rerender="table"/>
        </apex:pageBlockButtons>
            <apex:outputLabel value="Comment" for="comment"  style="font-weight:600"/><p/>
             <apex:inputTextarea id="newDesc" value="{!mysearchtext}" rows="10" cols="150" /><p/>
        </apex:pageBlock>
       
        <apex:outputText value="this is a test" rendered="false" />
        <apex:datatable value="{!related}" var="c" width="80%">
       
     
            <apex:column headervalue="Select" width="10%">
             <apex:inputCheckbox value="{!c.selected}"/><p/>
            </apex:column>
            <apex:column headervalue="Case Number" width="30%">
                <apex:outputLink value="/{!c.con.casenumber}" target="_blank">{!c.con.casenumber}</apex:outputLink><p/>
            </apex:column>
             <apex:column headervalue="Account Name" width="30%">
                 <apex:outputLink value="/{!c.con.account.name}" target="_blank">{!c.con.account.name}</apex:outputLink><p/>
            </apex:column>
            <apex:column headervalue="Subject" width="30%">
                 <apex:outputLink value="/{!c.con.subject}" target="_blank">{!c.con.subject}</apex:outputLink><p/>
            </apex:column>           
           </apex:datatable>  

    </apex:form>
    </apex:page>


The page doesn't display anything at all. 

i must be missing something....

I have a visual force page which displays the current child cases linked to the selected parent case.

Each child case has a dedicated checkbox.

I need to be able to only add a comment to the selected child cases and not all child cases.

    <apex:outputText value="this is a test" rendered="false" />
    <apex:datatable value="{!related}" var="rel" width="80%">

    <apex:commandButton value="Save" action="{!save}"/>
        <apex:column headervalue="Select" width="10%">
         <apex:inputCheckbox value="{!rel.UpdateChildcases__c}"/><p/>
        </apex:column>
        <apex:column headervalue="Case Number" width="30%">
            <apex:outputLink value="/{!rel.Id}" target="_blank">{!rel.casenumber}</apex:outputLink><p/>
        </apex:column>
         <apex:column headervalue="Account Name" width="30%">
             <apex:outputLink value="/{!rel.Id}" target="_blank">{!rel.account.name}</apex:outputLink><p/>
        </apex:column>
        <apex:column headervalue="Subject" width="30%">
             <apex:outputLink value="/{!rel.Id}" target="_blank">{!rel.subject}</apex:outputLink><p/>
        </apex:column>           
       </apex:datatable>             

  <apex:commandButton value="Save"  action="{!Save}" />
</apex:form>
</apex:page>

The comment to be inserted is picked up from the text area

public with sharing class ParentCases { public List related {get; set;}

public String mysearchtext {get; set;}
public boolean selected {get; set;}

public ParentCases(ApexPages.StandardController std) {
    selected = false;  
    Case cs=(Case) std.getRecord();
    related=[select id, CaseNumber,  Subject, description, Status,UpdateChildcases__c , child_update__c, account.name from Case where parentId=:cs.id];
    }

public void Save(){

List<CaseComment> childCom = new List<CaseComment>();
for(integer i=0;i<related.size();i++){

     CaseComment newCom = new CaseComment();
newCom.CommentBody = mysearchtext;
newCom.IsPublished = TRUE;
newCom.ParentId = related[i].id;
childCom.add(newcom);
}

if(!childCom.isEmpty()){
insert childCom;

  }     

}}

this updates all child records. I really need to restrict the insert to the selected ones. ??
  • April 29, 2014
  • Like
  • 0
HI,

I have trying to put the subquery into a second map as so:


Map<id,Case> caseToUpdate = new Map<id,Case>([select id, status,recordtypeid,Response_Time_Remaining__c,(select id , timeremaininginmins  from CaseMilestones where MilestoneType.Name like '%response%') from case where status='new' and recordtypeid='012200000005ZLF']);

Map<id,CaseMilestone> CaseMilestoneMap = new Map<id,CaseMilestone>();

for(Case tempCase:caseToUpdate){

  for(CaseMilestone cm:caseToUpdate.CaseMilestones){
 
    CaseMilestoneMap.put(cm.id,cm);
  }
}



i am getting "Compile Error: Initial term of field expression must be a concrete SObject: Map<Id,Case>" .  It is pointing to "  for(CaseMilestone cm:caseToUpdate.CaseMilestones){" .

i am pretty sure we can retrieve the subqeury and put it in a diff map...

what am i doing wrong? 
  • March 31, 2015
  • Like
  • 0
This is a bit odd but i am sure there is a logical explanation....i just dont know which one...so please help if you can

basically:

in my own developer env, this code

<apex:outputLink value="{!rel.Id}" target="_blank">{!rel.casenumber}</apex:outputLink>

will produce the following URL "https://eu2.salesforce.com/500b0000005dAtVAAU".  Obviously the Id might change depending on the record selected


However in the full sandbox, the same code produces:

 https://c.cs8.visual.force.com/apex/500D000000ZF8b0IAD


it is keeping the "apex".  and the URL fails


I just need to understand why it is doing that. I could change it to a fix URL but i would like to understand why first before moving it to production


Thanks

Muriel
I have a visual force page which displays the current child cases linked to the selected parent case.

Each child case has a dedicated checkbox.

I need to be able to only add a comment to the selected child cases and not all child cases.

    <apex:outputText value="this is a test" rendered="false" />
    <apex:datatable value="{!related}" var="rel" width="80%">

    <apex:commandButton value="Save" action="{!save}"/>
        <apex:column headervalue="Select" width="10%">
         <apex:inputCheckbox value="{!rel.UpdateChildcases__c}"/><p/>
        </apex:column>
        <apex:column headervalue="Case Number" width="30%">
            <apex:outputLink value="/{!rel.Id}" target="_blank">{!rel.casenumber}</apex:outputLink><p/>
        </apex:column>
         <apex:column headervalue="Account Name" width="30%">
             <apex:outputLink value="/{!rel.Id}" target="_blank">{!rel.account.name}</apex:outputLink><p/>
        </apex:column>
        <apex:column headervalue="Subject" width="30%">
             <apex:outputLink value="/{!rel.Id}" target="_blank">{!rel.subject}</apex:outputLink><p/>
        </apex:column>           
       </apex:datatable>             

  <apex:commandButton value="Save"  action="{!Save}" />
</apex:form>
</apex:page>

The comment to be inserted is picked up from the text area

public with sharing class ParentCases { public List related {get; set;}

public String mysearchtext {get; set;}
public boolean selected {get; set;}

public ParentCases(ApexPages.StandardController std) {
    selected = false;  
    Case cs=(Case) std.getRecord();
    related=[select id, CaseNumber,  Subject, description, Status,UpdateChildcases__c , child_update__c, account.name from Case where parentId=:cs.id];
    }

public void Save(){

List<CaseComment> childCom = new List<CaseComment>();
for(integer i=0;i<related.size();i++){

     CaseComment newCom = new CaseComment();
newCom.CommentBody = mysearchtext;
newCom.IsPublished = TRUE;
newCom.ParentId = related[i].id;
childCom.add(newcom);
}

if(!childCom.isEmpty()){
insert childCom;

  }     

}}

this updates all child records. I really need to restrict the insert to the selected ones. ??
  • April 29, 2014
  • Like
  • 0