You need to sign in to do that
Don't have an account?
Akrati
custom lightning button not getting fired on community page
Hi,
I am a newbie in salesforce, I have created a custom lightning button on my community page. I want to trigger different community pages on click of this button depending upon the logged in user's profile.
unfortunately my button is not performing any event on being clicked in the community.
Here are my code from component, apex controller and js controller. Kindly suggest what could be possibly wrong in my code.
Lightning component -
<aura:component controller="DemoController" implements="lightning:availableForFlowScreens,force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<aura:attribute name= "guestuser" type= "String"/>
<aura:handler name="init" value="{!this}" action="{!c.doinit}" />
<lightning:quickActionAPI aura:id="quickActionAPI" />
<lightning:button variant="brand" label="Submit Case"
onclick="{! c.clicksubmitcasebutton }" />
<lightning:flow aura:id="flowData" />
</aura:component>
Apex controller -
public class DemoController {
@AuraEnabled
Public static string CheckLoginUser(){
User u = [select id, Profile.name FROM user where id=:userinfo.getUserId()];
string profilename = u.profile.name;
return profilename;
}
}
JS controller -
({
doinit : function (component, event, helper){
var action= component.get("c.CheckLoginUser");
action.setCallback(this, function(response){
if (state === "SUCCESS"){
component.set("v.guestuser", response.getReturnValue());
}
}
)},
clicksubmitcasebutton : function (component, event, helper) {
if ("v.guestuser" == "CMS Customer Profile"){
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
"url": "/CreateCase"
})}
else {
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
"url": "/CreateCaseRegisteredUser"
})};
urlEvent.fire();
);
I am a newbie in salesforce, I have created a custom lightning button on my community page. I want to trigger different community pages on click of this button depending upon the logged in user's profile.
unfortunately my button is not performing any event on being clicked in the community.
Here are my code from component, apex controller and js controller. Kindly suggest what could be possibly wrong in my code.
Lightning component -
<aura:component controller="DemoController" implements="lightning:availableForFlowScreens,force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<aura:attribute name= "guestuser" type= "String"/>
<aura:handler name="init" value="{!this}" action="{!c.doinit}" />
<lightning:quickActionAPI aura:id="quickActionAPI" />
<lightning:button variant="brand" label="Submit Case"
onclick="{! c.clicksubmitcasebutton }" />
<lightning:flow aura:id="flowData" />
</aura:component>
Apex controller -
public class DemoController {
@AuraEnabled
Public static string CheckLoginUser(){
User u = [select id, Profile.name FROM user where id=:userinfo.getUserId()];
string profilename = u.profile.name;
return profilename;
}
}
JS controller -
({
doinit : function (component, event, helper){
var action= component.get("c.CheckLoginUser");
action.setCallback(this, function(response){
if (state === "SUCCESS"){
component.set("v.guestuser", response.getReturnValue());
}
}
)},
clicksubmitcasebutton : function (component, event, helper) {
if ("v.guestuser" == "CMS Customer Profile"){
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
"url": "/CreateCase"
})}
else {
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
"url": "/CreateCaseRegisteredUser"
})};
urlEvent.fire();
);