• Samiullah saudagar
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
Salesforce experts,

I have following use case:
A custom object related to an Account.
The related list is added into Account's page layout.
From a custom button a Visualforce page is opened, which initializes the custom object, fills the values and saves it.
After clicking the confirm button on VF page, the user is redirected back to Account page.

Everything works as designed on SF Classic.
BUT on Lightning the related list is not updated, although the object is created successfully. First after clicking the related list or refreshing the page manuelly, new record is shown.

<apex:commandButton> contains action returning redirected PageReference is tried first:
VF page:
......
<apex:commandButton value="AddList" action={!addList}"/>
......
Controller:
......
public PageReference addList() {

  // Logic to create custom object. 
 
 PageReference pageRef = new PageReference('/' + ApexPages.currentPage().getParameters().get('id')); 
 pageRef.setRedirect(true);
 return  pageRef;
}
......

If commandButton action returns redirection (pageRef is set), JS in oncomplete is not triggered. None of the following works. Just for test purposes.
<apex:commandButton value="AddList" action={!addList}" oncomplete="alert('blabla');"/>
<apex:commandButton value="AddList" action={!addList}" oncomplete="window.opener.location.refresh();"/>
<apex:commandButton value="AddList" action={!addList}" oncomplete="sforce.one.navigateToSObject('objId');"/>

Aliasing controller method through <apex:actionFunction> then JS:
......
<script>
  function myComp() {
  	  addListAction();
  	  sforce.one.navigateToURL('objId');
	  //alert('blabla');
  }
</script>
<apex:actionFunction name="addListAction" action="{!addList}"/>
<apex:commandButton value="AddList" oncomplete="myComp();"/>
......
JS is triggered but no effect on Lightning.

This is already an old question but no answer could be found by searching through the community/internet.
I really hope someone already found a workaround (without using Lighting component or event) and can help me out here.
Tried suggestions from these resources and much more, none of them works.
https://www.forcetalks.com/salesforce-topic/navigate-to-url-is-not-refreshing-the-page-in-salesforce-lightning/
https://developer.salesforce.com/forums/?id=906F0000000MGSsIAO
Hi,

Currently we are working on cases, created queues and assingned users. One of the user from that queue is created a case, but after creating case we are getting following message instead of redircting to the list view or list of records

The case has been successfully saved and assigned to the appropriate user or queue according to the active assignment rules. you no longer have access view or edit the case.

please let me know any possible solution for this.

Thanks
Raj


 
Hello,  

I have a visualforce page which has an apexActionFunciton which returns a PageReference which initiates a file download (the URL returned in the pagereference is a signed URL from an external file system).  What I would ideally like to do is to close my visualforce page once the ActionFunction completes however the onComplete does not execute in the apex:actionFunction  (presumably because the PageReference has caused the execution to leave the Visualforce page).
All I wish to do is to close the Visualforce page on completing the actionFunction,

Does anyone know of the best way this can be achieved?

Thanks in advance for any suggestions.

Request help in multiplying values in Two  Fields (UnitPrice__c  & QuantitySold__c}

& display the value in edit mode in 3rd Field (TotalSale__c)

 

All the 03 Fields are  Number type

 

 -----------------------------------VF Page------------------------------------------------------------------------------
               
  <apex:inputField id="IDUnitPrice" value="{!opportunity.UnitPrice__c}" ></apex:inputField>
  <apex:inputField id="IDQtySold" value="{!opportunity.QuantitySold__c}"  onkeyup="javascript&colon;CalculateAmount();">  

  </apex:inputField>
  <apex:inputField id="IDTotalSale" label="Total Sale" value="{!opportunity.TotalSale__c}"></apex:inputField>
 ------------------------------------Script -----------------------------------------------------------------------------------

function CalculateAmount()
      {  
        
         var Price =  VALUE(UnitPrice__c.);
         var Qty = VALUE(QuantitySold__c);
         
         var Amount =  Price * Qty;      
      
         VALUE(TotalSale__c) = Amount;
      }