• PerGeert
  • NEWBIE
  • 30 Points
  • Member since 2006

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 32
    Replies
All-
 
I searched the boards for this one with no luck. I have a trigger that is throwing an error in certian cases. I have not been able to identify the exact use case that is throwing the error...but I thought I would throw it out here to see if anyone has seen this.
 
I have a trigger that is on the event that figures the next activty data for all accounts it is associated with. Basically every time an event is saved I go out and figure out all contacts and accounts associated with it then grab all events assocaited with them then figure out when the next event is. Then I stick that date on the accounts. This way the reps know when there next event is on the list views.
 
So every so often I get this error sent to me.
 
Code:
"ENTITY_FAILED_IFLASTMODIFIED_ON_UPDATE, entity failed ifModifiedBefore "
 
I looked in the documentation and found this def of the error:
 
Code:
"You cannot update a record if the date inLastModifiedDate is later than the current date. "

 
However I am not setting/touching the last modified date. Very wierd. Not sure what is going on. Items to note...this is in a international org and the error only seems to be being triggered by users in Japan.
 
Any help/insight would be greatly appreciated!
 


Message Edited by tinman44 on 12-29-2008 07:37 AM

Message Edited by tinman44 on 12-29-2008 07:37 AM

In some Apex triggers I create a new record on which there is a field Contact Person (a link to Users). I want automatically to make this contact person a Chatter Follower of the record so that he/she is notified, should anyone add a Chatter comment to the record. How to?

Looking at event in a Public Calendar, the prefix of the OwnerId is '023'. What object type is that?

I have a custom object, Equipment, which I want to relate to a Calendar object. The purpose being, that each Equipment (a demo machine) has a calendar about availability attached. Does not seem to be possible directly to make the Calendar a related/lookup relationship to another object. Any ideas how to do this?


I have a scontrol, which basically does this:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <script type="text/javascript" src="/js/functions.js"></script>
    <script src="/soap/ajax/12.0/connection.js"></script>
    
    <script type="text/javascript">  
 window.onload=init_page(); 
 function init_page() 
 { 
    var result; 
    var strSQL = "Select Id,StartDate,ProductFamily,Quota,Closed,Commit,Upside,Pipeline,CurrencyIsoCode from RevenueForecast where OwnerId='{!$User.Id}' and StartDate >= 2008-04-01 and StartDate <= 2009-03-31 order by ProductFamily"; 
           try {
  result = sforce.connection.query(strSQL);
    } catch(err) { alert(err); alert('SQL blowup');}
 
 } 
 </script> 
</head> 
<body></body> 
</html>

When I execute it as System Administrator, it works as expected. However, when I execute with another profile, I get an error:

{faultcode:'sf:INVALID_TYPE', faultstring:'INVALID_TYPE: sObject type 'RevenueForecast' is not supported.', ...}

Which security settings (besides API enabled) must the user's profile have in order to read RevenueForecast?
 

Im using a controller extension to account for this page. However, what happens when you click Go! is that first the list of accounts is rerendered and after a second or so, the hole page is refreshed.
In the real program that wipes out data created in other sections by JS.
I would expect only the portion mentioned in the rerender to be refreshed.
 
Looks like onclick event is the culprit. Changing the page so that the rerender is triggered onchange on the select list, works as expected. Still, I want my onclick for other purposes
 
Any ideas?
 
 
 

<apex:page standardController="Account" recordSetvar="accounts"

extensions="Account2MapControllerExt">

<script src="http://maps.google.com/maps?file=api&v=2.x&key={!mapkey}" type="text/javascript"></script>

<script src="http://www.google.com/jsapi?key={!mapkey}" type="text/javascript" ></script>

<apex:form >

<apex:pageBlock >

  <apex:pageBlockSection title="Select Account List" columns="1" collapsible="false">

    <apex:outputPanel > Select an account list view to map :

      <apex:selectList value="{!filterId}" size="1">

        <apex:selectOptions value="{!listviewoptions}" />

        </apex:selectList>

      <apex:commandButton value="Go!" >

      <apex:actionSupport event="onclick" reRender="accTable" status="accStatus" />

      </apex:commandButton>

      <apex:actionStatus id="accStatus" startText="(incrementing...)" stopText="(done)"/>

    </apex:outputPanel>

  </apex:pageBlockSection>

  <apex:pageBlockSection >

    <apex:dataTable value="{!accounts}" var="a" id="accTable" rows="3">

      <apex:column value="{!a.id}" rendered="false"/>

      <apex:column value="{!a.name}" rendered="true"/>

    </apex:dataTable>

  </apex:pageBlockSection>

</apex:pageBlock>

</apex:form>

</apex:page>



Message Edited by PerGeert on 11-22-2008 06:19 PM

Message Edited by PerGeert on 11-22-2008 07:50 PM
At Dreamforce I saw some examples using Google Intesitymap. Where can I find the example code?
I would like to replace the opportunity product selection page with something more user friendly instead of just displaying a flat list of products. The ideas is a tree control display like:
 
+ Models
   + Family
      + Product Line
 
Model is defined by product record type: Model, Accessory
Family is defined by product family, e.g. "select family from product2 where recordtype = :model"
Product Line is defined by a custom field on Product, e.g. "select productline__c from product2 where recordtype=:model and family=:family"
Clicking + at product line gives you the products, e.g, "select name, ... from product2 where recrodtype=model and family=:family and productline__c = productline__c"
 
So, initially + Models isdisplay. Clicking on + expands to the Families under model. Clicking on a Family expands to the Product Lines under that Family, clicking + on product lines list all product under that recordtype, family, product line.
 
All obviously are controled by the selected Price Book.
 
Question: the functionality from an UI point of view is similar to what we have in the standard application under Setup: Clicking + under Customization gives you a list of standard objects, clicking a + next to a standard object gives you the various tasks you may perform.
 
How to do this on an APEX page?

Best regards,
Per
I'm using PrintAnything for some special report. How can I in PrintAnything handle a boolean field so that if the value is True, print the label, otherwise do not print anything?
The standard functionality of <prtany:notempty field="x"> ... </prtany:notEmpty> will print true or false, which in the report does not look too pretty.
I have an old S-control using an old beta version of AJAX, which worked fine with IE6. However, it ran into some problems with IE7, which is why I try to change it. So, I'm having a problem with Dynabeans. The code below should show what I am trying to do:
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
...
<script language="javascript" src="/soap/ajax/10.0/connection.js" type="text/javascript"></script>
...
var conn;
 
function initPage() {
    conn = sforce.connection;
    window.setTimeout(";", 1000);   
    getPictures();
}
 
Now later in a function inwoked by getPictures:
..
     var rme = new conn.Dynabean("OwnEquipment__c");
...
This is where I'm having the problem. Tried to use .. rms = new sforce.Dynabean .. or Sforce.Dynabean .. or just Dynabean ..
 
Always an error like 'object expected'
I have a trigger on a custom object OpenInvoice__c: trigger OpenInvoiceTrigger on OpenInvoice__c (after insert, after update) { if (Trigger.isAfter) { if (Trigger.isUpdate || Trigger.isInsert) { // After insert and update, check if invoice balance is zero. // If so, delete the record List PaidInvoices= new OpenInvoice__c[0]; for (OpenInvoice__c i : Trigger.new) { if(i.Balance__c == 0) { PaidInvoices.add(new OpenInvoice__c(id = i.id)); } } delete PaidInvoices; } } } The idea being, when an OpenInvoice is created/updated and the balance is zero, simply delete the record. (This happens normally from an interface from an ERP system). When I test this I get this warning/message: Record deleted The record you attempted to access has been deleted. The user who deleted this record can recover it from the Recycle Bin. Deleted data is stored in the Recycle Bin for 30 days. The message probably is caused by the fact that the trigger is executing in another user context than the user entering the data. The record is deleted OK. Any ideas on how to avoid this message and bring the user back e.g. to the object owning the OpenInvoice (the Account)?
We've been experinmenting with PrintAnything and basically it works OK. However, once the output is created the user wants to email that to someone. Using IE and clicking File -> Send -> Page by Email does not produce any usable output. Anyone have any ideas how to send the generated ouput, i.e. divContent from PrintAnything? We are willing to change the driver if that is what it takes.
Regards,
Per
I have an internal webservice doing some advantaged mail merge with SFDC and storing the result as an attachment to the calling object.
 
If I create an URL as a custom link, e.g. http://internal.sfdcservice?parameters it works fine. The only two problems I try to solve are the following:
 
- while the service is running (takes about 1-2 minutes), I would like to display 'the' wait_cursor, so the user can see, something (might) be happening
 
- once the process is completed I would like to refresh the caller form so the new attachment shows up in the list of attachments instead of leaving the form from the web service.
 
The web service and consuming web site is written in vb.net
 
 
Being a novice in web development I've tried a couple of things without any major success:
 
- instead of calling the URL directly, creating a sControl to diplay the wait_cursor, but haven't been able to catch the event that the web service was done
 
- do everything in vb.net but haven't had much success with various variations of response.xxx.
 
I believe this is not an unknown scenario, so if some of you have a solution. please let me know.
 
best regards,
Per

In some Apex triggers I create a new record on which there is a field Contact Person (a link to Users). I want automatically to make this contact person a Chatter Follower of the record so that he/she is notified, should anyone add a Chatter comment to the record. How to?

I've set up a simple trigger to insert a FeedPost when one of my Customer Portal Users creates an entry through Sites and found that the trigger only works when I create an entry from inside Salesforce (as a regular SF user).

 

When a Customer Portal User creates an entry, the trigger fails with the error: "Invalid type: FeedPost"  

 

The API version on all the code is 18.0.

 

I've also tried putting the "insert FeedPost" call in a class without sharing, but it still fails in the Customer Portal context.

 

What are the limitations on integration Chatter with Sites and Customer Portal Users?   Can we even trigger chatter activity from portal user actions?

 

- R

 

 

(This is just a test case ... I know the trigger isn't set up to handle bulk inserts)

 

 

trigger ItemReview on Item_Review__c (after insert) {

	
	for (Item_Review__c review :trigger.new) {
		Chatter.feedPost(review.Item__c,  'A review has been posted for this item.'
				,null);
		
	}

}

 

 

 

 

 

public without sharing class Chatter {

	public static void feedPost(String parentId, String body, String link) {
		try {
		   FeedPost fpost = new FeedPost();
		   fpost.ParentId = parentId; //eg. Opportunity id, custom object id..
    		    fpost.Body = body;
    		    insert fpost;	
            	 
        } Catch (Exception ex) {
            	
        }
		
	}
}

 

 

When users create customer reports(Tabular Report), they want to use another name to replace the field label in page layout. How to implement it?

 

Thanks

  • May 21, 2009
  • Like
  • 0

Hi,

 

I want to lock particular Record on some condition.

 

Ex: I will include one custom field(check box) in Opportunity as "Lock". If this is checked for any Opportunity, then that Opportunity should not be accessible by any other group (Ex: Sales, Marketing).

How can I achieve this?

 

Thanks for any help.....

 

 

Looking at event in a Public Calendar, the prefix of the OwnerId is '023'. What object type is that?

I have a custom object, Equipment, which I want to relate to a Calendar object. The purpose being, that each Equipment (a demo machine) has a calendar about availability attached. Does not seem to be possible directly to make the Calendar a related/lookup relationship to another object. Any ideas how to do this?
The class attribute isn't being set when I use outputField. As you can see in my example the HTML output is missing the class attribute which was set to XXX


My Page:


<apex:page controller="TestPageCon">
<apex:outputField styleClass='XXX' value='{!field.amount}'/>
</apex:page>


My Controller:


public class TestPageCon {
public Opportunity getField() {
return [select id, amount from Opportunity limit 1];
}
}


Actual HTML output:


<span id="j_id0:j_id1">$60,000.00</span>

Where did my XXX go?

All-
 
I searched the boards for this one with no luck. I have a trigger that is throwing an error in certian cases. I have not been able to identify the exact use case that is throwing the error...but I thought I would throw it out here to see if anyone has seen this.
 
I have a trigger that is on the event that figures the next activty data for all accounts it is associated with. Basically every time an event is saved I go out and figure out all contacts and accounts associated with it then grab all events assocaited with them then figure out when the next event is. Then I stick that date on the accounts. This way the reps know when there next event is on the list views.
 
So every so often I get this error sent to me.
 
Code:
"ENTITY_FAILED_IFLASTMODIFIED_ON_UPDATE, entity failed ifModifiedBefore "
 
I looked in the documentation and found this def of the error:
 
Code:
"You cannot update a record if the date inLastModifiedDate is later than the current date. "

 
However I am not setting/touching the last modified date. Very wierd. Not sure what is going on. Items to note...this is in a international org and the error only seems to be being triggered by users in Japan.
 
Any help/insight would be greatly appreciated!
 


Message Edited by tinman44 on 12-29-2008 07:37 AM

Message Edited by tinman44 on 12-29-2008 07:37 AM


I have a scontrol, which basically does this:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <script type="text/javascript" src="/js/functions.js"></script>
    <script src="/soap/ajax/12.0/connection.js"></script>
    
    <script type="text/javascript">  
 window.onload=init_page(); 
 function init_page() 
 { 
    var result; 
    var strSQL = "Select Id,StartDate,ProductFamily,Quota,Closed,Commit,Upside,Pipeline,CurrencyIsoCode from RevenueForecast where OwnerId='{!$User.Id}' and StartDate >= 2008-04-01 and StartDate <= 2009-03-31 order by ProductFamily"; 
           try {
  result = sforce.connection.query(strSQL);
    } catch(err) { alert(err); alert('SQL blowup');}
 
 } 
 </script> 
</head> 
<body></body> 
</html>

When I execute it as System Administrator, it works as expected. However, when I execute with another profile, I get an error:

{faultcode:'sf:INVALID_TYPE', faultstring:'INVALID_TYPE: sObject type 'RevenueForecast' is not supported.', ...}

Which security settings (besides API enabled) must the user's profile have in order to read RevenueForecast?
 

My org has translation workbench enabled and all the labels, picklist values and messages are translated to different languages. I would like to develop a Visualforce page that shows data collected from several objects in the user's language. Most of the information can be reached using merge fields without programming a controller extension, but merge fields that reference picklist values show  the master value, not the label in the user's language, is there any way to translate the picklist value using merge fields, something like "tolabel"? If not, I presume that I will have to develop a controller extension and use Describe functions, or is there any other easier way?
Is there a prescribed way to manage the saving of phone numbers in a desired format? 5555551212 or 555 555-1212 would automatically be saved as (555) 555-1212 etc.? I notice on a user form, the field has built in phone formatting while typing. Any way to do that?
First time poster & new to SFDC.
 
For a contact I am trying to calculate the next anniversary date based on a historical registration date (which could be many years previous), to drive a workflow for a reminder e-mail and follow up task to record owner using the Time Based work flow. 
 
The formula that I have used previously, suggested in SFDC documentation (to calculate Next birthday), calculates correctly when using the standard contact Birthdate field, but when I apply the same formula to a custom date field the compilation exceeds the maximum 5000 characters (Error: Compiled formula is too big to execute (5,262 characters). Maximum size is 5,000 characters) 
 
Current formula below and any suggestions on reducing formula size or alternate approaches will be appreciated greatly.
 
IF(MONTH(AppDate__c)>MONTH(TODAY()),DATE(YEAR(TODAY()),MONTH(AppDate__c),DAY(AppDate__c)),
IF(MONTH(AppDate__c)<MONTH(TODAY()),DATE(YEAR(TODAY())+1,MONTH(AppDate__c),DAY(AppDate__c)),
IF(DAY(AppDate__c) >= (DAY(TODAY())),DATE(YEAR(TODAY()),MONTH(AppDate__c),DAY(AppDate__c)),
DATE(YEAR(TODAY())+1,MONTH(AppDate__c),DAY(AppDate__c)))))
 
Regards
 
 
Paul
Scrolled down many of posts here in Community but couldnt find one solution on how to avoid 'Too many DML rows' error.
 
Probably am i missing some community link then pls help me to get to that solution.
 
I am looking to mass update all contacts attached to a account. I do fetch all contacts using inbound SOQL query which do handles bulk processing too.
 
Now when it comes to update all contacts of all accounts which came into trigger, I do create a array and send tht entire array to update call which exceeds the limit of 100.
 
Is there any querymore or .. any other approach to be used .. pls let me know in detail on how to handle 100+ updates in Apex Trigger.
 
Thanks in advance
I'm trying to create a validation rule using the new VLOOKUP function.  The idea is:
* Registrations are detail-master to Programs
* Faimly Groups are also detail-master to Programs
* Registrations has lookup relationship to Family Groups
* want to limit so that you can only choose a Family Group that belongs to the same Program that the Registration belongs to

So basically this is a workaround to get around the lack of filtered lookups.

I tried writing the validation rule to look like this:

Code:
NOT ( 
VLOOKUP( $ObjectType.Family_Group__c.Fields.Program__c ,  
$ObjectType.Family_Group__c.Fields.Id , Family_Group__r.Id ) = Program__r.Id )

 However, this gives me an error of "Incorrect parameter for function VLOOKUP(). Expected Record Name field." which is rather inscrutable, I'm sure you'll agree.

From experimentation, I've found that it works if I replace those Id fields with Name fields.  However, I don't want to do that, as Family Group names are not necessarily unique.

Why doesn't it work with the Id's?  Is there some reason that this function won't accept Id fields as parameters?  If so, is that something that could be changed?  This is probably the most important potential use of this function in validation rules.

BTW, the documentation is not clear on this.  The only thing it says is "The field_on_lookup_object must be an indexed field."  But I can't find anywhere what constitutes an Indexed Field in SFDC, so that's not too helpful.

Thanks for any help!

M.

  • February 16, 2008
  • Like
  • 0
Hello,
i have problems when i will Logon to SF wir my Excel Connector.
I enter my Username und my Password and use the URL:
https://www.salesforce.com/services/Soap/c/6.0

But the following error occurs:
Error Generated by request::Unable to send request to server. A connection with the server could not be established

ExceptionCode : 5103

The sforce Connector Version is 6.16 and the Office Toolkit Version is 3.0

Thank you in advice.