• Orn Ingvar
  • NEWBIE
  • 35 Points
  • Member since 2007

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 9
    Replies

Disclaimer - I have no development experiement. I have been using the canned trigger that is floating around the internet that reassigns Contacts and Opportunities to the new owner when an Account Owner is changed. I have been getting feedback from representatives in my organization that want the transfers to be for the Contacts only. I attempted to pull out the pieces of the code that involve the Opportunity but I get the following error:

 

Error: Compile Error: unexpected token: { at line 17 column 75

 

(Note I have put asteriks around the bracket the error is referring to for reference:

trigger reassignRelatedContacts on Account (after update) {
   try {
      Set<Id> accountIds = new Set<Id>(); //set for holding the Ids of all Accounts that have been assigned to new Owners
      Map<Id, String> oldOwnerIds = new Map<Id, String>(); //map for holding the old account ownerId
      Map<Id, String> newOwnerIds = new Map<Id, String>(); //map for holding the new account ownerId
      Contact[] contactUpdates = new Contact[0]; //Contact sObject to hold OwnerId updates
      
      for (Account a : Trigger.new) { //for all records
         if (a.OwnerId != Trigger.oldMap.get(a.Id).OwnerId) {
            oldOwnerIds.put(a.Id, Trigger.oldMap.get(a.Id).OwnerId); //put the old OwnerId value in a map
            newOwnerIds.put(a.Id, a.OwnerId); //put the new OwnerId value in a map
            accountIds.add(a.Id); //add the Account Id to the set
         }
      }
      
      if (!accountIds.isEmpty()) { //if the accountIds Set is not empty
         for (Account act : [SELECT Id, (SELECT Id, OwnerId FROM Contacts) **{** //SOQL to get Contacts for updated Accounts
            String newOwnerId = newOwnerIds.get(act.Id); //get the new OwnerId value for the account
            String oldOwnerId = oldOwnerIds.get(act.Id); //get the old OwnerId value for the account
            for (Contact c : act.Contacts) { //for all contacts
               if (c.OwnerId == oldOwnerId) { //if the contact is assigned to the old account Owner
                  Contact updatedContact = new Contact(Id = c.Id, OwnerId = newOwnerId); //create a new Contact sObject
                  contactUpdates.add(updatedContact); //add the contact to our List of updates
               }
          }
         update contactUpdates; //update the Contacts
      }
   } catch(Exception e) { //catch errors
      System.Debug('reassignRelatedContacts failure: '+e.getMessage()); //write error to the debug log
   }
}

 

The bracket in question has an end bracket, which is what is confusing. Where am I making a mistake?

Hi,

 

I created a visualforce page which I use as a cloud component to display all cases that belong to an account. Its pretty simple and it works fine in Firefox but in Chrome I'm unable to get the links to work with the console. The chrome developer console gives an error : srcUp is not defined

 

My Page :

<apex:page standardController="Contact" extensions="VF_AccountCaseOverview" showHeader="false" sidebar="false">
	<apex:form >
        <apex:pageBlock id="caseOverViewPageBlock" >        	
            <apex:pageBlockTable value="{!CasesForConsumerAccountMembers}" var="cas">
        		<apex:column headerValue="Case Number">
                    <apex:outputLink id="casid" value="/{!cas.Id}?isdtp=vw" target="_parent">{!cas.CaseNumber}</apex:outputLink>
                </apex:column>        
                <apex:column headerValue="Contact">
                    <apex:outputLink id="conid" value="/{!cas.ContactId}" target="_parent">{!cas.Contact.Name}</apex:outputLink>
                </apex:column>                                        
                <apex:column headerValue="Subject" value="{!cas.Subject}"></apex:column>
                <apex:column headerValue="Record Type" value="{!cas.RecordType.Name}"></apex:column>
                <apex:column headerValue="Date/Time Opened" value="{!cas.CreatedDate}"></apex:column>
                <apex:column headerValue="Last Modified Date/Time" value="{!cas.LastModifiedDate}"></apex:column> 
                <apex:column headerValue="Owner" value="{!cas.Owner.Name}"></apex:column>
                <apex:column headerValue="Status" value="{!cas.Status}"></apex:column>              
           </apex:pageBlockTable> 
  		</apex:pageBlock>   		       
    </apex:form>
</apex:page>

Notice that I have one link with the ?isdtp=vw but it seems to make no difference and I've tried both with and without it. 

 

Controller :

public with sharing class VF_AccountCaseOverview {
	
	private final Contact con;
	public list<Case> caseLst {get; set;} 
	
	public VF_AccountCaseOverview(ApexPages.StandardController stdController){
		this.con = (Contact)stdController.getRecord();
		Contact cont = [Select Id, AccountId, kennitala__c from Contact WHERE Id =: con.Id];		
		List<Contact> conList = [Select Id, FirstName, LastName, kennitala__c FROM Contact 
		 							WHERE AccountId =: cont.AccountId];	
		 					
		List<Id> idList = new List<Id>();
		
		for (Contact c : conList)
		{
			idList.add(c.Id);
		}
		caseLst = [SELECT Id, ContactId, Contact.Name, AccountId, CaseNumber, Subject, RecordType.Name, CreatedDate, LastModifiedDate, Owner.Name, Status 
							FROM Case 
							WHERE ContactId in :idList
							ORDER BY CaseNumber DESC];
	}
					
	public Case[] getCasesForConsumerAccountMembers(){
		return caseLst;
	}
}

 When I click the Case Number or Contact Name in Firefox it displays in a tab which i what I want but nothing happens in Chrome except this srcUp is not defined error. The strange thing is that I have another Visualforce page which is almost exactly the same displaying a list of service the customer has using almost the exact same code and that works fine in both browsers.

 

Any help appreciated. 

Thanks

Orn

 

Recently I enabled Case Feeds for the Service Cloud Console and after doing so I keep getting a maximum trigger depth exceeded for a CaseComment trigger I'm using to count the number of Case Comments on each case. The strange thing is that I only get this exception if I use the Internal Comments field on Cases and edit some other record at the same time.

 

Before I enabled Case Feeds this trigger ran fine without any problems under the same circumstance. I'm a little bit lost with this since I don't understand why the trigger depth should be exceeded only when I edit the case and create a comment at the same time.

 

Here is my code

 

	public void OnAfterInsert(CaseComment[] newCaseComments){
		for(CaseComment newCaseComment : newCaseComments)
		{
			//Get the parent Case Ids into a set
			caseIdSet.add( newCaseComment.ParentId );			
		}
		caseLst = [select Id from Case where Id in: caseIdSet];			
				
		AggregateResult cc_count = [select count(Id) total from CaseComment where ParentId in: caseLst];
		for(Case c: caseLst)
		{
			c.nmb_CaseCommentCount__c = (Integer)cc_count.get('total');			
		}		
		
			try
			{
				update caseLst;
			}
			catch( DmlException e)
			{
				Util_ExceptionObject.createErrorRecord('CaseCommentTriggerHandler', e.getMessage() ); 
			}
						
	}

 


I've gone through the VPM implementation guide and gotten the examples from that to work correctly but when I try to create a dropdown list with two values and use those values in a decision it always returns me to the same screen no matter what I select from the dropdown. I feel like I'm missing something very obvious but all the examples I can find use radio buttons with was selected and true/false globals.

Hi all,

Is it possible to create a validation rule that stops a user from changing the owner of a Case if a certain picklist value has been selected ?

Basicly I want to make sure that the case is closed by the user if that picklist value is used.

cheers,
Orn

Hi,

 

I created a visualforce page which I use as a cloud component to display all cases that belong to an account. Its pretty simple and it works fine in Firefox but in Chrome I'm unable to get the links to work with the console. The chrome developer console gives an error : srcUp is not defined

 

My Page :

<apex:page standardController="Contact" extensions="VF_AccountCaseOverview" showHeader="false" sidebar="false">
	<apex:form >
        <apex:pageBlock id="caseOverViewPageBlock" >        	
            <apex:pageBlockTable value="{!CasesForConsumerAccountMembers}" var="cas">
        		<apex:column headerValue="Case Number">
                    <apex:outputLink id="casid" value="/{!cas.Id}?isdtp=vw" target="_parent">{!cas.CaseNumber}</apex:outputLink>
                </apex:column>        
                <apex:column headerValue="Contact">
                    <apex:outputLink id="conid" value="/{!cas.ContactId}" target="_parent">{!cas.Contact.Name}</apex:outputLink>
                </apex:column>                                        
                <apex:column headerValue="Subject" value="{!cas.Subject}"></apex:column>
                <apex:column headerValue="Record Type" value="{!cas.RecordType.Name}"></apex:column>
                <apex:column headerValue="Date/Time Opened" value="{!cas.CreatedDate}"></apex:column>
                <apex:column headerValue="Last Modified Date/Time" value="{!cas.LastModifiedDate}"></apex:column> 
                <apex:column headerValue="Owner" value="{!cas.Owner.Name}"></apex:column>
                <apex:column headerValue="Status" value="{!cas.Status}"></apex:column>              
           </apex:pageBlockTable> 
  		</apex:pageBlock>   		       
    </apex:form>
</apex:page>

Notice that I have one link with the ?isdtp=vw but it seems to make no difference and I've tried both with and without it. 

 

Controller :

public with sharing class VF_AccountCaseOverview {
	
	private final Contact con;
	public list<Case> caseLst {get; set;} 
	
	public VF_AccountCaseOverview(ApexPages.StandardController stdController){
		this.con = (Contact)stdController.getRecord();
		Contact cont = [Select Id, AccountId, kennitala__c from Contact WHERE Id =: con.Id];		
		List<Contact> conList = [Select Id, FirstName, LastName, kennitala__c FROM Contact 
		 							WHERE AccountId =: cont.AccountId];	
		 					
		List<Id> idList = new List<Id>();
		
		for (Contact c : conList)
		{
			idList.add(c.Id);
		}
		caseLst = [SELECT Id, ContactId, Contact.Name, AccountId, CaseNumber, Subject, RecordType.Name, CreatedDate, LastModifiedDate, Owner.Name, Status 
							FROM Case 
							WHERE ContactId in :idList
							ORDER BY CaseNumber DESC];
	}
					
	public Case[] getCasesForConsumerAccountMembers(){
		return caseLst;
	}
}

 When I click the Case Number or Contact Name in Firefox it displays in a tab which i what I want but nothing happens in Chrome except this srcUp is not defined error. The strange thing is that I have another Visualforce page which is almost exactly the same displaying a list of service the customer has using almost the exact same code and that works fine in both browsers.

 

Any help appreciated. 

Thanks

Orn

 

The Live Agent Developer's Guide has a section on "Customizing Chat Windows", which is awesome. I'm really glad that we have the ability to build a custom window using Visualforce components and HTML/CSS!

 

However, there seems to be a piece missing in that section, unless I just missed it. 

 

The section tells us how to build a custom window but it doesn't seem to indicate how to hook it up to our deployment. Therefore, how do we tell our deployment to use the custom Live Agent Chat Window?

 

Thanks!

 

///eks

Hello,

 

Has anyone found actual documentation for creating visualflow apex plugins? I'm trying to finish my test script for a plugin i created but i cannot figure out how to test the invoke() and describe() methods.

 

Thank you in advance for your help.

Disclaimer - I have no development experiement. I have been using the canned trigger that is floating around the internet that reassigns Contacts and Opportunities to the new owner when an Account Owner is changed. I have been getting feedback from representatives in my organization that want the transfers to be for the Contacts only. I attempted to pull out the pieces of the code that involve the Opportunity but I get the following error:

 

Error: Compile Error: unexpected token: { at line 17 column 75

 

(Note I have put asteriks around the bracket the error is referring to for reference:

trigger reassignRelatedContacts on Account (after update) {
   try {
      Set<Id> accountIds = new Set<Id>(); //set for holding the Ids of all Accounts that have been assigned to new Owners
      Map<Id, String> oldOwnerIds = new Map<Id, String>(); //map for holding the old account ownerId
      Map<Id, String> newOwnerIds = new Map<Id, String>(); //map for holding the new account ownerId
      Contact[] contactUpdates = new Contact[0]; //Contact sObject to hold OwnerId updates
      
      for (Account a : Trigger.new) { //for all records
         if (a.OwnerId != Trigger.oldMap.get(a.Id).OwnerId) {
            oldOwnerIds.put(a.Id, Trigger.oldMap.get(a.Id).OwnerId); //put the old OwnerId value in a map
            newOwnerIds.put(a.Id, a.OwnerId); //put the new OwnerId value in a map
            accountIds.add(a.Id); //add the Account Id to the set
         }
      }
      
      if (!accountIds.isEmpty()) { //if the accountIds Set is not empty
         for (Account act : [SELECT Id, (SELECT Id, OwnerId FROM Contacts) **{** //SOQL to get Contacts for updated Accounts
            String newOwnerId = newOwnerIds.get(act.Id); //get the new OwnerId value for the account
            String oldOwnerId = oldOwnerIds.get(act.Id); //get the old OwnerId value for the account
            for (Contact c : act.Contacts) { //for all contacts
               if (c.OwnerId == oldOwnerId) { //if the contact is assigned to the old account Owner
                  Contact updatedContact = new Contact(Id = c.Id, OwnerId = newOwnerId); //create a new Contact sObject
                  contactUpdates.add(updatedContact); //add the contact to our List of updates
               }
          }
         update contactUpdates; //update the Contacts
      }
   } catch(Exception e) { //catch errors
      System.Debug('reassignRelatedContacts failure: '+e.getMessage()); //write error to the debug log
   }
}

 

The bracket in question has an end bracket, which is what is confusing. Where am I making a mistake?

I'm trying to incorporate a jQuery Accordion (http://jqueryui.com/demos/accordion/) in a Visualforce page but it comes out garbled (see screenshot):

 

Garbled output

 

If I remove the standard stylesheets (standardstylesheets="false") and header (showheader="false") it comes out as I'd want it to (see screenshot):

Nice output

Problem is, I have other things on the page that needs the standard stylesheets.


How would I define the accordion so that it plays nice inside of a standard stylesheets Visualforce page?

I'm thinking I need to override some styles, but I can't figure out what/how.

 

Here's a short version of the page with just the accordion part:

<apex:page cache="false" expires="0" sidebar="false" >
    <apex:includeScript value="{!URLFOR($Resource.jquery, '/js/jquery-1.7.1.min.js')}"  />
    <apex:includeScript value="{!URLFOR($Resource.jquery, '/js/jquery-ui-1.8.18.custom.min.js')}"  />
    <apex:stylesheet value="{!URLFOR($Resource.jquery, '/css/ui-lightness/jquery-ui-1.8.18.custom.css')}"  />

    <script>
        $j = jQuery.noConflict();

        $j(document).ready(function($)
        {
            $j("#SFDCSalesPanel").accordion();
        });
    </script>

    <apex:pageBlock id="playBlock" >
        <div id="SFDCSalesPanel">
            <h3><a href="#">Header 1</a></h3>
            <div>Content 1</div>
            <h3><a href="#">Header 2</a></h3>
            <div>Content 2</div>
            <h3><a href="#">Header 3</a></h3>
            <div>Content 3</div>
        </div>
    </apex:pageBlock>
</apex:page>

 

I've gone through the VPM implementation guide and gotten the examples from that to work correctly but when I try to create a dropdown list with two values and use those values in a decision it always returns me to the same screen no matter what I select from the dropdown. I feel like I'm missing something very obvious but all the examples I can find use radio buttons with was selected and true/false globals.