-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
3Questions
-
0Replies
open record from search in dynamic tab - just like standard in dealer community
hello,
open record from search in dynamic tab - just like standard in dealer community
currently it is redirecting record to the same page.
comp:
<aura:handler name="oSelectedRecordEvent" event="c:selectedsObjectRecordEvent" action="{!c.handleComponentEvent} " />
controller:
handleComponentEvent : function(component, event, helper) {
// get the selected case record from the COMPONETN event
var selectedAccountGetFromEvent = event.getParam("recordByEvent");
component.set("v.selectedRecord" , selectedAccountGetFromEvent);
var forclose = component.find("lookup-pill");
$A.util.addClass(forclose, 'slds-show');
$A.util.removeClass(forclose, 'slds-hide');
var forclose = component.find("searchRes");
$A.util.addClass(forclose, 'slds-is-close');
$A.util.removeClass(forclose, 'slds-is-open');
var lookUpTarget = component.find("lookupField");
$A.util.addClass(lookUpTarget, 'slds-hide');
$A.util.removeClass(lookUpTarget, 'slds-show');
var navEvt = $A.get("e.force:navigateToSObject");
//var evt = $A.get("e.force:navigateToComponent");
// window.open('/' +''+ event.getParam(selectedAccountGetFromEvent.Id)+);
navEvt.setParams({
"recordId": selectedAccountGetFromEvent.Id,
"slideDevName": "details"
// componentDef : "c:CSP_customLookupResult",
});
navEvt.fire();
}
Thanks in advance
open record from search in dynamic tab - just like standard in dealer community
currently it is redirecting record to the same page.
comp:
<aura:handler name="oSelectedRecordEvent" event="c:selectedsObjectRecordEvent" action="{!c.handleComponentEvent} " />
controller:
handleComponentEvent : function(component, event, helper) {
// get the selected case record from the COMPONETN event
var selectedAccountGetFromEvent = event.getParam("recordByEvent");
component.set("v.selectedRecord" , selectedAccountGetFromEvent);
var forclose = component.find("lookup-pill");
$A.util.addClass(forclose, 'slds-show');
$A.util.removeClass(forclose, 'slds-hide');
var forclose = component.find("searchRes");
$A.util.addClass(forclose, 'slds-is-close');
$A.util.removeClass(forclose, 'slds-is-open');
var lookUpTarget = component.find("lookupField");
$A.util.addClass(lookUpTarget, 'slds-hide');
$A.util.removeClass(lookUpTarget, 'slds-show');
var navEvt = $A.get("e.force:navigateToSObject");
//var evt = $A.get("e.force:navigateToComponent");
// window.open('/' +''+ event.getParam(selectedAccountGetFromEvent.Id)+);
navEvt.setParams({
"recordId": selectedAccountGetFromEvent.Id,
"slideDevName": "details"
// componentDef : "c:CSP_customLookupResult",
});
navEvt.fire();
}
Thanks in advance
- Raghavi shivaram
- March 12, 2020
- Like
- 0
- Continue reading or reply
opentab() I need to open my record (from search) in dynamic tab in the same page - Help needed
Hello ,
i need to open the record in dymanic tab in community. currently no click action is bein performed
code:
cmp:
<aura:handler label="Open Tab" name="oSelectedRecordEvent" event="c:selectedsObjectRecordEvent" action="{!c.handleComponentEvent} " />
controller:
handleComponentEvent: function(component, event, helper) {
var navEvt = $A.get("e.force:navigateToSObject");
var workspaceAPI = component.find("workspace");
workspaceAPI.openTab({
pageReference: {
"type": "standard__recordPage",
"attributes": {
"recordId": selectedAccountGetFromEvent.Id,
"actionName":"view"
},
"state": {}
},
focus: true
}).then(function(response) {
workspaceAPI.getTabInfo({
tabId: response
}).then(function(tabInfo) {
console.log("The recordId for this tab is: " + tabInfo.recordId);
});
}).catch(function(error) {
console.log(error);
});
navEvt.fire();
},
handleComponentEvent : function(component, event, helper) {
var navEvt = $A.get("e.force:navigateToSObject");
var workspaceAPI = component.find("workspace");
workspaceAPI.openTab({
"recordId": selectedAccountGetFromEvent.Id,
focus: true
}).then(function(response) {
workspaceAPI.getTabInfo({
tabId: response
}).then(function(tabInfo) {
console.log("The url for this tab is: " + tabInfo.url);
});
})
.catch(function(error) {
console.log(error);
});
navEvt.fire();
},
handleComponentEvent : function(component, event, helper) {
var navEvt = $A.get("e.force:navigateToSObject");
var workspaceAPI = component.find("workspace");
//var URLlink= HYPERLINK("https://csp2dev-mergedealer.cs102.force.com/CSPDealerCommunity/s","_self" );
workspaceAPI.openTab({
url: URLlink,
focus: true
}).then(function(response) {
workspaceAPI.getTabInfo({
tabId: response
}).then(function(tabInfo) {
console.log("The recordId for this tab is: " + tabInfo.recordId);
});
}).catch(function(error) {
console.log(error);
});
navEvt.fire();
},
Thanks in advance
i need to open the record in dymanic tab in community. currently no click action is bein performed
code:
cmp:
<aura:handler label="Open Tab" name="oSelectedRecordEvent" event="c:selectedsObjectRecordEvent" action="{!c.handleComponentEvent} " />
controller:
handleComponentEvent: function(component, event, helper) {
var navEvt = $A.get("e.force:navigateToSObject");
var workspaceAPI = component.find("workspace");
workspaceAPI.openTab({
pageReference: {
"type": "standard__recordPage",
"attributes": {
"recordId": selectedAccountGetFromEvent.Id,
"actionName":"view"
},
"state": {}
},
focus: true
}).then(function(response) {
workspaceAPI.getTabInfo({
tabId: response
}).then(function(tabInfo) {
console.log("The recordId for this tab is: " + tabInfo.recordId);
});
}).catch(function(error) {
console.log(error);
});
navEvt.fire();
},
handleComponentEvent : function(component, event, helper) {
var navEvt = $A.get("e.force:navigateToSObject");
var workspaceAPI = component.find("workspace");
workspaceAPI.openTab({
"recordId": selectedAccountGetFromEvent.Id,
focus: true
}).then(function(response) {
workspaceAPI.getTabInfo({
tabId: response
}).then(function(tabInfo) {
console.log("The url for this tab is: " + tabInfo.url);
});
})
.catch(function(error) {
console.log(error);
});
navEvt.fire();
},
handleComponentEvent : function(component, event, helper) {
var navEvt = $A.get("e.force:navigateToSObject");
var workspaceAPI = component.find("workspace");
//var URLlink= HYPERLINK("https://csp2dev-mergedealer.cs102.force.com/CSPDealerCommunity/s","_self" );
workspaceAPI.openTab({
url: URLlink,
focus: true
}).then(function(response) {
workspaceAPI.getTabInfo({
tabId: response
}).then(function(tabInfo) {
console.log("The recordId for this tab is: " + tabInfo.recordId);
});
}).catch(function(error) {
console.log(error);
});
navEvt.fire();
},
Thanks in advance
- Raghavi shivaram
- March 12, 2020
- Like
- 0
- Continue reading or reply
custom search not working in partner community
hello,
I have a custom search replaing global search box. It is working well in the salesforce whereas , not performing any action in tha partner commuity..
1) i have apex and comity added to my profile.
Please find my code below.
customsearch.cmp
<aura:component implements="forceCommunity:availableForAllPageTypes,forceCommunity:searchInterface,force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome" controller="CustomSearchControllerapex">
<aura:attribute name="searchText" type="String" default=""/>
<div class="slds-form-element slds-lookup" data-select="single">
<div class="slds-form-element__control">
<div class="slds-input-has-icon slds-input-has-icon--right">
<lightning:buttonIcon iconName="utility:search" variant="bare" onclick="{! c.handleClick }" alternativeText="Search" class="slds-input__icon" />
<ui:inputText value="{!v.searchText}" class="slds-lookup__search-input slds-input" placeholder="Search" />
</div>
</div>
</div>
</aura:component>
customearchcontroller
({
handleClick : function(component, event, helper) {
var searchText = component.get('v.searchText');
var action = component.get('c.searchForIds');
action.setParams({searchText: searchText});
action.setCallback(this, function(response) {
var state = response.getState();
if (state === 'SUCCESS') {
alert('in here');
var ids = response.getReturnValue();
sessionStorage.setItem('customSearch--recordIds', JSON.stringify(ids));
var navEvt = $A.get('e.force:navigateToComponent');
navEvt.setParams({componentDef: "c:customSearchResultsList",componentAttributes :{"recordIds": ids}});
console.log(navEvt);
navEvt.fire();
}
});
$A.enqueueAction(action);
}
})
customsearchHelper
({
SearchHelper: function(component, event) {
// show spinner message
component.find("Id_spinner").set("v.class" , 'slds-show');
var action = component.get("c.fetchAccount");
action.setParams({
'searchKeyWord': component.get("v.searchKeyword")
});
action.setCallback(this, function(response) {
// hide spinner when response coming from server
component.find("Id_spinner").set("v.class" , 'slds-hide');
var state = response.getState();
if (state === "SUCCESS") {
var storeResponse = response.getReturnValue();
// if storeResponse size is 0 ,display no record found message on screen.
if (storeResponse.length == 0) {
component.set("v.Message", true);
} else {
component.set("v.Message", false);
}
// set numberOfRecord attribute value with length of return value from server
component.set("v.TotalNumberOfRecord", storeResponse.length);
// set searchResult list with return value from server.
component.set("v.searchResult", storeResponse);
}else if (state === "INCOMPLETE") {
alert('Response is Incompleted');
}else if (state === "ERROR") {
var errors = response.getError();
if (errors) {
if (errors[0] && errors[0].message) {
alert("Error message: " +
errors[0].message);
}
} else {
alert("Unknown error");
}
}
});
$A.enqueueAction(action);
},
})
customsearch.css
.THIS .slds-input__icon{
margin-top: -.8rem;
}
.THIS {
padding: 0 10px;
}
customsearchdesign
<design:component label="CSP_Custom Search"> </design:component>
customsearchresuluitem.cmp
<aura:component implements="forceCommunity:availableForAllPageTypes,force:hasRecordId,forceCommunity:searchInterface,force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome" access="global">
<aura:attribute name="record" type="Object"/>
<aura:attribute name="simpleRecord" type="Object"/>
<aura:attribute name="recordError" type="String"/>
<force:recordData aura:id="recordLoader"
recordId="{!v.recordId}"
layoutType="COMPACT"
targetRecord="{!v.record}"
targetFields="{!v.simpleRecord}"
targetError="{!v.recordError}"
/>
<!-- Display a header with details about the record -->
<div class="slds-page-header" role="banner">
<p class="slds-text-heading--label">{!v.simpleRecord.Name}</p>
<h1 class="slds-page-header__title slds-m-right--small slds-truncate slds-align-left"><a href="{! $Site.siteUrlPrefix + '/' + v.simpleRecord.Id}">Go to details</a></h1>
</div>
<!-- Display Lightning Data Service errors, if any -->
<aura:if isTrue="{!not(empty(v.recordError))}">
<div class="recordError">
<ui:message title="Error" severity="error" closable="true">
{!v.recordError}
</ui:message>
</div>
</aura:if>
</aura:component>
customsarchresultlist.cmp
<aura:component implements="forceCommunity:availableForAllPageTypes,forceCommunity:searchInterface,force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome" access="global">
<aura:attribute type="list" name="recordIds" />
<aura:handler name="init" value="{!this}" action="{!c.init}"/>
<h1>Search Results</h1>
<aura:iteration items="{!v.recordIds}" var="id">
<c:customSearchResultItem recordId="{!id}"/>
</aura:iteration>
</aura:component>
custosearchresulylistcontroller
({
init: function(component, event, helper) {
var idsJson = sessionStorage.getItem('customSearch--recordIds');
if (!$A.util.isUndefinedOrNull(idsJson)) {
var ids = JSON.parse(idsJson);
component.set('v.recordIds', ids);
sessionStorage.removeItem('customSearch--recordIds');
}
}
})
customsearchresultcontrollerapex.apxc
public class CustomSearchControllerapex {
@AuraEnabled
public static List<String> searchForIds(String searchText) {
List<List<SObject>> results = [FIND :searchText IN ALL FIELDS RETURNING Case(Id,CaseNumber)];
List<String> ids = new List<String>();
for (List<SObject> sobjs : results) {
for (SObject sobj : sobjs) {
ids.add(sobj.Id);
}
}
return ids;
}
}
kindly help me out. thanks in advance
I have a custom search replaing global search box. It is working well in the salesforce whereas , not performing any action in tha partner commuity..
1) i have apex and comity added to my profile.
Please find my code below.
customsearch.cmp
<aura:component implements="forceCommunity:availableForAllPageTypes,forceCommunity:searchInterface,force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome" controller="CustomSearchControllerapex">
<aura:attribute name="searchText" type="String" default=""/>
<div class="slds-form-element slds-lookup" data-select="single">
<div class="slds-form-element__control">
<div class="slds-input-has-icon slds-input-has-icon--right">
<lightning:buttonIcon iconName="utility:search" variant="bare" onclick="{! c.handleClick }" alternativeText="Search" class="slds-input__icon" />
<ui:inputText value="{!v.searchText}" class="slds-lookup__search-input slds-input" placeholder="Search" />
</div>
</div>
</div>
</aura:component>
customearchcontroller
({
handleClick : function(component, event, helper) {
var searchText = component.get('v.searchText');
var action = component.get('c.searchForIds');
action.setParams({searchText: searchText});
action.setCallback(this, function(response) {
var state = response.getState();
if (state === 'SUCCESS') {
alert('in here');
var ids = response.getReturnValue();
sessionStorage.setItem('customSearch--recordIds', JSON.stringify(ids));
var navEvt = $A.get('e.force:navigateToComponent');
navEvt.setParams({componentDef: "c:customSearchResultsList",componentAttributes :{"recordIds": ids}});
console.log(navEvt);
navEvt.fire();
}
});
$A.enqueueAction(action);
}
})
customsearchHelper
({
SearchHelper: function(component, event) {
// show spinner message
component.find("Id_spinner").set("v.class" , 'slds-show');
var action = component.get("c.fetchAccount");
action.setParams({
'searchKeyWord': component.get("v.searchKeyword")
});
action.setCallback(this, function(response) {
// hide spinner when response coming from server
component.find("Id_spinner").set("v.class" , 'slds-hide');
var state = response.getState();
if (state === "SUCCESS") {
var storeResponse = response.getReturnValue();
// if storeResponse size is 0 ,display no record found message on screen.
if (storeResponse.length == 0) {
component.set("v.Message", true);
} else {
component.set("v.Message", false);
}
// set numberOfRecord attribute value with length of return value from server
component.set("v.TotalNumberOfRecord", storeResponse.length);
// set searchResult list with return value from server.
component.set("v.searchResult", storeResponse);
}else if (state === "INCOMPLETE") {
alert('Response is Incompleted');
}else if (state === "ERROR") {
var errors = response.getError();
if (errors) {
if (errors[0] && errors[0].message) {
alert("Error message: " +
errors[0].message);
}
} else {
alert("Unknown error");
}
}
});
$A.enqueueAction(action);
},
})
customsearch.css
.THIS .slds-input__icon{
margin-top: -.8rem;
}
.THIS {
padding: 0 10px;
}
customsearchdesign
<design:component label="CSP_Custom Search"> </design:component>
customsearchresuluitem.cmp
<aura:component implements="forceCommunity:availableForAllPageTypes,force:hasRecordId,forceCommunity:searchInterface,force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome" access="global">
<aura:attribute name="record" type="Object"/>
<aura:attribute name="simpleRecord" type="Object"/>
<aura:attribute name="recordError" type="String"/>
<force:recordData aura:id="recordLoader"
recordId="{!v.recordId}"
layoutType="COMPACT"
targetRecord="{!v.record}"
targetFields="{!v.simpleRecord}"
targetError="{!v.recordError}"
/>
<!-- Display a header with details about the record -->
<div class="slds-page-header" role="banner">
<p class="slds-text-heading--label">{!v.simpleRecord.Name}</p>
<h1 class="slds-page-header__title slds-m-right--small slds-truncate slds-align-left"><a href="{! $Site.siteUrlPrefix + '/' + v.simpleRecord.Id}">Go to details</a></h1>
</div>
<!-- Display Lightning Data Service errors, if any -->
<aura:if isTrue="{!not(empty(v.recordError))}">
<div class="recordError">
<ui:message title="Error" severity="error" closable="true">
{!v.recordError}
</ui:message>
</div>
</aura:if>
</aura:component>
customsarchresultlist.cmp
<aura:component implements="forceCommunity:availableForAllPageTypes,forceCommunity:searchInterface,force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome" access="global">
<aura:attribute type="list" name="recordIds" />
<aura:handler name="init" value="{!this}" action="{!c.init}"/>
<h1>Search Results</h1>
<aura:iteration items="{!v.recordIds}" var="id">
<c:customSearchResultItem recordId="{!id}"/>
</aura:iteration>
</aura:component>
custosearchresulylistcontroller
({
init: function(component, event, helper) {
var idsJson = sessionStorage.getItem('customSearch--recordIds');
if (!$A.util.isUndefinedOrNull(idsJson)) {
var ids = JSON.parse(idsJson);
component.set('v.recordIds', ids);
sessionStorage.removeItem('customSearch--recordIds');
}
}
})
customsearchresultcontrollerapex.apxc
public class CustomSearchControllerapex {
@AuraEnabled
public static List<String> searchForIds(String searchText) {
List<List<SObject>> results = [FIND :searchText IN ALL FIELDS RETURNING Case(Id,CaseNumber)];
List<String> ids = new List<String>();
for (List<SObject> sobjs : results) {
for (SObject sobj : sobjs) {
ids.add(sobj.Id);
}
}
return ids;
}
}
kindly help me out. thanks in advance
- Raghavi shivaram
- February 29, 2020
- Like
- 0
- Continue reading or reply