function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jessimcqjessimcq 

FinishLocation Issues - Apex

So, I have scoured these forums and several other forums, and while I have found many threads that sort of answer bits and pieces of my plight, I haven't found anything that works the way I need it to yet.

 

I am brand new to Apex, so I am fully expecting the answer to be staring me in the face without my notice. Any help would be immensely appreciated.

 

 

Basically, I have a custom object called Support Tickets (SFDC_Support_Tickets) and I have created a flow for it (Support_Ticket_Creator) that allows users to make one of three record types. In the flow builder, I have set a variable to capture the record's ID for use later in the flow (SupportTicketID) and I have embedded the flow into a Visualforce page (Create_New_Support_Ticket). All I need is for the 'finish' button to take the user to the record that they've just created.

 

 

I have tried every variation of solution that I have found. The main issue that I am running into is that I keep getting an error on the Apex Class telling me that SupportTicketID doesn't exist.

 

Here is the code that I have:

 

VisualForce

<apex:page Controller="Support_Ticket_Creator" tabstyle="SFDC_Support_Tickets__c" >
    <br/>
    <flow:interview name="Support_Ticket_Creator" interview="{!SupportTicketCreator}" finishLocation="{!SupportTicketID}"/>
    <apex:param name="vOpportunityId" value="{!opptyId}"/>
</apex:page>

Apex

public with sharing class Support_Ticket_Creator {

 

     public String SupportTicketCreator { get; set; }

 

     public String getOpptyId() { return getoppId; }

     public ID returnID = getoppId;


     public PageReference getSupportTicketID () {

            if(SupportTicketCreator != null) returnID = Support_Ticket_Creator.SupportTicketID;

            PageReference send = new PageReference('/' + returnID);
            send.setRedirect(true);
            return send;
    }

 

}

 

 

Above is my latest attempt, and the error that I am getting is: 

ErrorError: Compile Error: Variable does not exist: getoppId at line 5 column 41

 

 

So, can anyone help? I am so very stuck and our February release is looming. I appreciate any assistance that anyone can provide!

ibtesamibtesam

Hi,

 

You have missed the declaration of variable oppId.

Try this...

 

public with sharing class Support_Ticket_Creator {

 

     public String SupportTicketCreator { get; set; }

     public String oppId;

 

     public String getOpptyId() { return oppId; }

     public ID returnID = oppId;


     public PageReference getSupportTicketID () {

            if(SupportTicketCreator != null) returnID = Support_Ticket_Creator.SupportTicketID;

            PageReference send = new PageReference('/' + returnID);
            send.setRedirect(true);
            return send;
    }

 

}

jessimcqjessimcq

Thank you so much for your help! That got rid of that error message, but now I am getting the following:

 

ErrorError: Compile Error: Variable does not exist: Support_Ticket_Creator.SupportTicketID at line 11 column 57

 

This is supposed to call the variable SupportTicketID from the Flow itself, and is the format I've seen in many other solutions, but I am apparently missing something. I attempted to declare it as a variable like we did with oppId, but it didn't like that either.

 

I went back to the flow to make sure that SupportTicketID was created and used to identify the Record ID on the record create step. I just need to be able to pull that from the flow and stick it in a URL for FinishLocation. 

 

Thank you so much for your help so far... do you have any other thoughts?

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
public with sharing class Support_Ticket_Creator {
 
     public String SupportTicketCreator { get; set; }
     public String oppId;
 
     public String getOpptyId() { return oppId; }
     public ID returnID = oppId;

     public PageReference getSupportTicketID () {

            if(SupportTicketCreator != null) returnID = 'Support_Ticket_Creator.SupportTicketID';

            PageReference send = new PageReference('/' + returnID);
            send.setRedirect(true);
            return send;
    }
 
}