• Akrati
  • NEWBIE
  • 2 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
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();
 );
  • December 12, 2019
  • Like
  • 0

Hi,
I have a requirement where I am calling a lightning flow through lightning component from community builder in order to create case. 
 

My requirement is, I need to pass community page name to the component from which it is being called. 
I have 2 flows, which will be triggered based on the values of the page name.

Can anybody please guide me?

  • December 12, 2019
  • Like
  • 0