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


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 28
    Replies
Hi All,

I have a MultiSelectPickList field in User and Picklist in custom object. I need to compare such a way that piclist value is present in MultiSelectPickList in validation rule. I tried using INCLUDES($User.MultiSelectPickList,TEXT(Picklist)) but I got Error: Incorrect parameter type for function 'INCLUDES()'. Expected Text Literal, received Text. I analised this error and i got solution from here
https://ipfs-sec.stackexchange.cloudflare-ipfs.com/salesforce/A/question/148489.html to use triggers. 

Now my question is, is there any way to compare rather than using triggers. is there any  way to compare in  Condition Formula in validation rule 

Thanks,
sai
 
<table style="tableCss font-family: arial, sans-serif; border-collapse: collapse; width: 100%;">
      <aura:iteration items="{!v.listValue}" var="cus" indexVar="key">
           <tr>
              <td style="border: 1px solid black; text-align: left; padding: 8px;border-color: 
                black;">
                    <input type="radio" id="Phone" name="verificationMethod" value=" 
                       {!cus.value}" checked = "false" onchange="{!c.selectMethod}"/>
                    <label class="slds-text-heading_small">&nbsp;{!cus.key}&nbsp;{!cus.value} 
                    </label>
               </td>
           </tr>
      </aura:iteration>
</table>

 
<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>
Hii Developers,
Please help to write test class for this part of code.
code
Income_Tax__c ITax=[select id,Rent_paid_to_landlord__c,Leave_travel_concessions_or_assistance__c,Employees_PF__c,
                            Interest_payable_paid_to_lender__c,Children_s_Education_Fee__c,PPF__c,Insurance_Premium__c,
                            NSC__c,Deduction_under_Pension_scheme__c,Housing_loan_principal_repayment__c,ELSS_Mutual_Fund__c,
                            NPS__c,Payment_for_Medical_Insurance_Premium__c,Medical_treatment_for_handicapped__c,
                            Medical_for_specified_diseases__c,Education_Loan_Interest_Repayment__c,Interest_on_loan_taken_for_house__c,
                            Donation__c,Rent_deduction_only_if_HRA_not_received__c,Saving_interest__c,Rebate_of_Rs_2000__c,RGESS__c,
                            Royalty__c,Professional_Development_Allowance__c,Car_Maintenance_Allowance__c,
                            Conveyance_Allowance__c,Helper_Allowance__c,Telephone_Internet_allowance__c,
                            Tax_by_previous_employer__c,TDS_already_deducted_by_Current_Company__c,Donation_to_Other__c
                            from Income_Tax__c where id=:tax.id];
        If(ITax.Rent_paid_to_landlord__c!=null){
            Attachment a = new Attachment(parentid=tax.id, Name = 'Rent paid to landlord.jpeg' , Body = myfile.body);
            try {insert a;}
            catch(Exception ex){
                ApexPages.addMessages(ex);
                return null;
            }
        }
        
        If(ITax.Leave_travel_concessions_or_assistance__c!=null){
            Attachment a1 = new Attachment(parentid=tax.id, Name = 'Leave travel concessions or assistance.jpeg', Body = myfile1.body);
            try {insert a1;}
            catch(Exception ex){
                ApexPages.addMessages(ex);
                return null;
            }
        }
        
        If(ITax.Interest_payable_paid_to_lender__c!=null){
            Attachment a2 = new Attachment(parentid=tax.id, Name = 'Interest payable paid to lender.jpeg' , Body = myfile2.body);
            try {insert a2;}
            catch(Exception ex){
                ApexPages.addMessages(ex);
                return null;
            }
        }
        
        If(ITax.Employees_PF__c!=null){
            Attachment a3 = new Attachment(parentid=tax.id, Name = 'Employees Provident Fund.jpeg' , Body = myfile3.body);
            try {insert a3;}
            catch(Exception ex){
                ApexPages.addMessages(ex);
                return null;
            }
        }
        
        If(ITax.Children_s_Education_Fee__c!=null){
            Attachment a4 = new Attachment(parentid=tax.id, Name = 'Children Education Fee.jpeg' , Body = myfile4.body);
            try {insert a4;}
            catch(Exception ex){
                ApexPages.addMessages(ex);
                return null;
            }
        }

Please help me
Thank you.
  • July 29, 2020
  • Like
  • 0
Hi All,

I have a MultiSelectPickList field in User and Picklist in custom object. I need to compare such a way that piclist value is present in MultiSelectPickList in validation rule. I tried using INCLUDES($User.MultiSelectPickList,TEXT(Picklist)) but I got Error: Incorrect parameter type for function 'INCLUDES()'. Expected Text Literal, received Text. I analised this error and i got solution from here
https://ipfs-sec.stackexchange.cloudflare-ipfs.com/salesforce/A/question/148489.html to use triggers. 

Now my question is, is there any way to compare rather than using triggers. is there any  way to compare in  Condition Formula in validation rule 

Thanks,
sai
 
Hi,
I am trying to remove the change owner button on lead object. I removed the modify all permission and unchecked the Transfer records permission on the respective profile. Still I am not able to remove the button.User-added imageUser-added imageUser-added imagePlease help me out on this
Currently, I am using OAuth2 authorization code flow to authenticate REST services, but when I am doing request to get authorization code like this
 https://login.salesforce.com/services/oauth2/authorize?
 client_id=3MVG9IHf89I1t8hrvswazsWedXWY0i1qK20PSFaInvUgL 
 redirect_uri=https://www.mycustomerorderstatus.com/oauth2/callback& response_type=code

It requires the login & to click allow access then it redirects to my callback URL with accessCode. So I want to skip this process & auto-approve it because I am using it as background service & not interacting with user for login

How to auto approve Salesforce REST API OAuth2 authorization_code flow to not show allow pop-up.
Hi i have a question. We would like to auto delete all incomplete task in a given opportunity when 2 criteria are met. First is when there is a discharge date and second  is when there is a discharge reason.

Trial with Process Builder
The 2 crterias that we would like to be met are shown below;

Discharge Date and Reason

Hi All,

We have an approval process for Contract object which have a Field Update action when user Reject the Contract (Contract Status to Rejected).
There is a Contract record that got Expired before the user can Approve/Reject.
And now the user got stuck in the approval process because they can't Reject the Contract (Rejected status value is not available in an Expired contract). I have fixed it for now by removing the Field Update action (to Rejected) - Reject it - and add the Field Update action again.
Any idea how we can prevent this from happening?
For example, it will be good if we can stop/cancel the approval process when Contract status changed to Expired.
Do we have to use Apex to cancel/stop the ongoing approval process?

Thank you so much for the help.

Cheers.

Hello, I have a class that is supposed to send a VF template. The debug logs are saying it is sent, but the email is not going out. Can someone help to fix my email class? What am I missing? 

CLASS
Global class LeadOwnerEmail implements Schedulable{
 Global void execute(SchedulableContext SC) {
        
List<User> uList = [select id, email from user where id in (select  ownerid from community_lead__c)];    
List<Id> listids= new List<Id>();

for(User u :uList) {
 EmailTemplate et=[Select id from EmailTemplate where name = 'LeadOwnerEmail'];
 Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();     
mail.setTargetObjectId(u.id);
mail.setSenderDisplayName('Lead Ownership');
 mail.setTemplateId(et.id);
    mail.setSaveAsActivity(false);
 String[] toAddresses = new String[] {u.email};
mail.setToAddresses(toAddresses);
     system.debug('**To Addresses: ' + u.email);
//mail.setReplyTo(liaisonEmail);
       try { 
 Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
           system.debug('**SENT!!!');
   return;
    } catch (Exception e) {
    System.debug(e.getMessage());
   }
    }
}
}


VF EMAIL
<messaging:emailTemplate subject="Your Team's Leads- Owner Assignments" recipientType="User" relatedToType="User">

 <messaging:htmlEmailBody >
   Hi {!RelatedTo.firstName},
  <p>The following leads have not yet been updated:</p>
   <c:leadsinfo ToID="{!RelatedTo.Id}" />
 <p>To update these leads, click on the "Lead Status" field located  in the upper right on the lead page layout.</p>
 </messaging:htmlEmailBody>

</messaging:emailTemplate>
Hello,

Before starting, I know about DML operations and the order they should be performed in for test cases. Please do not comment on that. These test cases succeed and have been succeeding in partial and production for over 2 years. 

We recently enabled the Office 365 Outlook Configuration and we started getting test cases failing in production.

Here is the error that we see:
first error: MIXED_DML_OPERATION, DML operation on setup object is not permitted after you have updated a non-setup object (or vice versa): Case, original object: S2XUserMap: []

We saw this was once an issue in Winter'18 but has (apparently) been fixed.

https://trailblazer.salesforce.com/issues_view?id=a1p3A0000008gVyQAI

I think my next step is to go through all of the test cases and use a user and profile that is not mapped in the Outlook Office 365 config. These would be used in just the test case execution. 

Our current test cases were written by persona/profile so that we would test specific areas that our code needed to run against. We do create users and use System.runAs() for that test. 

Does anyone else have this happening to them also? Or did this happen to anyone else?
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