You need to sign in to do that
Don't have an account?
SamirKhan
reload parent VF page when button on inline VF page is clicked
We have a running functionality like there is a VF detail page and then there is an inline vf page which just contains couple of buttons. When we click on any button , new vf page opens in a new window.
Now what we want to achieve is that when we click a button on inline vf page , instead of opening a vf page in new window,we want to open that same window in place of the parent page.
Is this possible. Can some one guide me to a small demo if possible?
my inline vf page
My controller
Now what we want to achieve is that when we click a button on inline vf page , instead of opening a vf page in new window,we want to open that same window in place of the parent page.
Is this possible. Can some one guide me to a small demo if possible?
my inline vf page
<apex:page StandardController="gii__SalesOrder__c" extensions="giic_SalesOrderDetailButtonsCtrl"> <apex:includeScript value="{!URLFOR($Resource.Datatable,'datatable/js/jquery-1.11.1.min.js')}"/> <apex:outputPanel id="scriptPanel"> <script> <apex:repeat value="{!jsFunctionMap}" var="funcTemp"> {!jsFunctionMap[funcTemp]} </apex:repeat> $j = jQuery.noConflict(); // Render table only when rest of document is loaded. $j(document).ready(function() { tempFunction(); }); </script> </apex:outputPanel> <apex:form id="soBtnForm" styleClass="soBtnFormCls"> <apex:actionFunction name="tempFunction" action="{!tempFunction}" rerender="scriptPanel"/> <apex:dynamicComponent componentValue="{!dynamicForm}"/> <apex:repeat value="{!jsFunctionMap}" var="funcTemp"> <apex:commandButton onclick="{!funcTemp}return false;" value="Say Hi"/> </apex:repeat> </apex:form> </apex:page>
My controller
public class giic_SalesOrderDetailButtonsCtrl { public gii__SalesOrder__c salesOrder{get;set;} public Map<String, String> buttonsWithURLMap{get;set;} public Map<String, String> jsFunctionMap {get;set;} public String tempURL; //public List<Component.Apex.CommandButton> weblinks{get;set;} //public Component.Apex.CommandButton weblink{get;set;} public giic_SalesOrderDetailButtonsCtrl(ApexPages.StandardController controller) { salesOrder = (gii__SalesOrder__c) controller.getRecord(); //weblinks = new List<Component.Apex.CommandButton>(); buttonsWithURLMap = new Map<String, String>(); jsFunctionMap = new Map<String, String>(); jsFunctionMap.put('tempFunc();','function tempFunc(){}'); HttpRequest req = new HttpRequest(); req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID()); req.setHeader('Content-Type', 'application/json'); req.setEndpoint('https://cs1.salesforce.com/services/data/v34.0/tooling/query/?q=SELECT+Id,+Description,+DisplayType,+LinkType,+FullName,+Metadata,+Name,+NamespacePrefix,+OpenType,+Position,ShowsLocation,+Url,+Width+FROM+WebLink+WHERE+EntityDefinition.QualifiedAPiName=\'gii__SalesOrder__c\''); req.setMethod('GET'); Http http = new Http(); Integer count = 1; String funcName = 'tempFunc'; HttpResponse res = http.send(req); WebLinkList listButtons = (WebLinkList)JSON.deserialize(res.getBody(), WebLinkList.class); for(WebLinkWrapper button: listButtons.records){ if(button.LinkType == 'javascript'){ jsFunctionMap.put(funcName+count+'();','function '+funcName+count+'(){'+button.Url+'}'); count++; } } } public Component.Apex.PageBlock getDynamicForm() { Component.Apex.PageBlock dynPageBlock = new Component.Apex.PageBlock(); HttpRequest req = new HttpRequest(); req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID()); req.setHeader('Content-Type', 'application/json'); req.setEndpoint('https://cs1.salesforce.com/services/data/v34.0/tooling/query/?q=SELECT+Id,+Description,+DisplayType,+LinkType,+FullName,+Metadata,+Name,+NamespacePrefix,+OpenType,+Position,ShowsLocation,+Url,+Width+FROM+WebLink+WHERE+EntityDefinition.QualifiedAPiName=\'gii__SalesOrder__c\''); req.setMethod('GET'); Http http = new Http(); Integer count =1; String funcName = 'tempFunc'; HttpResponse res = http.send(req); List<Component.Apex.CommandButton> weblinks = new List<Component.Apex.CommandButton>(); WebLinkList listButtons = (WebLinkList)JSON.deserialize(res.getBody(), WebLinkList.class); for(WebLinkWrapper button: listButtons.records){ if(button.LinkType == 'url' || button.LinkType == 'page'){ String url = button.Url; tempURL = url; buttonsWithURLMap.put(button.Metadata.masterLabel, url); Component.Apex.CommandButton weblink = new Component.Apex.CommandButton(); weblink.value = button.Metadata.masterLabel; String Trul = '\''+'/servlet/servlet.Integration?scontrolCaching=1&lid='+button.id+'&eid='+salesOrder.id+'&ic=1'+'\''; weblink.onclick='openIntegration('+Trul+', "_self")'; //weblink.onclick='navigateToUrl('+Trul+', \'DETAIL\');'; // weblink.onclick='window.open('+Trul+',"_system")'; weblinks.add(weblink); } if(button.LinkType == 'javascript'){ Component.Apex.CommandButton weblink = new Component.Apex.CommandButton(); weblink.value = button.Metadata.masterLabel; String tempId = String.valueOf(button.id).subString(0,15); weblink.onclick= funcName+count+'();return false'; count++; weblinks.add(weblink); } } for(Component.Apex.CommandButton weblink: weblinks){ dynPageBlock.childComponents.add(weblink); } return dynPageBlock; } public void tempFunction(){ } public PageReference updateOrder(){ PageReference pf = new PageReference('/apex/giic_checkValidationOrder?id='+salesOrder.gii__Account__c+'&button=order&soid='+salesOrder.id); return pf; } public class WebLinkList{ public List<WebLinkWrapper> records{get;set;} } public class WebLinkWrapper{ public String LinkType{get;set;} public String Name{get;set;} public String Id{get;set;} public String Url{get;set;} public WebLinkMetadata Metadata{get;set;} } public class WebLinkMetadata{ public String masterLabel{get;set;} } }