• CharuDutt
  • ALL STAR
  • 5850 Points
  • Member since 2020
  • ACS


  • Chatter
    Feed
  • 191
    Best Answers
  • 0
    Likes Received
  • 5
    Likes Given
  • 2
    Questions
  • 735
    Replies
Trigger on Contact Object where object having custom currency field 'salary'. The requirement is with event after insert, after update and after delete, minimum and maximum salary of contact should get updated.

Kindly help,I will appreciate it a lot!
 Hi, can help me with how to have code coverage for this code?
trigger UpdateRecordOwner on Centive__c (before insert, before update) {
    
    Map<Id, User> userMap = new Map<Id, User>([select id, EmployeeNumber from user where (NOT UserRole.name like'IC%') AND (UserRoleId !=NULL)]);
    
    Map<String, Id> mapEmployeeNoToId = new Map<String, Id>();
    for(User u : userMap.values())
        mapEmployeeNoToId.put(u.EmployeeNumber, u.Id);
    for (Centive__c Centive: Trigger.new){
        if(mapEmployeeNoToId.get(Centive.HOT_Badge_ID__c) !=null)
            Centive.OwnerId = mapEmployeeNoToId.get(Centive.HOT_Badge_ID__c);
        System.debug('MapValue'+ mapEmployeeNoToId.get(Centive.HOT_Badge_ID__c));
        break;
    }
}

 
Hello,I have written an apex class and now testing the class to achieve 100% code coverage.I have followed the steps as per trailhead but now getting the following error.

@isTest
public Class AccountRelatedCase{
@isTest    
    public Static void list<Case> lstCases(string Accid){
    
    list<Case> lstCa = [SELECT AccountId,CaseNumber,Subject FROM Case WHERE status = 'New' And AccountId = :Accid];
    system.Debug(lstCa);
    return lstCa;
    }
}

Error:
Unexpected token 'list'.
I have two fields in my org Name and Legal Name. We need to ensure both fields are not an exact match. Below is the Syntax I have put:

Name  <>  Legal_Name__c

Can anyone help me rectify it?

How to add try catch for error handling for the below code

 

global class updatePolicyStatusSchedule implements Schedulable {
    global void execute(SchedulableContext ctx) {
        updatePolicyStatus();
    }
    
    public void updatePolicyStatus() {
        List<Policy__c> expiredInForcePolicies = [SELECT Id, Status__c, Policy_End_Date__c, Policy_Effective_Date__c
                                                  FROM Policy__c
                                                  WHERE (Policy_End_Date__c <= TODAY AND Status__c != 'Expired' AND Status__c != 'Terminated')
                                                  OR (Policy_Effective_Date__c <= TODAY AND Policy_End_Date__c > TODAY AND Status__c NOT IN ('In Force','In-Force - Non-Renewing'))];

        List<Policy__c> updateExpiredInForcePolicies = new List<Policy__c>();
        

        for(Policy__c policy : expiredInForcePolicies){
            if((policy.Policy_End_Date__c<=System.today() && policy.Status__c!='Expired' && policy.Status__c!='Terminated') && !(policy.Policy_Effective_Date__c <= System.today() && policy.Policy_End_Date__c > System.today() && (policy.Status__c!='In Force' || policy.Status__c!='In-Force - Non-Renewing'))){
                policy.Status__c = 'Expired';
            }

            if(!(policy.Policy_End_Date__c<=System.today() && policy.Status__c!='Expired' && policy.Status__c!='Terminated') && (policy.Policy_Effective_Date__c <= System.today() && policy.Policy_End_Date__c > System.today() && (policy.Status__c!='In Force' || policy.Status__c!='In-Force - Non-Renewing'))){
                policy.Status__c = 'In Force';
            }
            
            updateExpiredInForcePolicies.add(policy);
        }
    if(!updateExpiredInForcePolicies.isEmpty()){
            Database.update(updateExpiredInForcePolicies);  
        }
    }
}


Thanks In advance

"User cannot change status to invoicing if previous status was Pharma Payment, Member Payout, Payment Processing, or Complete".......(these are the picklist values) .


I tried this..but its not working.


IF(ISPICKVAL(Status__c,'Invoicing'), 
    ISPICKVAL(Status__c, 'Pharma Payment') ||
    ISPICKVAL(Status__c, 'Member Payout') ||
    ISPICKVAL(Status__c, 'Payment Processing') ||
    ISPICKVAL(Status__c, 'Complete')
 ,
false )



Response will be appreciated.


 
Original code:
global class LightningForgotPasswordController {

    public LightningForgotPasswordController() {

    }

    @AuraEnabled
    public static String forgotPassword(String username, String checkEmailUrl) {
        try {
            Site.forgotPassword(username);
            ApexPages.PageReference checkEmailRef = new PageReference(checkEmailUrl);
            if(!Site.isValidUsername(username)) {
                return Label.Site.invalid_email;
            }
            aura.redirect(checkEmailRef);
            return null;
        }
        catch (Exception ex) {
            return ex.getMessage();
        }
    }

    @AuraEnabled
    global static String setExperienceId(String expId) {    
        // Return null if there is no error, else it will return the error message 
        try {
            if (expId != null) {
                Site.setExperienceId(expId);               
            }
            return null; 
        } catch (Exception ex) {
            return ex.getMessage();            
        }        
    } 
}

Test class:
@IsTest(SeeAllData = true)
public with sharing class LightningForgotPasswordControllerTest {

 /* Verifies that ForgotPasswordController handles invalid usernames appropriately */
 @IsTest
 static void testLightningForgotPasswordControllerInvalidUserName() {
  System.assertEquals(LightningForgotPasswordController.forgotPassword('fakeUser', 'http://a.com'), Label.Site.invalid_email);
  System.assertEquals(LightningForgotPasswordController.forgotPassword(null, 'http://a.com'), Label.Site.invalid_email);
  System.assertEquals(LightningForgotPasswordController.forgotPassword('a', '/home/home.jsp'), Label.Site.invalid_email);
 }

 /* Verifies that null checkEmailRef url throws proper exception. */
 @IsTest
 static void testLightningForgotPasswordControllerWithNullCheckEmailRef() {
  System.assertEquals(LightningForgotPasswordController.forgotPassword('a', null), 'Argument 1 cannot be null');
  System.assertEquals(LightningForgotPasswordController.forgotPassword('a@salesforce.com', null), 'Argument 1 cannot be null');
 }

 /* Verifies that LightningForgotPasswordController object is instantiated correctly. */
 @IsTest
 static void LightningForgotPasswordControllerInstantiation() {
  LightningForgotPasswordController controller = new LightningForgotPasswordController();
  System.assertNotEquals(controller, null);
 }
}
public static void UpdateCreatedBy(list<Visit> vst){
        Set<Id> ownerIdSet = new Set<Id>();
        for(Visit c : vst){
            ownerIdSet.add(c.OwnerId);
        }
        Map<Id,User> userMap = new  Map<Id,User>([Select Id,userrole.developername From User Where Id =: ownerIdSet]); 
        for (visit Vs: vst){
            if(userMap.containsKey(vs.OwnerId)){
                string roleName = userMap.get(vs.OwnerId).UserRole.developername;
                if(string.isBlank(roleName) || roleName == null) continue;
                if(roleName.contains('FSO')){
                    vs.CREATED_BY_retail__c     ='Retail FSO';
                }
                else if(roleName.contains('SO')){
                    vs.CREATED_BY_retail__c     ='Retail SO';
                }
                
               
            }
        }
    }
trigger ContactCount on Contact (after insert, after update, after delete, after undelete) {
    
    if(Trigger.isinsert || Trigger.isupdate || trigger.isdelete || Trigger.isundelete){
       
        ContactCount.countcontacts(trigger.new,trigger.old);
        
    }
}

-----------
public class ContactCount {
    public static void countcontacts(List<contact> newcontact,List<contact> oldcontact){
     
        set<id> accids= new set<id>();
                try{
        if(newcontact !=null){
            for(Contact c:newcontact){
                if(c.AccountId!=null){
                accids.add(c.accountid);
                }
            }      
       }if(oldcontact!=null){
            for(Contact c:oldcontact){
                accids.add(c.accountid);
            }
       }
     List<Account> acc = [Select id, Number_of_Contacts__c,(Select id from Contacts) from Account where id IN: accids];
        if(acc!=null){
        for(Account accValue:acc){
            accValue.Number_of_Contacts__c = accValue.Contacts.size();
        } 
        }
        if(!acc.isempty()){
        update acc;
        }
        }
        catch(exception e){
            System.debug('Get Message'+e.getMessage());
        }
    } 
}
public class CaseAccount {
public static void (){
Account accts=[SELECT Id, name FROM Account WHERE Id NOT IN ( SELECT AccountId FROM Case WHERE IsClosed = true ) ] ; } }

Error I am getting :
1.static is not allowed on constructors
2.Invalid constructor name: method

What could be the reason and how do I navigate to solution. Previously I used static in other example and at that time I did not get any erros.

requirement: "Write a class to get the list of all open cases related to an account. Class should have one method with account id as an input parameter and return list of cases
I want to send an email to patient using trigger when a patient object is created with email.please send me the solution
public class LeadTriggerHandler {
public static void sendEmailforContact(List<Lead> newvalues){
        Set<Id> CampaignId = new Set<Id>();
        SET<ID> LeadId = new Set<ID>();
        for(Lead Leadldetails : newvalues){
            CampaignId.add(Leadldetails.CampaignId__c);
            LeadId.add(Leadldetails.Id);
        }
        if(!CampaignId.isEmpty()){
            Lead newlead =new Lead();
            List<String>  LeadfieldNames = new List<String>{'Id','Email','FirstName','LastName'};
                if(SecurityUtil.checkAccessibility('Lead',LeadfieldNames)){
                    system.debug('LeadId--->'+LeadId);
                    newlead = [SELECT Id, LastName, FirstName, Email FROM Lead WHERE ID In: LeadId];
                }
            else{
                throw new System.AssertException('Error: Insufficient Access');
            }
            Campaign campaignList = new  Campaign();
            List<String>  CampaignfieldNames = new List<String>{'Id','Name','Start_Date_Time__c','Contact__c','End_Date_Time__c','Online_Event_URL__c',
                'Address1__c','State__c','Event_Location__c', 'City__c','Country__c', 'Postal_Code__c',
                'Logo_Url__c', 'Banner_Url__c'}
                    if(SecurityUtil.checkAccessibility('Campaign',CampaignfieldNames)){
                        campaignList = [SELECT Id, Name,tart_Date_Time__c,Address1__c,City__c,Contact__c,State__c,Contact__r.Name,Contact__r.Email,
                                        Country__c,Postal_Code__c,End_Date_Time__c,Online_Event_URL__c,Event_Location__c,Logo_Url__c,Banner_Url__c From Campaign WHERE Id =: CampaignId WITH SECURITY_ENFORCED];     
                    }
            else{
                throw new System.AssertException('Error: Insufficient Access');
            }
            
            
            Set<Id> contactId =  new Set<Id>();
            EmailTemplate emailTemplateforContact = [select Id, Subject, HtmlValue, Body from EmailTemplate WHERE Name =: System.label.Assist_Mail_Alert_for_Contact];
            String subjectforContact = emailTemplateforContact.Subject;
            String htmlbodyforcontact = emailTemplateforContact.HtmlValue;
            String plainBodyforContact = emailTemplateforContact.Body;
            //HTML value for contact
            
            htmlbodyforcontact = htmlbodyforcontact.replace('{!Contact.Name}', campaignList.Contact__r.Name);
            htmlbodyforcontact = htmlbodyforcontact.replace('{!Campaign.Name__c}', campaignList.Name);
            htmlbodyforcontact = htmlbodyforcontact.replace('{!Lead.FirstName}', newlead.FirstName );
            htmlbodyforcontact = htmlbodyforcontact.replace('{!Lead.LastName}',  newlead.LastName);
            htmlbodyforcontact = htmlbodyforcontact.replace('{!Lead.Email}',  newlead.Email);
            htmlbodyforcontact = htmlbodyforcontact.replace('{!Campaign.Logo_Url__c}', campaignList.Logo_Url__c);
            //PlainBody for contact
            plainBodyforContact = plainBodyforContact.replace('{!Campaign.Name__c}', campaignList.Name);
            plainBodyforContact = plainBodyforContact.replace('{!Lead.FirstName}', newlead.FirstName );
            plainBodyforContact = plainBodyforContact.replace('{!Lead.LastName}',  newlead.LastName);
            plainBodyforContact = plainBodyforContact.replace('{!Lead.Email}',  newlead.Email);
            plainBodyforContact = plainBodyforContact.replace('{!Campaign.Logo_Url__c}', campaignList.Logo_Url__c);
            //Mail for contact
            Messaging.Singleemailmessage mailforcontact = new Messaging.Singleemailmessage();
            mailforcontact.setReplyTo(campaignList.Contact__r.Email);
            mailforcontact.setSenderDisplayName(campaignList.Contact__r.Email);
            mailforcontact.setTargetObjectId(campaignList.Contact__c );
            mailforcontact.setSaveAsActivity(true);
            mailforcontact.setSubject(subjectforContact);
            mailforcontact.setHtmlBody(htmlbodyforcontact);
            mailforcontact.setPlainTextBody(plainBodyforContact);
            Messaging.sendEmail(new Messaging.SingleEmailmessage[] {mailforcontact});
        }
    }
}
 
 
Hi Folks,
If I selected any two pick list values,then enable or disable field?can we control?
please suggest.
Thank you.
MutliPicklist field and fields
I'm not developer unfortunately , thanks a lot if you can help.
Here is the code of the trigger that actually working, just need the test class :

trigger DeleteContentDocumentLink on Case (Before Update,After Update, Before Delete) {
 public Set<Id> CaseSetId = new Set<Id>();
 List<Case> csToUpdt = new List<Case>();

 if(Trigger.isAfter && Trigger.isUpdate){
    for(Case cs:Trigger.New){
        if(cs.TECH_DeleteFiles__c== True){
            CaseSetId.add(cs.Id);
        }
    }
    If(CaseSetId.size()>0){
        List<ContentDocumentLink> casAttmtList = [SELECT ContentDocumentId FROM ContentDocumentLink where LinkedEntityId in ( SELECT Id FROM Case WHERE TECH_DeleteFiles__c = TRUE ) and LinkedEntity.Type='Case'];
        Integer count=0;
        for (ContentDocumentLink x : casAttmtList) {    
            List<ContentDocument> casFiles = [SELECT Title FROM ContentDocument WHERE Id = :casAttmtList[count].ContentDocumentId ];
            delete casFiles;
            count++;
            }
    }
}}

Thanks a lot
Hello, How are you?

Please, I would like to know if you could help me with the following: how can I prevent the Opportunity Owner from moving an Opportunity from Stage A to Stage B if the field C in the Event related to the Opportunity is different from D.

Being the the field C is a picklist and D is a string?

Thank you a lot!
Can anyone help me with a Test class for this code please ?

Apex Class
public class OpptyCloseTimerCntrl {
    
    @AuraEnabled
    public static Date fetchOpptyCloseDate(String recId){
        Opportunity opp = [select End_of_Quarter__c from Opportunity where id =: recId];
        system.debug('Close Date: ' +opp.End_of_Quarter__c);
        
        return opp.End_of_Quarter__c;
    }
}
On updating phone on contact object that should also updated the account phone no .. can this be possible using process builder 
I Have QuickAction Button In Quick Action I'm using LWC Component
The Requirement Is it Showing On Record Detail Page in Lightning Experience But Not Showing On Community Site 
i have 4 checkbox field on an object and 1 pickilist field 



1>    if all four checkbox is checked picklist isequal to all active
2>    if any three checkbox is checked picklist isequal to review
3>    if any two checkbox is checked picklist isequal to approved
4>     if one or none checkbox is checked picklist isequal to rejected
Please write a soql query to get latest record as per latest date and time.
Eg: select id, name from case  ORDER BY createdDate
I need to display record in table as per latest record created by time default.

I have a requirement to update a field of an Object A, with the names of another object B which are related to A.

Example Object A can have a,b,c related Object B, new field on object A should show me a,b,c(which are object B record names) and so on, whenever i add a new related object B to object A.

I need to use bulk approach and trigger on Object B.

 

Trigger on Contact Object where object having custom currency field 'salary'. The requirement is with event after insert, after update and after delete, minimum and maximum salary of contact should get updated.

Kindly help,I will appreciate it a lot!
Failed to save lightningDataServices.cmp: No INTERFACE named markup://flexipage:availableForAllpages foundNo INTERFACE named markup://flexipage:availableForAllpages found: Source
 Hi, can help me with how to have code coverage for this code?
trigger UpdateRecordOwner on Centive__c (before insert, before update) {
    
    Map<Id, User> userMap = new Map<Id, User>([select id, EmployeeNumber from user where (NOT UserRole.name like'IC%') AND (UserRoleId !=NULL)]);
    
    Map<String, Id> mapEmployeeNoToId = new Map<String, Id>();
    for(User u : userMap.values())
        mapEmployeeNoToId.put(u.EmployeeNumber, u.Id);
    for (Centive__c Centive: Trigger.new){
        if(mapEmployeeNoToId.get(Centive.HOT_Badge_ID__c) !=null)
            Centive.OwnerId = mapEmployeeNoToId.get(Centive.HOT_Badge_ID__c);
        System.debug('MapValue'+ mapEmployeeNoToId.get(Centive.HOT_Badge_ID__c));
        break;
    }
}

 
What would be a better way to write this formula to get a checkbox checked:

ISPICKVAL( Country_of_Citizenship__c , "Austria") || 
ISPICKVAL( Country_of_Citizenship__c , "Belgium") || 
ISPICKVAL( Country_of_Citizenship__c , "Czech Republic") || 
ISPICKVAL( Country_of_Citizenship__c , "Denmark") || 
ISPICKVAL( Country_of_Citizenship__c , "Estonia") || 
ISPICKVAL( Country_of_Citizenship__c , "Finland") || 
ISPICKVAL( Country_of_Citizenship__c , "France") || 
ISPICKVAL( Country_of_Citizenship__c , "Germany") || 
ISPICKVAL( Country_of_Citizenship__c , "Greece") || 
ISPICKVAL( Country_of_Citizenship__c , "Hungary") || 
ISPICKVAL( Country_of_Citizenship__c , "Iceland") || 
ISPICKVAL( Country_of_Citizenship__c , "Italy") || 
ISPICKVAL( Country_of_Citizenship__c , "Latvia") || 
ISPICKVAL( Country_of_Citizenship__c , "Liechtenstein") || 
ISPICKVAL( Country_of_Citizenship__c , "Netherlands") || 
ISPICKVAL( Country_of_Citizenship__c , "Norway") || 
ISPICKVAL( Country_of_Citizenship__c , "Poland") || 
ISPICKVAL( Country_of_Citizenship__c , "Portugal") || 
ISPICKVAL( Country_of_Citizenship__c , "Slovakia") || 
ISPICKVAL( Country_of_Citizenship__c , "Slovenia") || 
ISPICKVAL( Country_of_Citizenship__c , "Spain") || 
ISPICKVAL( Country_of_Citizenship__c , "Sweden") || 
ISPICKVAL( Country_of_Citizenship__c , "Switzerland") 
Hello,I have written an apex class and now testing the class to achieve 100% code coverage.I have followed the steps as per trailhead but now getting the following error.

@isTest
public Class AccountRelatedCase{
@isTest    
    public Static void list<Case> lstCases(string Accid){
    
    list<Case> lstCa = [SELECT AccountId,CaseNumber,Subject FROM Case WHERE status = 'New' And AccountId = :Accid];
    system.Debug(lstCa);
    return lstCa;
    }
}

Error:
Unexpected token 'list'.
I have two fields in my org Name and Legal Name. We need to ensure both fields are not an exact match. Below is the Syntax I have put:

Name  <>  Legal_Name__c

Can anyone help me rectify it?
Apex Trigger:
trigger ContactTrigger on Contact (before insert,after insert) {
if(Trigger.isInsert && Trigger.isAfter){
        ContactTriggerHelper.UpdateOpportunity(Trigger.New);
    }
}
I have written the code of my trigger helper class :

public class CustomerEmployeeHandler {
    List<Customer_Employee_Master__c> CE = new List<Customer_Employee_Master__c>();
    public void beforeInsert(List<AccountTeamMember> newatm)
    {
        for(AccountTeamMember atm: newatm)
        {
            ID getid = atm.AccountId;
            Customer_Employee_Master__c cm = new Customer_Employee_Master__c();
            cm.Account__c = getid;
            cm.Username__c = atm.UserId;
            cm.Start_Date__c = date.today();
            CE.add(cm);
        }
        Insert CE;
    }
    public void beforeDelete(List<AccountTeamMember> newatm)
    {
        
        for(AccountTeamMember atm: newatm)
        {
            ID getid = atm.UserId;
            ID acc = atm.AccountId;
            List<Customer_Employee_Master__c> cmd = [SELECT ID from Customer_Employee_Master__c where Username__c =: getid and Account__c =: acc];
            system.debug(cmd);
            for(Customer_Employee_Master__c c: cmd)
            {
                c.End_Date__c = date.today();
                CE.add(c);
            }
        }
        if(!CE.isEmpty()){
            Update CE;    
        }
        
    }
    
}


my Trigger code is :

trigger CustomerEmployeeTrigger on AccountTeamMember (before insert, after update, before delete) {
    CustomerEmployeeHandler CEH= new CustomerEmployeeHandler();
    if (Trigger.isInsert)
    {
        CEH.beforeInsert(Trigger.new);
    }
    if(Trigger.IsDelete)
    {
        CEH.beforeDelete(Trigger.old);
    }
}


Please help me with Test Class for the same 
TRIGGER:
trigger FNR on Fortnightly_Update__c (before insert,before update)
{
    List<Public_Holiday_List__c> FNR =[select id from Public_Holiday_List__c];
    system.debug('FNR Trigger holiday List Count >>> '+FNR.size());
}

TEST CLASS:
@isTest public static void Insert_fortnightly_Already_Exist()
{
        try
    {
         Fortnightly_Update__c f=new Fortnightly_Update__c();
            f.Account__c=[select id from Account where id='0016F00003uavZd'].id;
            insert f;
            
        }catch(DMLException e)
        {
            System.debug('Insert_fortnightly_Already_Exist_Error >>> '+e.getMessage());
        }
}


When the following code is executed in Anonymous Window, it give output 19
List<Public_Holiday_List__c> FNR =[select id from Public_Holiday_List__c];
system.debug('FNR Trigger holiday List Count >>> '+FNR.size());

However, when the same is executed within a trigger as shown above, the output is 0.

I would like to know what is wrong, why the SOQL is not returning the record when excuted within the trigger.

How to Write a Batch Job

Batch Job should add existing users to the group

 

  • October 18, 2021
  • Like
  • 0

How to add try catch for error handling for the below code

 

global class updatePolicyStatusSchedule implements Schedulable {
    global void execute(SchedulableContext ctx) {
        updatePolicyStatus();
    }
    
    public void updatePolicyStatus() {
        List<Policy__c> expiredInForcePolicies = [SELECT Id, Status__c, Policy_End_Date__c, Policy_Effective_Date__c
                                                  FROM Policy__c
                                                  WHERE (Policy_End_Date__c <= TODAY AND Status__c != 'Expired' AND Status__c != 'Terminated')
                                                  OR (Policy_Effective_Date__c <= TODAY AND Policy_End_Date__c > TODAY AND Status__c NOT IN ('In Force','In-Force - Non-Renewing'))];

        List<Policy__c> updateExpiredInForcePolicies = new List<Policy__c>();
        

        for(Policy__c policy : expiredInForcePolicies){
            if((policy.Policy_End_Date__c<=System.today() && policy.Status__c!='Expired' && policy.Status__c!='Terminated') && !(policy.Policy_Effective_Date__c <= System.today() && policy.Policy_End_Date__c > System.today() && (policy.Status__c!='In Force' || policy.Status__c!='In-Force - Non-Renewing'))){
                policy.Status__c = 'Expired';
            }

            if(!(policy.Policy_End_Date__c<=System.today() && policy.Status__c!='Expired' && policy.Status__c!='Terminated') && (policy.Policy_Effective_Date__c <= System.today() && policy.Policy_End_Date__c > System.today() && (policy.Status__c!='In Force' || policy.Status__c!='In-Force - Non-Renewing'))){
                policy.Status__c = 'In Force';
            }
            
            updateExpiredInForcePolicies.add(policy);
        }
    if(!updateExpiredInForcePolicies.isEmpty()){
            Database.update(updateExpiredInForcePolicies);  
        }
    }
}


Thanks In advance

"User cannot change status to invoicing if previous status was Pharma Payment, Member Payout, Payment Processing, or Complete".......(these are the picklist values) .


I tried this..but its not working.


IF(ISPICKVAL(Status__c,'Invoicing'), 
    ISPICKVAL(Status__c, 'Pharma Payment') ||
    ISPICKVAL(Status__c, 'Member Payout') ||
    ISPICKVAL(Status__c, 'Payment Processing') ||
    ISPICKVAL(Status__c, 'Complete')
 ,
false )



Response will be appreciated.


 
Hi,

I have Apex code  output JSON data,

User-added image

I wish to display this json data in my LWC. 
Html:
<template>
    <lightning-card title="Report Data" icon-name="lightning-icon" >
        <div class="slds-m-around_medium">
            <template if:true={lapp}>
                <ul>
               <template for:each={lapp} for:item="app">
                   <li key={app.Id}> {app.Name} </li>
               </template>
            </ul>
           </template>
           <template if:true={error}>
               {error}
           </template>  
        </div>
 </lightning-card>
</template>

Js:
import { LightningElement, wire, track} from 'lwc';
import getURL from '@salesforce/apex/CreateReport.reportgen';
export default class RedirecctedURL extends LightningElement {
       @track lapp;
       @track data;
       @track error;
       wiredActivities;
     @wire(getURL,{
     }
     )
     wiredCases(value){
     this.wiredActivities = value;
     const { data, error } = value;
     
     if(data){
       this.lapp = JSON.stringify(data);
       console.log(JSON.stringify(data));
     
     }else if(error){
       console.log(error);
       this.error = error;
     }
     }
}

Any help??
 

Hi Everyone!

I want a list of account using Lightning-datatable. But it is not displaying the list of accounts.
HTML:

<template>
    <lightning-card title="t">
        <template if:true={accList}>
    <lightning-datatable
    key-field="Id"
    data={data}
    columns={columns}>
    </lightning-datatable>
    </template>
    <template if:true={error}>
        {error}
    </template>
</lightning-card>
</template>

JS:

import { LightningElement ,api, wire, track} from 'lwc';
import getAccountList from '@salesforce/apex/AccountHelper.getAccountList';
export default class Test extends LightningElement {
    @track columns = [{
            label: 'Account name',
            fieldName: 'Name',
            type: 'text',
            sortable: true
        },
        {
            label: 'Type',
            fieldName: 'Type',
            type: 'text',
            sortable: true
        },
      
    ];
 
    @track error;
    @track accList ;
    @wire(getAccountList)
    wiredAccounts({
        error,
        data
    }) {
        if (data) {
            this.accList = data;
            alert(JSON.stringify(accList));
            alert(JSON.stringify(data));
        } else if (error) {
            this.error = error;
        }
    }
}

Apex Class: 

public with sharing class AccountHelper {
    @AuraEnabled(cacheable=true)
    public static List<Account> getAccountList() {
        return [SELECT Id, Name, Type, Rating,
                Phone, Website, AnnualRevenue
            FROM Account LIMIT 10];
    }
}

xml

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>50.0</apiVersion>
    <isExposed>true</isExposed>
    <targets>
        
            <target>lightning__AppPage</target>
            <target>lightning__RecordPage</target>
            <target>lightning__HomePage</target>
        
    </targets>
</LightningComponentBundle>

Output: 

User-added image

I want the list of accounts.

Thank you in Advance!

Hi,
I have created a drop down menu in lightning web component. But, I want a pop up will appear on click of a menu item. 
I tried this for pop up, But it is not working. On click of a "Rename " Menu item . A pop up will be shown.

button.html

<template>
    <div class="slds-p-around_medium lgc-bg">
        {selectedItemValue}
        {ready}
        <lightning-card title="Drop Down">
            <lightning-button-menu alternative-text="Show menu" variant="border-filled" onselect={handleOnselect}>
                {selectedItemValue}
                <lightning-menu-item value="openinsharepoint" label="Open in SharePoint" prefix-icon-name="utility:new_window"
                    href="#"
                    target="_blank">
                </lightning-menu-item>
                <lightning-menu-item value="rename" label="Rename" prefix-icon-name="utility:edit">
                    <template if:true={ready}>
                        <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_small"
                            aria-labelledby="modal-heading-01" aria-modal="true" aria-hidden="true"
                            aria-describedby="modal-content-id-1">
                            <div class="slds-modal__container">
                                <!-- Modal/Popup Box LWC header here -->
                                <header class="slds-modal__header">
                                    <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick={closeModal}>
                                        <lightning-icon icon-name="utility:close"
                                            alternative-text="close"
                                            variant="inverse"
                                            size="small" ></lightning-icon>
                                        <span class="slds-assistive-text">Close</span>
                                    </button>
                                    <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">Rename LWC Setup.docx</h2>
                                </header>
                                <!-- Modal/Popup Box LWC body starts here -->
                                <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
                                    <lightning-input type="text" name="folder_name" label="Rename" placeholder="Enter new item name">
                                    </lightning-input>
                                </div>
                                <!-- Modal/Popup Box LWC footer starts here -->
                                <footer class="slds-modal__footer">
                                    <button class="slds-button slds-button_neutral" onclick={closeModal} title="Cancel">Cancel</button>
                                    <button class="slds-button slds-button_brand" onclick={submitDetails} title="Create">Create</button>
                                </footer>
                            </div>
                        </section>
                        <div class="slds-backdrop slds-backdrop_open"></div>
                    </template>
                </lightning-menu-item>
                <lightning-menu-item value="download" label="Download" prefix-icon-name="utility:download">
                </lightning-menu-item>
                <div class="slds-has-divider_top-space" role="separator">
                    <lightning-menu-item value="delete" label="Delet" prefix-icon-name="utility:close"></lightning-menu-item>
                </div>
            </lightning-button-menu>
        </lightning-card>
    </div>
</template>

button.js

import { LightningElement, track } from 'lwc';
export default class ButtonMenuOnselect extends LightningElement {
    @track selectedItemValue;
    @track ready;
    handleOnselect(event) {
        this.selectedItemValue = event.detail.value;
        if(this.selectedItemValue == "rename")
        {
        alert("ready");
        this.ready = true;
        alert("false");
        }
        
    }
}

 

i have 3 fields 
field 1- mr
field 2- bean
in the field 3 i have to show 'mr bean '
basically i have to show the 2 fields value in the 3rd field