• Davser
  • NEWBIE
  • 5 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 15
    Questions
  • 24
    Replies

Hey,
Getting some strange behaviour. I have a trigger that creates sharing rules when an object is created, so that customer portal users can see the object in their portal. Basically the object setup is "User" - "Contact" - "Membership Card". So anytime a membership card is created for a contact, a sharing rule is created so the user can see it via the portal.

This works fine if the new membership card is created by a standard user in SFDC.

However, the portal user has the abilty to create a membership card from a VisualForce page in the portal, and when they do the sharing rule trigger throws up the error: "INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY" on the line where i insert the sharing rule

However I thought that triggers run under the system account?

 

Any help is greatly appreciated

  • November 20, 2009
  • Like
  • 0

Hey,

 

Is there a way of getting customer portal information in APEX?

 

For instance, I'd like to be able to get the portal ID so that I can conditionally display certain fields. 

 

Regards

David

  • November 17, 2009
  • Like
  • 0

Hey,

Having read a few posts around formulas in batch processes, it would seem that to get the formula to be accurate you have to include all the formulas accessed fields in the SOQL query.

 

However, I had done this, and still got some REALLY funky results for my formula.

 

My formula, which is called "Retrieval Key" is:

 

TEXT(Country_of_Origin__c) & TEXT(System_of_Origin__c) & Product__c & Product_Category_Lookup__c & IF(MONTH(DATEVALUE(CreatedDate))=1,"January", IF(MONTH(DATEVALUE(CreatedDate))=2,"February", IF(MONTH(DATEVALUE(CreatedDate))=3,"March", IF(MONTH(DATEVALUE(CreatedDate))=4,"April", IF(MONTH(DATEVALUE(CreatedDate))=5,"May", IF(MONTH(DATEVALUE(CreatedDate))=6,"June", IF(MONTH(DATEVALUE(CreatedDate))=7,"July", IF(MONTH(DATEVALUE(CreatedDate))=8,"August", IF(MONTH(DATEVALUE(CreatedDate))=9,"September", IF(MONTH(DATEVALUE(CreatedDate))=10,"October", IF(MONTH(DATEVALUE(CreatedDate))=11,"November", IF(MONTH(DATEVALUE(CreatedDate))=12,"December","")))))))))))) & TEXT(YEAR(DATEVALUE(CreatedDate)))

 and the SOQL statement to retrieve the necessary fields and the Retrieval Key formula field is:

 

 

Select t.Retrieval_Key__c, convertCurrency(t.Amount__c), t.Country_of_Origin__c, t.Date__c, t.Points__c, t.Product__c, t.Product_Category_Lookup__c, t.System_of_Origin__c, convertCurrency(t.Turnover__c), t.CreatedDate from Transaction__c t

 The strange behaviour was that the formula would not have the correct System of Origin field, and almost seemed to be swapping system of origins between lines of the retrieved Transaction objects!!

 

Anyway, any explanation would be appreciated, but also just a heads up to be careful when using batch jobs. This one had my head nearly explode!

 

Regards

Dave

 

 

 

 

  • November 10, 2009
  • Like
  • 0

Hey

Periodically when running my batch process from a VisualForce page I get a "Read Timed Out" error.

 

I am not calling out to any external systems in my batch.

 

I have gotten this message from code that worked both before and after the problem batch, with no changes to the code in between.

 

Any explanation for this would be highly appreciated!

 

Thanks

Dave

  • November 10, 2009
  • Like
  • 0

Hey,

I'm trying to use the DateTime.format()method to create a SOQL query string. The string needs to be dynamic, so am literally creating a String for my query. Obviously I'd like to be able to say:

 

 

myDateTime.format('yyyy-MM-ddTHH:mm:ssZ');

 

However this gives me an error saying : "Unrecognized format: yyyy-MM-ddTHH:mm:ssZ".

 

Am I missing something really obvious here, how else should I be formatting a datetime for a soql query?

 

Any ideas are greatly appreciated!

David Walshe

 

 

 

  • November 10, 2009
  • Like
  • 0
Hey All,
Getting an error in a test method when trying to set a queue as a case owner. The code looks like:
Code:
Account testAcc = new Account(Name='TestAcc',AccountNumber='12345');
insert testAcc;
Contact testCont = new Contact(LastName='Testcontact',AccountId=testAcc.Id);
insert testCont;
Group testGroup = new Group(Name='TestingQueue',Type='Queue');
insert testGroup;
Case retCase = new Case(AccountId=testAcc.Id, ContactId=testCont.Id, Description='A sample description', Severity__c='Critical', Status='Assistance Required', Subject='Test subject',OwnerId=testGroup.Id);
insert retCase;

 
but this throws the error:
Error:
System.DmlException: Insert failed. First exception on row 0; first error: INVALID_OPERATION, Queue not associated with this SObject type

 Is there a reason this error is happening? When i hardcode an existing queue id as the ownerid I do not get this error!
 
Thanks in advance for any help at all
Dave
  • October 27, 2008
  • Like
  • 0
Hey all,
I've an interesting issue. I have a VF page which contains a VF component. The VF page has some input fields which display their help text properly - when you roll over the icon the help text displays.
 
In the VF component, with the same surrounding tags, ie pageBlockSection, the help text icon displays, but the roll over doesn't work. The html look like:
 
Code:
<img class="helpOrb" src="/s.gif" alt="" title=""/>
<script language="JavaScript" type="text/javascript">
//sfdcPage.setHelp('Case.00NR0000000H8ay', 'Help text here');//
</script>

 which seems to have commented out the javascript rollover functionality for some reason!!
 
Why is this happening in the component???
 
Thanks for any help in advance
  • September 04, 2008
  • Like
  • 0
Hey all,
Try to compile the following in an APEX controller class for a VF page:
 
Code:
BusinessHours bh = [Select b.FridayEnd from BusinessHours b where b.Id='01m0000000000GLAAY'];

 This query works in the Apex Explorer no problem. When I try to compile it in APEX it gives me the following error:
 
Error: Compile Error: No such column 'FridayEnd' on entity 'BusinessHours'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names
So is there an issue with the BusinessHours table in APEX???
 
Any help or insight would be much appreciated!
Thanks
Dave
  • August 29, 2008
  • Like
  • 0
Hey all,
I have the following code snippet in one of my pages:
Code:
 

<apex:pageBlockTable value="{!displayedIOs}" var="io">

<apex:column headerValue="BC" rendered="{!isBCD}"> <apex:outputField value="{!io.BC__c}"/> </apex:column></apex:pageBlockTable>

 So my column displays the name of a related object using this code. However, that name is a web link to the actual object. I would like to still display the name, but suppress the link part.
 
Using code like:
Code:
<apex:column headerValue="BC" rendered="{!isBCD}" value="{!io.BC__c}"/>

 
only displays the ID of the branded channel.
Given that I am iterating over a set in my pageBlockTable, I can't see a way around this. Does anyone know a way?
Hey all,
I have a VF page that I have included in the page layout of my opportunity. In this page I have a command button which I want to use to bring the user to another VF page. However, when I click this button it automatically adds "inline=1" to the url of the second VF page! This has the outcome of displaying this second page without the tabs or sidebar.
 
Is there a way of stopping this addition of the inline property?
Hey
I'm trying to do something like this in my VF markup:
 
Code:
action="{!next(false)}"

 
where I am passing the parameter false into the next function in my controller. I cannot find a definitive answer if this can be done, and cannot seem to get it working myself. Anyone know for sure?
Is there a way of having inputfield component functionality for fields that aren't part of an SObject?
 
For instance, if I define a variable in my controller object like:
 
Code:
public Date sampleDate {get; set;}

 is there some way of having this displayed in the page with the date picker functionality?
 
With SObject Date fields it would be a simple case of an inputfield with its value attribute referring to the field.
I'm not sure this is the right forum for suggested improvements to the Visualforce documentation, it it isn't, perhaps someone could advise the correct place.
 
I think that having screenshots of resultant output in the Visualforce documentation would be extremely beneficial. For instance, in the Standard Component Reference section, every component has some sample code displayed, which is very useful. It would be even more useful to have a screenshot of what the output of that code is, as displayed to the end user in a browser window. It makes sense given that we are dealing with markup, and would allow a much quicker evaluation from the developer perspective on whether the component does what they need.
 
Even better would be something similar to the documentation of the Yahoo User Interface components. They have many samples which can be used interactively to understand what the code is doing. This may be more difficult to achieve with Visualforce, however it would be invaluable in allowing people to quickly understand Visualforce components, and how they can be used together.
I'd like to have the "Select All" functionality on a column in a pageBlockTable. It exists in various parts of Salesforce, where it is a checkbox beside the column title, which will select all or deselect all checkboxes in that column. How would I go about doing this for the following code:
 
Code:
<apex:pageBlockTable value="{!allIOs}" var="io">
 <apex:column headerValue="Select">
  <apex:inputCheckbox value="{!io.mfd}"/>
 </apex:column>

 
Thanks for any tips in advance!
Hi all,
I am trying to display some content, which is dependent in a Boolean variable in my controller. First I tried the following code:
 
Code:
{!IF({!isBrandedChannel},"SOMECONTENT", "SOMEOTHERCONTENT")} 

 where {!isBrandedChannel} is the Boolean variable. This wouldn't compile in Eclipse and hence wouldn't save to the server.
 
Next I tried using the "rendered" tag of the Visualforce component. However the limitation here is that I need 2 components that would be declared something like:
 
Code:
<apex:repeat value="{!newIOs}" rendered="{!isBrandedChannel}" var="io">

and

<apex:repeat value="{!newIOs}" rendered="NOT({!isBrandedChannel})" var="io">

 
However the "NOT" function doesn't work here.
 
Eventually I declared 2 variables in my controller, one the normal isBrandedChannel variable, the second giving me the inverse of this, and used these on my 2 seperate repeat components.
 
This seems strange to have to do this. Is there a better way?
 
 

We cannot seem to get eclipse to connect to SFDC for saves. Anybody have any insight?

 

Error -

 

Unable to refresh resource.  SERVER_UNAVAILABLE: Unable to complete the creation of the query cursor at this time, please retry your query later

Hey,
Getting some strange behaviour. I have a trigger that creates sharing rules when an object is created, so that customer portal users can see the object in their portal. Basically the object setup is "User" - "Contact" - "Membership Card". So anytime a membership card is created for a contact, a sharing rule is created so the user can see it via the portal.

This works fine if the new membership card is created by a standard user in SFDC.

However, the portal user has the abilty to create a membership card from a VisualForce page in the portal, and when they do the sharing rule trigger throws up the error: "INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY" on the line where i insert the sharing rule

However I thought that triggers run under the system account?

 

Any help is greatly appreciated

  • November 20, 2009
  • Like
  • 0
Hey all,
Try to compile the following in an APEX controller class for a VF page:
 
Code:
BusinessHours bh = [Select b.FridayEnd from BusinessHours b where b.Id='01m0000000000GLAAY'];

 This query works in the Apex Explorer no problem. When I try to compile it in APEX it gives me the following error:
 
Error: Compile Error: No such column 'FridayEnd' on entity 'BusinessHours'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names
So is there an issue with the BusinessHours table in APEX???
 
Any help or insight would be much appreciated!
Thanks
Dave
  • August 29, 2008
  • Like
  • 0
I hope someone can help me.  I have a VF page that includes 4 tabbed sections.  One of them is a custom search tab.  When the user types their criteria (an account name) into the inputtext box, and clicks my search button, everything works great.  If the user types in their criteria, then presses "Enter",  the page refreshes and takes the user back to the first tab (my search tab is the fourth tab).
How can I get pressing enter to be the same as clicking the button?

Thanks in advance!!

Jim
  • August 27, 2008
  • Like
  • 1
Hey all,
I have the following code snippet in one of my pages:
Code:
 

<apex:pageBlockTable value="{!displayedIOs}" var="io">

<apex:column headerValue="BC" rendered="{!isBCD}"> <apex:outputField value="{!io.BC__c}"/> </apex:column></apex:pageBlockTable>

 So my column displays the name of a related object using this code. However, that name is a web link to the actual object. I would like to still display the name, but suppress the link part.
 
Using code like:
Code:
<apex:column headerValue="BC" rendered="{!isBCD}" value="{!io.BC__c}"/>

 
only displays the ID of the branded channel.
Given that I am iterating over a set in my pageBlockTable, I can't see a way around this. Does anyone know a way?
Hey all,
I have a VF page that I have included in the page layout of my opportunity. In this page I have a command button which I want to use to bring the user to another VF page. However, when I click this button it automatically adds "inline=1" to the url of the second VF page! This has the outcome of displaying this second page without the tabs or sidebar.
 
Is there a way of stopping this addition of the inline property?
Hey
I'm trying to do something like this in my VF markup:
 
Code:
action="{!next(false)}"

 
where I am passing the parameter false into the next function in my controller. I cannot find a definitive answer if this can be done, and cannot seem to get it working myself. Anyone know for sure?
Is there a way of having inputfield component functionality for fields that aren't part of an SObject?
 
For instance, if I define a variable in my controller object like:
 
Code:
public Date sampleDate {get; set;}

 is there some way of having this displayed in the page with the date picker functionality?
 
With SObject Date fields it would be a simple case of an inputfield with its value attribute referring to the field.
I'd like to have the "Select All" functionality on a column in a pageBlockTable. It exists in various parts of Salesforce, where it is a checkbox beside the column title, which will select all or deselect all checkboxes in that column. How would I go about doing this for the following code:
 
Code:
<apex:pageBlockTable value="{!allIOs}" var="io">
 <apex:column headerValue="Select">
  <apex:inputCheckbox value="{!io.mfd}"/>
 </apex:column>

 
Thanks for any tips in advance!
Hi all,
I am trying to display some content, which is dependent in a Boolean variable in my controller. First I tried the following code:
 
Code:
{!IF({!isBrandedChannel},"SOMECONTENT", "SOMEOTHERCONTENT")} 

 where {!isBrandedChannel} is the Boolean variable. This wouldn't compile in Eclipse and hence wouldn't save to the server.
 
Next I tried using the "rendered" tag of the Visualforce component. However the limitation here is that I need 2 components that would be declared something like:
 
Code:
<apex:repeat value="{!newIOs}" rendered="{!isBrandedChannel}" var="io">

and

<apex:repeat value="{!newIOs}" rendered="NOT({!isBrandedChannel})" var="io">

 
However the "NOT" function doesn't work here.
 
Eventually I declared 2 variables in my controller, one the normal isBrandedChannel variable, the second giving me the inverse of this, and used these on my 2 seperate repeat components.
 
This seems strange to have to do this. Is there a better way?
 
 
We are attempting our first deployment from a dev sandbox to a qa sandbox and are experiencing major issues.
 
We have all sorts of files we are trying to deploy including visualforce pages, apex classes, custom objects, custom fields on standard objects, page layouts, record types, picklist changes etc.
 
We first tried to deploy as much as possible using a package. Because it is a sandbox we can only create unmanaged packages. If we add a class, any referenced fields are added to the package. When we try and deploy the package it fails if any fields already exist. Does using managed packages get round this?
 
Next we tried using the ant deployment tool. We need to use this for at least visualforce pages as they can't be packaged yet. Deployment order seems to matter hugely for ant deployments. If I try and deploy Class A that references Class B and Class B has not yet been deployed it fails. How do I tell ant what order to deploy things in? My manifest (package.xml) has wildcards for each type - should I name every file and order them? Surely not.
 
My main issue with ant relates to the page/controller cross reference - how can I deploy either pages or controllers when they cross reference each other?
 
Besides these two ways I can't see any other way of deployment. There is Eclipse but it used the same API calls that ant uses so same deployment order problem.
 
Surely someone must have worked through this. I have searched the boards but can't see suggestions.
 
Any ideas anyone?
Is there any definitive documentation on using the Dojo Toolkit (http://dojotoolkit.org) in Salesforce Scontrols?

There is a small mention about Dojo in the AJAX Toolkit document (http://www.salesforce.com/us/developer/docs/ajax/index.htm). Other posts in this forum have mentioned that Salesforce now hosts version 0.4.1 of the Dojo toolkit. However, there is little documentation to be found on the paths necessary to call the required files.

I'd like to create an scontrol that uses the Dojo Editior (http://dojotoolkit.org/book/dojo-book-0-9/part-2-dijit/advanced-editing-and-display/editor-rich-text) to give the user WYSIWYG controls for a text area.

Code:
<script src="/js/dojo/0.4.1/dojo.js"></script> 
<script type="text/javascript">
  dojo.require("dijit.Editor");
  dojo.require("dojo.parser");
</script>
<script src="/soap/ajax/8.0/connection.js"></script>

.....

<textarea dojotype="dijit.Editor" stylesheets="/js/dojo/0.4.1/resources/dojo.css"> <p>
  This editor is created from a textarea .
 </p>
</textarea>

 Unfortunately, its hard to find out A) what is the latest version of the toolkit Salesforce is hosting/supporting and B) what are the proper relative urls for dojo.js and dojo.css.

I'd greatly appreciate any assistance. I'll even offer to add this information and working code to the Wiki to pay it forward.



Message Edited by Eric_Santiago on 02-28-2008 10:39 AM