• craskulinecz
  • NEWBIE
  • 50 Points
  • Member since 2007

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 14
    Replies

Hey Guys,

 

This one has just popped up on a clients org when running test classes, im frantically searching through the config to make sure no one has change something to unique but i havent found anything yet, any ideas?

 

System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: <unknown> duplicates value on record with id: <unknown>

Is there a way to redirect a flow at the end to a website external to Salesforce.com?

 

Thanks,

 

Chris

I'm having an issue with Visual Workflow in that when I pass variables to the flow from a link, if the form has fields that have a validation rule on them, if that rule gets triggered by not filling in the input, when the form gets reloaded automatically to show the error messages, the full URL string is replaced by a generic string and doesn't pass in the variables the second time.

 

So for example, if I have the following URL on a force.com site:

http://test.force.com/test/vftestflow?v1=abc&v2=123

 

There are validation rules on the Name and email fields on the form.

 

When a person submits the form without filling in their email address the error message displays but the URL is now:

http://test.force.com/test/vftestflow

 

without any of the URL variables.

 

If they then fill in the form correctly and then submit the form, it now says:

 

Authorization Required

You must first log in or register before accessing this page. If you have forgotten your password, click Forgot Password to reset it.

 

Any Ideas on how to fix this?

 

Thanks,

 

Chris

 

Is there a way to customize a visual workflow form? More so than just putting it on a visualforce page. What I want to be able to do is customize the layout of the actual form, take off or change the format of the labels for the fields, add customized text within the form, etc. 

 

I'd also like to be able to put help text within the form field but don't want that text to be submitted as part of the form if the field is left blank.

 

Thanks,

 

Chris

Is there a way to customize the error message when a field is required on an input screen in a flow? I'm not seeing it, but I want to make sure I'm not missing something.

 

I know you can add a custom error message if the validation rule for the field but that won't work in my case because if the field is required and left blank, the validation rule won't even run.

 

I guess I could do it all with a validation rule, but then I can't have it show the red bar to indicate that the field is required. The other issue is that I'd want a different message for blank vs. an invalid input such as numbers in a name field.

 

Thoughts?

 

Thanks,

 

Chris

I am trying to get my finish page from the flow to go to different places based on the result of a decision in the flow. If a case is created in the flow, the finish location is the case, if it's not created, the finish location is a custom object called Conversation__c. What's happening is that it is giving an error

 

System.NullPointerException: Attempt to de-reference a null object
Class.CaseFlowController.getFinishPage: line 34, column 1

 

And I don't know how to fix this. Line 34 is the if statement in getFinishPage().

 

Code for the Controller:

public class CaseFlowController {

    private final Conversation__c conv;
    public CaseFlowController(ApexPages.StandardController stdController) {
    	this.conv = (Conversation__c)stdController.getRecord();
    }


	//Calls referenced Flow below
	public Flow.Interview.createCasefromConversation createCasefromConversation { get; set; }
	//Gets Id of variables below from flow
	public String getconversationID() {
		if (createCasefromConversation==null){
		 return '';
		}else{ 
			System.Debug('ConversationID:' + createCasefromConversation.conversationId);
			return createCasefromConversation.conversationId;
		}
		
	}
	

	public String getcaseID() {
		if (createCasefromConversation==null) {
			return '';
			} else {
				System.Debug('CaseId:' + createCasefromConversation.createdCaseId);
				return createCasefromConversation.createdCaseId;
		}
	}
	
	//Used for Flow finish location
	public PageReference getFinishPage(){ 
		if(createCasefromConversation.createdCaseId == ''){	
			PageReference p = new PageReference('/' + getconversationID());
			p.setRedirect(true);
			system.debug('Page conversation' + p);
			return p;
			
		}else {
			PageReference p = new PageReference('/' + getcaseID());
			p.setRedirect(true);
			system.debug('Page case' + p);
			return p;
		}
	}

}

 

 

Here is the code for the Visual Force Page:

<apex:page StandardController="Conversation__c" extensions="CaseFlowController">
   <flow:interview name="createCasefromConversation" interview="{!createCasefromConversation}" finishLocation="{!FinishPage}" />

</apex:page>

 

Any help would be greatly appreciated.

 

Thanks,

 

Chris

Is there a way to use CAPTCHA within a Visual Workflow form? I have a form that will be available to the public and I want to prevent spam from the form. If there is no way to use CAPTCHA, is there another way to get the same type of functionality?

 

Thanks,


Chris

Has anyone used the Agile/SCRUM methodologies for developing SFDC enhancements? We're implementing this and I am trying to get input on how it can be used with SFDC. Any input would be appreciated.

Thanks,

Chris Raskulinecz
CRM Administrator
Kelley Blue Book
The Trusted Resource
www.kbb.com
Ok, I'm getting the following error when using this Apex Trigger.

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger copyMSGIdCases caused an unexpected exception, contact your administrator: copyMSGIdCases: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.copyMSGIdCases: line 21, column 56

Here is the code I am using:

Code:
// This trigger assigns a value to the MSG_ID__c custom field on cases before the new case
// is saved to the database.

trigger copyMSGIdCases on Case (before insert, before update) {
 // Determine the account
 Set<ID> accIds = new Set<ID>();
 for (Case cas : Trigger.new)
  accIds.add(cas.accountid);
 // Query the Account to get the MSG_ID__c entry
 Map<Id, Account> entries = new Map<Id, Account>(
  [select MSG_ID__c, PAS_ID__c from Account
  where id in :accIds]);
 
 // Now set the Account_MSG_ID__c on the Contact to be the same as MSG_ID__c on the
 // related account
 // Now set the PAS_Account_ID__c on the Case to be the same as PAS_ID__c on the
 // related account
 for (Case cas : Trigger.new)
 cas.MSG_ID__c = entries.get(cas.AccountId).MSG_ID__c;
 for (Case cas : Trigger.new)
 cas.PAS_Account_ID__c = entries.get(cas.AccountId).PAS_ID__c;

}
Now, I'm sure this can be done in a different way, but I went this route because I wanted to learn more about Apex Triggers.

So here is the funny thing, I only get this error if I am trying to create a new case as an regular user in SFDC. If I am logged in as the System Administrator, it all executes fine with no errors and does what I expect it to do.

Let me clarify, I am logged in as a System Admin User and then from there, go to Manage Users->Users, and choose the user I want to login as and then press the login button.

 Has anyone run into this before?

Any suggestions?
 

Message Edited by craskulinecz on 10-16-2007 10:36 PM

Message Edited by craskulinecz on 10-16-2007 10:38 PM

Is there a way to customize the error message when a field is required on an input screen in a flow? I'm not seeing it, but I want to make sure I'm not missing something.

 

I know you can add a custom error message if the validation rule for the field but that won't work in my case because if the field is required and left blank, the validation rule won't even run.

 

I guess I could do it all with a validation rule, but then I can't have it show the red bar to indicate that the field is required. The other issue is that I'd want a different message for blank vs. an invalid input such as numbers in a name field.

 

Thoughts?

 

Thanks,

 

Chris

I am trying to get my finish page from the flow to go to different places based on the result of a decision in the flow. If a case is created in the flow, the finish location is the case, if it's not created, the finish location is a custom object called Conversation__c. What's happening is that it is giving an error

 

System.NullPointerException: Attempt to de-reference a null object
Class.CaseFlowController.getFinishPage: line 34, column 1

 

And I don't know how to fix this. Line 34 is the if statement in getFinishPage().

 

Code for the Controller:

public class CaseFlowController {

    private final Conversation__c conv;
    public CaseFlowController(ApexPages.StandardController stdController) {
    	this.conv = (Conversation__c)stdController.getRecord();
    }


	//Calls referenced Flow below
	public Flow.Interview.createCasefromConversation createCasefromConversation { get; set; }
	//Gets Id of variables below from flow
	public String getconversationID() {
		if (createCasefromConversation==null){
		 return '';
		}else{ 
			System.Debug('ConversationID:' + createCasefromConversation.conversationId);
			return createCasefromConversation.conversationId;
		}
		
	}
	

	public String getcaseID() {
		if (createCasefromConversation==null) {
			return '';
			} else {
				System.Debug('CaseId:' + createCasefromConversation.createdCaseId);
				return createCasefromConversation.createdCaseId;
		}
	}
	
	//Used for Flow finish location
	public PageReference getFinishPage(){ 
		if(createCasefromConversation.createdCaseId == ''){	
			PageReference p = new PageReference('/' + getconversationID());
			p.setRedirect(true);
			system.debug('Page conversation' + p);
			return p;
			
		}else {
			PageReference p = new PageReference('/' + getcaseID());
			p.setRedirect(true);
			system.debug('Page case' + p);
			return p;
		}
	}

}

 

 

Here is the code for the Visual Force Page:

<apex:page StandardController="Conversation__c" extensions="CaseFlowController">
   <flow:interview name="createCasefromConversation" interview="{!createCasefromConversation}" finishLocation="{!FinishPage}" />

</apex:page>

 

Any help would be greatly appreciated.

 

Thanks,

 

Chris

Is there a way to use CAPTCHA within a Visual Workflow form? I have a form that will be available to the public and I want to prevent spam from the form. If there is no way to use CAPTCHA, is there another way to get the same type of functionality?

 

Thanks,


Chris

We have DupeBlocker installed in our Salesforce instance. It works fine and as expected for all of the standard Account & Contact record creations that we do.

I have a new flow that I am making which contains a 'Record Create' node in the flow layout that creates a new Account record. This works fine for unique records that don't trigger DupeBlocker, however if I create a record that causes DupeBlocker to trigger, an exception is thrown saying "An unhandled fault has occurred in this flow". I've successfully added a 'FAULT' branch to my flow, which will bring up a screen of my own where I can show an error message, but what I really need to do is for the system to show the same DupeBlocker popup that users get with the standard Account record creation.

 

Does anyone have any experience with this kind of thing or have any kind of suggestions on how to attack the problem?

 

Thanks in advance.

 

-Matt Beitler
Chatham Financial

 

 

Hi I am stuck in a point which I believe is almost 'the end', but I am not just able to write test class for this.

 

I have a flow, which shows a list of Opportunities, one by one based on score. This flow has been referenced in a VF page:

<apex:page controller="OppPriorityController">
    <h1>Opportunity Prioritisation Wokflow</h1>
  <flow:interview name="Opportunity_Prioritisation_Flow" interview="{!myflow}" buttonLocation="bottom">
  <apex:param name="varCurrentUserID" value="{!$User.Id}"/> 
  </flow:interview>
</apex:page>

 The OppPriorityController is below:

public class OppPriorityController {

    // Need not instantiate explicitly the Flow object using the class constructor 
    
    public Flow.Interview.Opportunity_Prioritisation_Flow myflow { get; set; }
    public String getPhoneNumber() {
        // Access flow variables as simple member variables with get/set methods 
             return myflow.PhoneNumber; 
             }
    public String getAccountID() {
        // Access flow variables as simple member variables with get/set methods 
             return myflow.AccId;
    }
     public String getAccountName() {
        // Access flow variables as simple member variables with get/set methods 
             return myflow.AccountName;
    }
     public String getOpportunityID() {
        // Access flow variables as simple member variables with get/set methods 
             return myflow.OppId;
    }
     public String getOpportunityName() {
        // Access flow variables as simple member variables with get/set methods 
             return myflow.OppName;
    }
}

 The test class which I tried is below:

@isTest (SeeAllData=true)
private class OppPriorityControllerTest {
    public static testMethod void myTestMethodForFlow() {
        PageReference pageRef = Page.OppPriorityPage;
        Test.setCurrentPage(pageRef);
        OppPriorityController oppPriorityController = new OppPriorityController();        
        oppPriorityController.myflow = new Flow.Interview.Opportunity_Prioritisation_Flow(new Map<String, Object>());
        String pNumber = oppPriorityController.getPhoneNumber();
        String accountId = oppPriorityController.getAccountID() ;
        String accountName = oppPriorityController.getAccountName();
        String opportunityID = oppPriorityController.getOpportunityID();
        String opportunityName = oppPriorityController.getOpportunityName();
    }
}

 I received an error: Interview not started.

 

Any help here would be grateful. I tried to serach in various places, but none helped me to solve this.

 

 

 

 

I have a Visualforce Page that displays the Opportunities.

 

<apex:page standardController="Opportunity" tabStyle="Opportunity" extensions="OpportunityViewExtension">
  <apex:form >
    <apex:detail id="mylists" relatedList="true" showChatter="true" relatedListHover="true" />

   ....

</apex:page>

 

One of the fields from the PageLayout is another Visualforce Page.

 

<apex:page standardcontroller="Opportunity" extensions="OpportunityFinancialsEditor">
<style>
body{background-color:rgb(243, 243, 236);}
</style>
    <apex:form >
    <apex:pageblock>
    <apex:pagemessages />
    <apex:pageblocktable value="{!grid}" var="row">
        ...

    </apex:form>
</apex:page>

 

When this gates displayed on my Visualforce Page it simply makes the section blank with scrollbars.  When I display the Page using InternetExplorer it does the same thing, but also tells me there is an error saying that a reference in my Visualforce page that is displayed on the page layout is null.

Hey Guys,

 

This one has just popped up on a clients org when running test classes, im frantically searching through the config to make sure no one has change something to unique but i havent found anything yet, any ideas?

 

System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: <unknown> duplicates value on record with id: <unknown>

When dealing with the opportunity field Stage in a inputField, either through the standard controller or a custom controller, it shows every possible value of the Stage field regardless of record type.

Based on the record type of the opportunity is there any way to controller what stage values are displayed. Ideally in a custom controller but any guidance is appreciated.

Thanks.
  • March 19, 2008
  • Like
  • 0
Ok, I'm getting the following error when using this Apex Trigger.

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger copyMSGIdCases caused an unexpected exception, contact your administrator: copyMSGIdCases: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.copyMSGIdCases: line 21, column 56

Here is the code I am using:

Code:
// This trigger assigns a value to the MSG_ID__c custom field on cases before the new case
// is saved to the database.

trigger copyMSGIdCases on Case (before insert, before update) {
 // Determine the account
 Set<ID> accIds = new Set<ID>();
 for (Case cas : Trigger.new)
  accIds.add(cas.accountid);
 // Query the Account to get the MSG_ID__c entry
 Map<Id, Account> entries = new Map<Id, Account>(
  [select MSG_ID__c, PAS_ID__c from Account
  where id in :accIds]);
 
 // Now set the Account_MSG_ID__c on the Contact to be the same as MSG_ID__c on the
 // related account
 // Now set the PAS_Account_ID__c on the Case to be the same as PAS_ID__c on the
 // related account
 for (Case cas : Trigger.new)
 cas.MSG_ID__c = entries.get(cas.AccountId).MSG_ID__c;
 for (Case cas : Trigger.new)
 cas.PAS_Account_ID__c = entries.get(cas.AccountId).PAS_ID__c;

}
Now, I'm sure this can be done in a different way, but I went this route because I wanted to learn more about Apex Triggers.

So here is the funny thing, I only get this error if I am trying to create a new case as an regular user in SFDC. If I am logged in as the System Administrator, it all executes fine with no errors and does what I expect it to do.

Let me clarify, I am logged in as a System Admin User and then from there, go to Manage Users->Users, and choose the user I want to login as and then press the login button.

 Has anyone run into this before?

Any suggestions?
 

Message Edited by craskulinecz on 10-16-2007 10:36 PM

Message Edited by craskulinecz on 10-16-2007 10:38 PM