Use case: I have a JS button i'm converting and i'm curious on the standard procedure for this.

Button is list button on the case object that shows up on a custom objects record page. User clicks the button it pre-fills parent relationships on a custom object record and starts a VF page to input data on that new record

VF page uses standardController=account and has an extension thats a custom class

I need to pass not only the record id of the custom object (for a related lookup relationship) but the custom objects parent account record id as well.

var w = window; 
var html_doc = w.document.getElementsByTagName('head')[0]; 
var js = w.document.createElement('script');
var url = '/apex/SVC_TicketCreation?id={!SVC_Change_Request__c.AccountId__c}&crid={!SVC_Change_Request__c.Id}'; 
console.log('url - '+url);
var openSubtab = function openSubtab(result) {
w.sforce.console.openSubtab(result.id , url, true, 'Create Ticket', null, function() {}, 'Create Ticket');
navigateToUrl('/apex/SVC_TicketCreation?id={!SVC_Change_Request__c.AccountId__c}&crid={!SVC_Change_Request__c.Id}&srPos=0&srKp=a8g&isdtp=vw&isWsVw=true&nonce=4059b1c391b28d07029151c61fa17dfa05e9e273ca9e41bd98b6ec81decdbef4&sfdcIFrameOrigin=https%3A%2F%2Finsideigt--r3q.cs1.my.salesforce.com&isdtp=vw','Create Ticket','newTicket');

js.onload= function() { if(w.sforce.console.isInConsole() == false) { w.open(url,'_blank'); } else { w.sforce.console.getEnclosingPrimaryTabId(openSubtab);} };

So I'm thinking

  1. lightning component quick action, gets the record ids needed. (they click the quick action and it automatically does the following)

  2. js controller to pass those to the current apex extension, get set the inputData and outputData.

  3. Here's my question: should i call the VF page from the JS handler once i get a success state from the apex handler or call the VF page from the apex handler? What actually works. Because when the VF page starts i need it to call on the apex handler to run methods and retrieve those two record ids to put on the record.....

  4. User fills out the VF page but doesn't have to worry about getting the account and parent object ids they're already on the record (but not displayed on the current VF page)

maybe i'm over thinking it.

  • What is your actual question? Can you please edit this post to ask something? – Adrian Larson Apr 26 '19 at 20:56
  • done. basically should i call the VF page from the component or from the apex handler for the VF page? What will actually allow me to 1: create a record and prefill two fields with data 2: start a VF page that will start work on that record. – ensir Apr 26 '19 at 20:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.