• Fippy
  • NEWBIE
  • 10 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 16
    Replies

Hello all,

 

A recent SF update broke some of our legacy custom code for adding attachments to our custom comment system that replaces the vanilla SF one. Here's the error:

 

List has no rows for assignment to SObject 

Error is in expression '{!processSelectedFiles}' in component <apex:page> in page comment_files

 

I can't find any reference to processSelectedFiles in our code or on the Developer Force pages, but am assuming this has something to do with manipulating files sent by the browser for attachment?

 

Any help appreciated, thanks,

Graeme

  • January 14, 2013
  • Like
  • 0

Hello all,

 

I have a trigger (case before update) in which I want to do different things depending upon whether the trigger occurs in a batch or single context. (This is to get around a problem I have with a @future method being called from within batch mode)

 

Is there a way to tell if the context is in batch mode? I haven't found anything about this in the docs or forums.

 

Thanks for any help,

Graeme

 

  • June 21, 2012
  • Like
  • 0

Hello all,

 

@future's seem to cause a lot of fun and games, but this one has me foxed. I'm sure someone has solved this one.

I have a trigger on a case change. (Some pretty wierd code in here = legacy)

 

 

trigger caseChangeTrigger onCase (beforeinsert, beforeupdate) {

 

 Set<Id> ownerIds = new Set<Id>(); 

 Map<Id,Id> map1 = new Map<Id,Id>();

 Map<Id,boolean> map2 = new Map<Id,boolean>();

 Map<Id,Id> map3 = new Map<Id,Id>();

 

    Case[] cs = trigger.new;

    for (Case c : cs) 

    {

        ownerIds.add(c.OwnerId); 

        map1.put(c.Id,c.OwnerId);

    }

    

    for(User u : [select Id, Out_Of_Office__c, User_Backup__c from User where Id in : ownerIds])

    {

        map2.put(u.Id,u.Out_Of_Office__c);

        map3.put(u.Id,u.User_Backup__c);

    }

    

    for(Case c : cs)

    {

        if (map2.get(map1.get(c.Id)) == true ) { 

            c.Case_Owner_Backup__c = map3.get(map1.get(c.Id));

        } 

        else {

            c.Case_Owner_Backup__c = null;

        }

            

      if(c.accountid==null && c.RecordTypeId=='012500000001BVb')

      {

        c.accountid = '0015000000PJ7ec';

      }   

      

      // Sync Case with JIRA Issues

      String systemId = '1';

      String objectType ='CASE';

      String objectId = c.id;

      //Execute the sync

      JIRAConnectorWebserviceCallout.syncCase(jiraURL, systemId ,objectType,objectId);      

    } 

}

 

It's that final block that causes all the problems. 

and that syncCase does a call to a remote system. (Pretty common thing to do, I've noticed.) It begins...

 

global class JIRAConnectorWebserviceCallout {

    @future (callout=true)

    WebService static void syncCase(String jiraURL, String systemId, String objectType, String objectId) {

.... etc,

 

 

And the error is:

 

caseChangeTrigger: execution of BeforeUpdate

 caused by: System.AsyncException: Future method cannot be called from a future or batch method: JIRAConnectorWebserviceCallout.syncCase(String, String, String, String)

 

I've seen cases where a @future is called within a trigger, and the trigger shouldn't be firing multiple times, since I don't have any batch scripts running.

 

I'd appreciate any ideas and recommendations,

Thanks,

Graeme

 

  • June 20, 2012
  • Like
  • 0

Hello,

 

having inherited a huge custom code SF installation, I am trying to prune unused code from production. Is there an easy way to determine if or where an Apex class or VF Page is being used?

 

Thanks,

Graeme

 

  • March 05, 2012
  • Like
  • 0

I'm developing a portal site and have NOT overridden the standard stylesheet behavior in the <apex:page> tag, because I need the standard SF CSC.

 

At the top of my pages, I include my own CSS using <apex:stylesheet>

 

I can't control the order that the stylesheets cascade in. My own appears somewhere in the middle of the list and is overridden by portal.css and extended.css. This means that I cannot properly override SF styles.

 

How do I force my stylesheet to the end of the cascade chain, so it is more authorative than the SF css files?

Thanks!

  • December 16, 2011
  • Like
  • 0

Hello all, brand new to Apex development.

I cam across some code one of our engineers wrote to perform a custom search:

 

/sfc/#search?searchPageNum=0&prop_00N50000001t11O=Guides%20%2F%20Online%20Tutorials&shepherdToken=somelongcode%3D

&searchExtensions=%5B%5D&searchWorkspaceIds=%5B%5D&searchLanguageFilters=%5B%5D&searchCreatorIds=%5B%5D

&searchTags=%5B%5D

&searchProperties=%7B%2200N50000001t11O%22%3A%5B%22Guides%20%2F%20Online%20Tutorials%22%5D%7D

&resultsListType=s

 

I can't find anywhere in the docs that describe these parameters?

 

What I really want to do is perform a keyword search again JUST solutions and content, from my own search form.

 

Help much appreciated, thanks,

Graeme

 

  • December 02, 2011
  • Like
  • 0

Hello all,

 

A recent SF update broke some of our legacy custom code for adding attachments to our custom comment system that replaces the vanilla SF one. Here's the error:

 

List has no rows for assignment to SObject 

Error is in expression '{!processSelectedFiles}' in component <apex:page> in page comment_files

 

I can't find any reference to processSelectedFiles in our code or on the Developer Force pages, but am assuming this has something to do with manipulating files sent by the browser for attachment?

 

Any help appreciated, thanks,

Graeme

  • January 14, 2013
  • Like
  • 0

Hello all,

 

I have a trigger (case before update) in which I want to do different things depending upon whether the trigger occurs in a batch or single context. (This is to get around a problem I have with a @future method being called from within batch mode)

 

Is there a way to tell if the context is in batch mode? I haven't found anything about this in the docs or forums.

 

Thanks for any help,

Graeme

 

  • June 21, 2012
  • Like
  • 0

Hello all,

 

@future's seem to cause a lot of fun and games, but this one has me foxed. I'm sure someone has solved this one.

I have a trigger on a case change. (Some pretty wierd code in here = legacy)

 

 

trigger caseChangeTrigger onCase (beforeinsert, beforeupdate) {

 

 Set<Id> ownerIds = new Set<Id>(); 

 Map<Id,Id> map1 = new Map<Id,Id>();

 Map<Id,boolean> map2 = new Map<Id,boolean>();

 Map<Id,Id> map3 = new Map<Id,Id>();

 

    Case[] cs = trigger.new;

    for (Case c : cs) 

    {

        ownerIds.add(c.OwnerId); 

        map1.put(c.Id,c.OwnerId);

    }

    

    for(User u : [select Id, Out_Of_Office__c, User_Backup__c from User where Id in : ownerIds])

    {

        map2.put(u.Id,u.Out_Of_Office__c);

        map3.put(u.Id,u.User_Backup__c);

    }

    

    for(Case c : cs)

    {

        if (map2.get(map1.get(c.Id)) == true ) { 

            c.Case_Owner_Backup__c = map3.get(map1.get(c.Id));

        } 

        else {

            c.Case_Owner_Backup__c = null;

        }

            

      if(c.accountid==null && c.RecordTypeId=='012500000001BVb')

      {

        c.accountid = '0015000000PJ7ec';

      }   

      

      // Sync Case with JIRA Issues

      String systemId = '1';

      String objectType ='CASE';

      String objectId = c.id;

      //Execute the sync

      JIRAConnectorWebserviceCallout.syncCase(jiraURL, systemId ,objectType,objectId);      

    } 

}

 

It's that final block that causes all the problems. 

and that syncCase does a call to a remote system. (Pretty common thing to do, I've noticed.) It begins...

 

global class JIRAConnectorWebserviceCallout {

    @future (callout=true)

    WebService static void syncCase(String jiraURL, String systemId, String objectType, String objectId) {

.... etc,

 

 

And the error is:

 

caseChangeTrigger: execution of BeforeUpdate

 caused by: System.AsyncException: Future method cannot be called from a future or batch method: JIRAConnectorWebserviceCallout.syncCase(String, String, String, String)

 

I've seen cases where a @future is called within a trigger, and the trigger shouldn't be firing multiple times, since I don't have any batch scripts running.

 

I'd appreciate any ideas and recommendations,

Thanks,

Graeme

 

  • June 20, 2012
  • Like
  • 0

Hello,

 

having inherited a huge custom code SF installation, I am trying to prune unused code from production. Is there an easy way to determine if or where an Apex class or VF Page is being used?

 

Thanks,

Graeme

 

  • March 05, 2012
  • Like
  • 0

I'm trying to show or hide a <tr> HTML tag inside an apex:repeat, but can't find a way where SFDC will save the code without error. Basically I'm building a table and want to start a new <tr> if a certain condition is met (item number mod 3 = 0, so create a new row when the table row has three cells). Attached is a simplifed example, but it shows what I'm trying to do.

 

Note: I can't use an apex:panelGroup because I have nested repeaters in each "column".

 

Thanks!

 

Controller:

public with sharing class TestBuildTable {
	public List<Integer> Ints {get;set;}
	
	public TestBuildTable() {
		this.Ints = new List<Integer>();
		for (Integer i=0; i<20; i++) {
			this.Ints.add(i);
		}
	}
}

 

VF page first try (fail):

<apex:page id="TestBuildTable" Controller="TestBuildTable">
  <table>
    <apex:repeat value="{!Ints}" var="int">
	  {!IF(MOD(int,3)==0,'<tr>',' ')}
	    <td>{!int} nested repeat here</td>
	  {!IF(MOD(int,3)==0,'</tr>',' ')}
	</apex:repeat>
  </table>
</apex:page>

 

VF page second try (fail):

<apex:page id="TestBuildTable" Controller="TestBuildTable">
  <table>
    <apex:repeat value="{!Ints}" var="int">
	  <apex:outputPanel rendered="{!MOD(int,3)==0}" layout="none"><tr></apex:outputPanel>
	    <td>{!int}</td>
	  <apex:outputPanel rendered="{!MOD(int,3)==0}" layout="none"></tr></apex:outputPanel>
	</apex:repeat>
  </table>
</apex:page>

 

The desired result is a table that looks like this:

1    2    3

4    5    6

7    8    9

10 11 12

13 14 15

I'm developing a portal site and have NOT overridden the standard stylesheet behavior in the <apex:page> tag, because I need the standard SF CSC.

 

At the top of my pages, I include my own CSS using <apex:stylesheet>

 

I can't control the order that the stylesheets cascade in. My own appears somewhere in the middle of the list and is overridden by portal.css and extended.css. This means that I cannot properly override SF styles.

 

How do I force my stylesheet to the end of the cascade chain, so it is more authorative than the SF css files?

Thanks!

  • December 16, 2011
  • Like
  • 0

Hello all, brand new to Apex development.

I cam across some code one of our engineers wrote to perform a custom search:

 

/sfc/#search?searchPageNum=0&prop_00N50000001t11O=Guides%20%2F%20Online%20Tutorials&shepherdToken=somelongcode%3D

&searchExtensions=%5B%5D&searchWorkspaceIds=%5B%5D&searchLanguageFilters=%5B%5D&searchCreatorIds=%5B%5D

&searchTags=%5B%5D

&searchProperties=%7B%2200N50000001t11O%22%3A%5B%22Guides%20%2F%20Online%20Tutorials%22%5D%7D

&resultsListType=s

 

I can't find anywhere in the docs that describe these parameters?

 

What I really want to do is perform a keyword search again JUST solutions and content, from my own search form.

 

Help much appreciated, thanks,

Graeme

 

  • December 02, 2011
  • Like
  • 0

Hi I have added a apex controller to my vf page in which I am trying to return a list of a related objects that I am then going to display in the vf page in a apex:datatable. I'm able to create the controller extension no problem but when I view the vf page I get this error:

 

Error: Unknown property 'VisualforceArrayList.Name'

Apex Code:

public class event_session {
private SBS_Event__c sbs_event;


public event_session(ApexPages.StandardController controller) {
this.sbs_event =
(sbs_event__c)controller.getRecord();
}

List<event_sessions__c> event_session = new List<event_sessions__c>();

public List<event_sessions__c> EventSession {
get{
event_session = [Select e.Lecture_Event_Period__c, e.Name from Event_Sessions__c e Where e.SBS_Event__c = :sbs_event.id Order by e.CreatedDate];
return event_session;
}
}




}

 

vf code:
 

//vf fragment<apex:page showHeader="false" standardController="SBS_Event__c" extensions="event_session" > <apex:composition template="StdOCEITemplate" > <apex:define name="pagebody"> <apex:pageBlock title="Event Registration Form"> <apex:form > <table width="100%" border="0" cellspacing="4" cellpadding="0"> <tr> <th width="20%" scope="col">&nbsp;</th> <th width="80%" scope="col">&nbsp;</th> </tr> <tr> <th scope="row" style="">Event:</th> <td style="text-align:left;padding-left:10px;"><strong>{!SBS_Event__c.name}</strong></td> </tr>