• Herish Surendran
  • NEWBIE
  • 50 Points
  • Member since 2019


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 12
    Replies
<template>
    <lightning-card>
        <h3 slot="title">
            <lightning-icon icon-name="utility:connected_apps" size="small"></lightning-icon>
            Card Title
        </h3>
        <div slot="footer">
                <lightning-badge label="Tag1"></lightning-badge>
                <lightning-badge label="Tag2"></lightning-badge>
                <lightning-badge label="Tag3"></lightning-badge>
        </div>
        <p class="slds-p-horizontal_small">Card Body (custom component)</p>
    </lightning-card>
</template>

 
And he asked me can we use Process Builder for this scenario. I said Yes. So he asked which automation tool is better to perform this scenario. I couldn't answer to this question. Can anyone tell when to use workflow rule and when to use Process Builder, I mean in which scenario should we use workflow rule and in which scenario should we use Process Builder. 

When I check for challenge I get

Challenge Not yet complete... here's what's wrong:
Please check the configuration of the custom fields on the Account object. The formulas, rollup summaries, etc. did not produce the expected outcome.

1)  Field Label - Number of deals                 
     Field Name - Number_of_deals  
     API Name - Number_of_deals__c
     Data Type - Roll-Up Summary           
     Summary Type - COUNT
     Summarized Object - Opportunity  
      Filter Criteria - Nothing

2) Field Label - Number of won deals
    Field Name - Number_of_won_deals  
    API Name - Number_of_won_deals__c
    Data Type - Roll-Up Summary
    Summary Type - COUNT
    Summarized Object - Opportunity  
     Filter CriteriaStage - EQUALS Closed Won

3) Field Label - Last won deal date
    Field Name - Last_won_deal_date  
    API Name - Last_won_deal_date__c
   Data Type - Roll-Up Summary
   Summary Type - MAX
   Summarized Object - Opportunity  
   Field to Aggregate - Opportunity: Close Date
   Filter CriteriaStage - EQUALSClosed Won

4) Field Label - Deal win percent
    Field Name - Deal_win_percent  
    API Name - Deal_win_percent__c
    Decimal Places - 0  
    IF (Number_of_deals__c > 0, (Number_of_won_deals__c /                       Number_of_deals__c), 0)
 
5) Field Label - Amount of won deals
    Field Name - Amount_of_Won_Deals  
    API Name - Amount_of_Won_Deals__c
    Data Type - Roll-Up Summary
    Summary Type - SUM
   Summarized Object - Opportunity  
    Field to AggregateOpportunity: Amount
    Filter CriteriaStage - EQUALSClosed Won

6) Field Label - Call for Service
    Field Name - Call_for_Service  
    API Name - Call_for_Service__c
    Data Type - Formula(Text) 
    IF(OR(TODAY() - 730 > Last_won_deal_date__c , TODAY() + 730        < Last_won_deal_date__c ), 'Yes','No')

i am trying to connect a dev hub in visual studio.

When I try to execute the command force:auth:web:login -d -a DevHub, I am getting an error ERROR running force:auth:web:login:  Cannot start the OAuth redirect server on port PortInUseAction. 

Try this: 
Kill the process running on port 1717 or use a custom connected app and update OauthLocalPort in the sfdx-project.json file.  
var firstnameRegex = "[a-zA-Z]";
       var firstname = component.get("v.First_Name");
       var FirstnameMatch = firstname.match(firstnameRegex);

if(FirstnameMatch == false){
            alert("Please fill in the mandatory details");
        }

I tried this but it didn't work
Visualforce page
<apex:page controller="LightningComponentRedirectClass">
    <apex:form>
        <apex:commandButton value="Continue" action="{!Continuebutton}"/>
    </apex:form>
</apex:page>
VisualForce Page controller
public class LightningComponentRedirectClass {

    public PageReference Continuebutton(){
        String name = 'Herish';
        String url ='https://mydomain.lightning.force.com/lightning/n/Component_Name?First_Name' + name;
        PageReference LC = new PageReference(url);
        return LC;
    }
}

I am able to redirect from Visualforce page to lightning component (added to lightning application which is created in Lightning app builder). But I am not able to pass parameter from Visualforce page to Lightning component. Could anyone suggest me on how to achieve this.
 
Lightning Application
<aura:application >
    <c:WrapperComponent/>
</aura:application>

Lightning component
<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="person" >
    <aura:attribute type="person.WrapperClass" name="testAttribute" />
    
    <lightning:input value="{!v.testAttribute.firstName}" name="first"/>
    
    <lightning:input value="{!v.testAttribute.lastName}" name="last"/>
                    <button class="slds-button slds-button_brand" onclick="{!c.submit}">Submit</button>

</aura:component>

Controller of component
({
	submit : function(component, event, helper) {
        
		 var action = component.get("c.getSuccess");
        action.setParams({ 
            obj : component.get('v.testAttribute')
        });
        
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {

                alert("From server: " + response.getReturnValue());

            }
            else if (state === "INCOMPLETE") {
                alert("From server : Sorry server call is incomplete");
            }
            else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " + 
                                 errors[0].message);
                    }
                } else {
                    console.log("Unknown error");
                }
            }
        });
        $A.enqueueAction(action);
    }
	
})

Ape
global with sharing class person {
   
    
    public class WrapperClass {
    @AuraEnabled
        public String firstName;
    @AuraEnabled
        Public String lastName;        
}
    @AuraEnabled
    public Static String getSuccess(WrapperClass obj){
        String r ='';
        if(obj.firstName == 'text' && obj.lastName=='text')
        { r='hi';}
        
		return r;
        
    }    

}

x class
I wold like to display this error on click the button. I want to do it this way only. Can anyone tell me how can it be done.
 
({
navigate : function(component, event, helper) {
        var navigateEvent = $A.get("e.force:navigateToComponent");
        navigateEvent.setParams({
            componentDef: "c:RegistrationFormTutorial"
        });
        navigateEvent.fire();
    }
})

I want to navigate from one lightning component to another component (RegistrationFormTutorial). I have written the above code. But I am getting error like this:


" This page has an error. You might just need to refresh it. Action failed: c:HtmlTryout$controller$navigate [Cannot read property 'setParams' of undefined] Failing descriptor: {c:HtmlTryout$controller$navigate} "

Could anyone please help me on this. Thanks in advance.
({
	navigate : function(component, event, helper) {
        var navigateEvent = $A.get("e.force:navigateToComponent");
        navigateEvent.setParams({
            componentDef: "c.RegistrationFormTutorial"
        });
        navigateEvent.fire();
	}
})

I want to navigate from one lightning component to another component (RegistrationFormTutorial). I have written the above code. But I am getting error like this:


" This page has an error. You might just need to refresh it. Action failed: c:HtmlTryout$controller$navigate [Cannot read property 'setParams' of undefined] Failing descriptor: {c:HtmlTryout$controller$navigate} "

Could anyone please help me on this. Thanks in advance.
<apex:page standardController="Account">


<script>
function colorPageBlock(pageblock, color) {
if (pageblock != null) pageblock.firstChild.style.cssText = “background-color: ” + color + “;”;

}
</script>


<apex:form>


<apex:pageBlock title="My Content" mode="detail">
<apex:pageBlockSection id="redSection" title="My Content Section" columns="2">
<apex:inputField value="{!account.name}"/>
<apex:inputField value="{!account.site}"/>
<script>colorPageBlock(document.getElementById("{!$Component.redSection}"), "red");</script>
</apex:pageBlockSection>

<apex:pageBlockSection id="greenSection" title="My Content Section" columns="2">
<apex:inputField value="{!account.name}"/>
<apex:inputField value="{!account.site}"/>
<script>colorPageBlock(document.getElementById("{!$Component.greenSection}"), "green");</script>
</apex:pageBlockSection>

<apex:pageBlockSection id="orangeSection" title="My Content Section" columns="2">
<apex:inputField value="{!account.name}"/>
<apex:inputField value="{!account.site}"/>
<script>colorPageBlock(document.getElementById("{!$Component.orangeSection}"), "orange");</script>
</apex:pageBlockSection>
</apex:pageBlock>

</apex:form>

</apex:page>

 
<apex:page controller="SignUpPage">
<apex:form >
    <apex:pageBlock title="Profile Details">
    *Required Field
 <apex:pageBlockSection >
    <apex:inputText value="{!sup.User_Name__c}" label="User Name *"/>
    <br></br>
    <apex:inputsecret value="{!sup.Type_Password__c}" label="Type Password *"/>
    <br></br>
    <apex:inputsecret value="{!sup.Retype_Password__c}" label="Retype Password *"/>
    <br></br>
    <apex:commandButton value="Create Profile" action="{!CreateProfile}"/><br></br>    
   </apex:pageBlockSection>
 </apex:pageBlock>
</apex:form>
</apex:page>
And he asked me can we use Process Builder for this scenario. I said Yes. So he asked which automation tool is better to perform this scenario. I couldn't answer to this question. Can anyone tell when to use workflow rule and when to use Process Builder, I mean in which scenario should we use workflow rule and in which scenario should we use Process Builder. 
i am trying to connect a dev hub in visual studio.

When I try to execute the command force:auth:web:login -d -a DevHub, I am getting an error ERROR running force:auth:web:login:  Cannot start the OAuth redirect server on port PortInUseAction. 

Try this: 
Kill the process running on port 1717 or use a custom connected app and update OauthLocalPort in the sfdx-project.json file.  
Lightning Application
<aura:application >
    <c:WrapperComponent/>
</aura:application>

Lightning component
<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="person" >
    <aura:attribute type="person.WrapperClass" name="testAttribute" />
    
    <lightning:input value="{!v.testAttribute.firstName}" name="first"/>
    
    <lightning:input value="{!v.testAttribute.lastName}" name="last"/>
                    <button class="slds-button slds-button_brand" onclick="{!c.submit}">Submit</button>

</aura:component>

Controller of component
({
	submit : function(component, event, helper) {
        
		 var action = component.get("c.getSuccess");
        action.setParams({ 
            obj : component.get('v.testAttribute')
        });
        
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") {

                alert("From server: " + response.getReturnValue());

            }
            else if (state === "INCOMPLETE") {
                alert("From server : Sorry server call is incomplete");
            }
            else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " + 
                                 errors[0].message);
                    }
                } else {
                    console.log("Unknown error");
                }
            }
        });
        $A.enqueueAction(action);
    }
	
})

Ape
global with sharing class person {
   
    
    public class WrapperClass {
    @AuraEnabled
        public String firstName;
    @AuraEnabled
        Public String lastName;        
}
    @AuraEnabled
    public Static String getSuccess(WrapperClass obj){
        String r ='';
        if(obj.firstName == 'text' && obj.lastName=='text')
        { r='hi';}
        
		return r;
        
    }    

}

x class
({
	navigate : function(component, event, helper) {
        var navigateEvent = $A.get("e.force:navigateToComponent");
        navigateEvent.setParams({
            componentDef: "c.RegistrationFormTutorial"
        });
        navigateEvent.fire();
	}
})

I want to navigate from one lightning component to another component (RegistrationFormTutorial). I have written the above code. But I am getting error like this:


" This page has an error. You might just need to refresh it. Action failed: c:HtmlTryout$controller$navigate [Cannot read property 'setParams' of undefined] Failing descriptor: {c:HtmlTryout$controller$navigate} "

Could anyone please help me on this. Thanks in advance.
<apex:page controller="SignUpPage">
<apex:form >
    <apex:pageBlock title="Profile Details">
    *Required Field
 <apex:pageBlockSection >
    <apex:inputText value="{!sup.User_Name__c}" label="User Name *"/>
    <br></br>
    <apex:inputsecret value="{!sup.Type_Password__c}" label="Type Password *"/>
    <br></br>
    <apex:inputsecret value="{!sup.Retype_Password__c}" label="Retype Password *"/>
    <br></br>
    <apex:commandButton value="Create Profile" action="{!CreateProfile}"/><br></br>    
   </apex:pageBlockSection>
 </apex:pageBlock>
</apex:form>
</apex:page>