• NikiVankerk
  • NEWBIE
  • 0 Points
  • Member since 2009
  • Implementation Consultant
  • Vankerk Solutions

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 10
    Replies
Has anyone else noticed their Chrome browser loads continuously when editing a VF page or Apex class/trigger?  Not while using Developer Console but editing in the SF interface - this just started for me this week.  I can still save code etc but in edit mode I have the progress circle going non-stop in the tab.  I'm using Chrome version 40.0.2214.93 m.
From Salesforce documentation, the order of execution says that there is no system validation run prior to the 'before insert' trigger if the request is coming from sources other than standard UI, and that these will run instead after the 'before insert' trigger is executed.

Apex Developers Guide reference: http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_triggers_order_of_execution.htm?SearchType=Stem (http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_triggers_order_of_execution.htm?SearchType=Stem" target="_blank)

I'm trying to catch and fix bad email values from an external system sync in a before insert trigger, but when I test this in the Developer console, the before trigger is not even started before I get a System.DmlException error with INVALID_EMAIL_ADDRESS.  I'm running the test through the Execute Anonymous Window so that it is not submitted through the standard UI.  Has anyone else found how to get around the system validation in order to get into a before insert trigger?

I have a situation where I have an optional lookup (PO Line Item) and a master detail field (Sub Account) on an Invoice record.  The PO Line Item object also links to a Sub Account and I want to default this Sub Account value from a selected PO Line Item into the Invoice's Sub Account field.  You don't always have to choose a PO Line Item; in the case that there is no PO you simply select a Sub Account manually.

 

To accomplish this I have an actionSupport component that calls a controller method onchange to run SOQL on the selected PO Line Item to pull its Sub Account into the invoice's Sub Account field.  The user is picking a PO Line Item before they have set a Sub Account, thus that MD field is blank when they select a PO Line Item.  This gives a validation error when the action function runs.  

 

To avoid the error, I added ActionRegion tags around the PO Line Item field so that only the PO Line Item value is sent.  But this means the rest of the data that I have entered so far is lost in the rerender.

 

Any thoughts on how to accomplish this - avoid the error on requiring a value in an MD field but keep the values in all the other fields after the rerender?

Thisis the error I am getting when trying to convert a lead. No reason, just this error. I have checked required fields and mappings and everything seems to check out. I have checked that record type is not Master for the profile. There are no validations or process builders or workflows or flows causing the problem. These are all web-to-lead with the same lead source and what we call lead source detail.

This should be simple. I am trying to convert a lead to an existing account, not creating an oppty. So, basically I am creating a new contact on the Account.
User-added image

Was not sure where to categorize this, let me know if you have a better place for it.

shannon
 
From Salesforce documentation, the order of execution says that there is no system validation run prior to the 'before insert' trigger if the request is coming from sources other than standard UI, and that these will run instead after the 'before insert' trigger is executed.

Apex Developers Guide reference: http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_triggers_order_of_execution.htm?SearchType=Stem (http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_triggers_order_of_execution.htm?SearchType=Stem" target="_blank)

I'm trying to catch and fix bad email values from an external system sync in a before insert trigger, but when I test this in the Developer console, the before trigger is not even started before I get a System.DmlException error with INVALID_EMAIL_ADDRESS.  I'm running the test through the Execute Anonymous Window so that it is not submitted through the standard UI.  Has anyone else found how to get around the system validation in order to get into a before insert trigger?
I thought this was not allowed - this morning I forgot I was looking at Production code in Eclipse, made some changes and saved.  It took!  Is this a change to Salesforce's policy on editing code in Production?  Anyone else notice this?
  • February 01, 2014
  • Like
  • 0

I have a situation where I have an optional lookup (PO Line Item) and a master detail field (Sub Account) on an Invoice record.  The PO Line Item object also links to a Sub Account and I want to default this Sub Account value from a selected PO Line Item into the Invoice's Sub Account field.  You don't always have to choose a PO Line Item; in the case that there is no PO you simply select a Sub Account manually.

 

To accomplish this I have an actionSupport component that calls a controller method onchange to run SOQL on the selected PO Line Item to pull its Sub Account into the invoice's Sub Account field.  The user is picking a PO Line Item before they have set a Sub Account, thus that MD field is blank when they select a PO Line Item.  This gives a validation error when the action function runs.  

 

To avoid the error, I added ActionRegion tags around the PO Line Item field so that only the PO Line Item value is sent.  But this means the rest of the data that I have entered so far is lost in the rerender.

 

Any thoughts on how to accomplish this - avoid the error on requiring a value in an MD field but keep the values in all the other fields after the rerender?

In my pageBlockTable, when the "Quantity" is changed, it would be a action and reRender this table,

when the table is rerenderd, the focus in this table would be lost, so i'm trying to re-focus the last element.

here is my code:

<apex:page controller="Mycontroller">
<script type="text/javascript">
   var elementFocus = null;
   function setFocus(){
       elementFocus = document.activeElement;
   }
   function retainFocus(){
       elementFocus.focus();
   }
</script>
 <apex:form >
   <apex:pageBlock>
      <apex:pageBlockTable value="{!wrappers}" var="wrapper" id="wtable">
         <apex:column headerValue="Quantity">
             <apex:inputField value="{!wrapper.sub.Quantity__c}" id="Quantity__c">
                 <apex:actionSupport event="onchange" action="{!doSomething}"

                     <!-- before take action, set current focus. oncomplete, retain that focus -->
                     onbeforedomupdate="return setFocus()" rerender="wtable" oncomplete="return retainFocus()">
                 </apex:actionSupport>
             </apex:inputField>
         </apex:column>
         <apex:column headerValue="SalesPrice">
            <apex:inputField value="{!wrapper.sub.SalesPrice__c}" id="SalesPrice__c"/>
         </apex:column>
      </apex:pageBlockTable>
   </apex:pageBlock>
 </apex:form>
</apex:page>

 i use javascript to retain focus, and the alert also shows the right id, but elementFocus.focus(); just don't work.

should i include some other script?

<script type="text/javascript">
   var elementFocus = null;
   function setFocus(){
       elementFocus = document.activeElement;
       alert(elementFocus.id);
   }
   function retainFocus(){
       alert(elementFocus.id); //when debug, it shows the same value as the id in setFocus()
elementFocus.focus(); } </script>

 Any help would be much appreciated!

HI

 

I have a page that needs to do the occasional calculation then show the results afterwards which entails a section of the page to be rerendered. If the focus was within the rerendered area then the focus is lost. I want to put it back. I am aware that a lot of components that have an Action attribute also have a Focus attribute. Problem is I can't figure out how to tell it to return the focus to where it was. I am hoping that there is something like this:

 

focus="{!$CurrentPage.getComponentID.CurrentFocus}"

 

That would make life so easy. Not afraid of APEX or Javascript if they present a solution. Any and all help appreciated.

 

Regards

MellowRen

I am investigating a way to identify the last time a contact in our org was last contacted or used within the system. This includes being added to a campaign as a campaign member, having an activity on the record (task or event), being sent an external email from email marketing software and being added as a contact role on an opportunity, a contract, etc.

Now, I have been able to handle for all the above events EXCEPT for when a contact is added as a contact role. It seems that there is no way to display this information on the contact record or reference the date they were added as a contact role in a formula of any sort. I know I can run a report, but this is not an option for 350,000 contacts!

The reason behind this is basically for data protection, and not wanting to hold a contact record for longer than necessary.

I fear that I could get to a situation where I deactivate and then ultimately delete a contact prematurely when they had been added as a contact role to an important opportunity only last week!

Does anyone know of anyway that I can consolidate all contact roles a contact may have across any object and display this in some way on the contact record?

Thanks in advance,

Marco
I am trying to automatically submit a record for approval in a visualforce page but hitting some problems.  I tried following the Apex Approval Processing example (http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_process_example.htm) but I get this error:

Code:
System.DmlException: Process failed. First exception on row 0; first error: NO_APPLICABLE_PROCESS, No applicable approval 
process found.

 
So I thought I needed to create a ProcessInstance but trying to insert this results in:

Code:
System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, 
Required fields are missing: [ProcessDefinitionId, CurrentNodeId]: [ProcessDefinitionId, CurrentNodeId]

 
I have set up an approval process for my custom object and it is active so that doesn't seem to be the problem.  This is a controller extension for my VF page and the 'record' variable is the object that has been passed into the page.  Here is my function that uses the submit for approval :

Code:
public void SubmitApproval()
    {
/* Attempting to set up a ProcessInstance
ProcessInstance approvalProcess = new ProcessInstance(); approvalProcess.TargetObjectId = record.Id; //approvalProcess.ProcessDefinitionId = ; approvalProcess.Status = 'Started'; //approvalProcess.CurrentNodeId = ; //insert approvalProcess;
*/

// Create an approval request
  Approval.ProcessSubmitRequest approvalRequest = new Approval.ProcessSubmitRequest(); approvalRequest.setComments('Testing Approval Submit'); approvalRequest.setObjectId(record.Id); Approval.ProcessResult approvalResult = Approval.process(approvalRequest); if (!approvalResult.isSuccess()) { ApexPages.Message error = new ApexPages.Message(ApexPages.Severity.ERROR, 'There was an error with the Submit For Approval Request.'); ApexPages.addMessage(error); } }

 
Edit:  Just a quick update.  If I submit the record for approval using the normal way I can then create a commandButton that approves the pending request.  This approval doesn't run into any problems at all.  I must be missing something from my Submit request.






Message Edited by XactiumBen on 06-24-2008 03:21 AM

Message Edited by XactiumBen on 06-24-2008 03:50 AM