• Tony Montana 6
  • NEWBIE
  • 10 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 3
    Replies
<lightning-layout multiple-rows>                  
<template for: each={member Records} for:item="record">                      <lightning-layout-item key={record.Id} flexibility="auto" padding=0>                         <!-- Start bear tile -->                        
<lightning-card>                          
 <div>                              
<div>                                  
<div>                                    
<p class="center">{record.Constituent_Name__r.Name}</p>                <p class="center">{record.Begin_Term_Date__c} until {record.End_Term_Date__c}</p>                                  
</div>                              
</div>                            
</div>                        
</lightning-card>                        
<!-- End bear tile -->                      
</lightning-layout-item>                  
</template>                
</lightning-layout>    

Currently this uses cards to display the data But instead i want it to come out in a table with each row being a different member Record with 3 columns (Name, Start Date, End Date).  Could use some help on this?  
Thanks,
TM
I Have a picklist Business_Unit__c ,if the value of business unit is 'Top SKU' or  'ebay Buyer Rewards' then picklist Accounting_Treatment__c should be 'Marketing Expense',

Thanks,
TM
private static Testmethod void testViewSurveyController1() {
        SurveyTestingUtil tu = new SurveyTestingUtil();
        Apexpages.currentPage().getParameters().put('id',tu.surveyId);
        Apexpages.Standardcontroller stc; 
        Account a = new Account(name = 'eBay Inc');
        insert a;
        User_Settings__c userSetting = new User_Settings__c();
        userSetting.company_id__c = a.id;
        userSetting.name = 'User/Contact Settings';
        userSetting.contact_record_type__c = 'Default';
        insert userSetting;
        
        Test.startTest();
        Id recordTypeName = Schema.sObjectType.GLOBAL_Request__c.getRecordTypeInfosByName().get('Send Survey').getRecordTypeId(); 
        //List<Survey_Configuration__mdt> SurveyConfigurationmdt = [SELECT FROM SurveyConfigurationmdt WHERE Record_Type_Developer_Name__c = :recordTypeName LIMIT 1];
    
        GLOBAL_Request__c requestObj = new GLOBAL_Request__c();
 
        requestObj.Business_Unit__c = 'Business Ethics';
        requestObj.recordTypeId = recordTypeName;
        insert requestObj;
         
        List<Participant__c> createParticipantList = new List<Participant__c>(); 
        Survey_Configuration__mdt surveyConfig = [select id, masterlabel, Business_Unit__c, Contact_Query_Criteria__c from Survey_Configuration__mdt where Business_Unit__c =: requestObj.Business_Unit__c];
       
        String queryContacts = 'select id, name, NT_Login_Name__c from contact where ' + surveyConfig.Contact_Query_Criteria__c;
        List<Contact> theContacts = Database.query(queryContacts);
         
        /* for(Contact c : theContacts)
            {
                        createParticipantList.add(new Participant__c(Participant__c = c.Id, Request__c =  requestObj.Id, RecordTypeId=recordTypeName));
            }
       */
       
        Id sendSurveyRTid = Schema.SObjectType.GLOBAL_Request__c.getRecordTypeInfosByName().get('Send Survey').getRecordTypeId();
        GLOBAL_Request__c gr1 = new GLOBAL_Request__c();
        GLOBAL_Request__c gr2 = new GLOBAL_Request__c();

         List<GLOBAL_Request__c> requestList = new List<GLOBAL_Request__c>();
        
        gr1.RecordTypeId = sendSurveyRTid;
        gr1.Send_Survey_On__c = system.today();
        gr1.Business_Unit__c = 'Business Ethics';
        
        gr2.RecordTypeId = sendSurveyRTid;
        gr2.Send_Survey_On__c = system.today();
        requestList.add(gr1);
        requestList.add(gr2);
                
          insert requestList;

            List<Id> requestIds = new List<Id>();
            for(GLOBAL_Request__c gr:requestList) {
                requestIds.add(gr.Id);
            }
            
            CreateSurveyParticipantsFromContacts.createParticipantRecord(requestIds);
                
        Apexpages.currentPage().getParameters().put('rId',requestObj.id);
       // Apexpages.currentPage().getParameters().put('rId','a2q19000000XOF8');
       
        ViewSurveyController vsc = new ViewSurveyController(stc);
        vsc.init();
        vsc.submitResults();
        System.assert(tu.surveyId != null); 
        Test.stopTest();
         

    } 
    

it needs to cover the following block of code.

if(requestId != null) {
       
            List<GLOBAL_Request__c> requestObj = [select id, business_unit__c, recordtype.developername from GLOBAL_Request__c where id=:requestId AND recordtype.developername = 'Send_Survey' Limit 1];
            if (requestObj != null && !requestObj.isEmpty()){        
            List<User> usrRec =[select id, NT_Login_Name__c from User where id=:UserInfo.getUserId() And NT_Login_Name__c != null Limit 1];
                    if(usrRec != null && !usrRec.isEmpty()){
                    List<Contact> contactRec = [select id, NT_Login_Name__c from contact where NT_Login_Name__c=:usrRec[0].NT_Login_Name__c ORDER by LastModifiedDate DESC Limit 1];         
                        if (contactRec != null && !contactRec.isEmpty()){
                          List<Participant__c> participantRec = [select Id, Name,Survey_Taken_Date__c from Participant__c where Participant__c=:contactRec[0].Id AND Request__c=:requestObj[0].Id ORDER by CreatedDate DESC LIMIT 1];
                            if(participantRec != null && !participantRec.isEmpty()){
                                if(participantRec[0].Survey_Taken_Date__c == null)
                                { 
                                ParticipantId = participantRec[0].Id;
                                contactId = contactRec[0].Id;
                                requestId = requestObj[0].Id;
                                Participant__c updateSurveyTakenDate = new Participant__c(id = ParticipantId, Survey_Taken_Date__c = System.now());            
                                    upsert updateSurveyTakenDate;  
                                }
                             else{
                              
                            if(caseId==null){
                                caseId = 'none'; 
                            }   
                            if(contactId==null)
                                contactId =   'none';
                            if(requestId==null) 
                                requestId =   'none';   
                            
                            if(ParticipantId==null){            
                                ParticipantId ='none';
                            }

                           Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, System.Label.LABS_SF_You_have_already_taken_this_survey));
                                return false;
                            }
                            } else {
                            if(caseId==null){
                                caseId = 'none'; 
                            }   
                            if(contactId==null)
                                contactId =   'none';
                            if(requestId==null) 
                                requestId =   'none';   
                            
                            if(ParticipantId==null){            
                                ParticipantId ='none';
                            }
                                Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, System.Label.LABS_SF_Participant_Not_Part_Of_This_Pool));                    
                                return false;
                            }
                        }
                    }
            }
        }

Will appreciate any help on it


Regards,
TM
if(requestId != null) {
        
               List<GLOBAL_Request__c> requestObj = [select id, business_unit__c, recordtype.developername from GLOBAL_Request__c where id=:requestId AND recordtype.developername = 'Send_Survey' Limit 1];
            if (requestObj != null && !requestObj.isEmpty()){        
            List<User> usrRec =[select id, NT_Login_Name__c from User where id=:UserInfo.getUserId() And NT_Login_Name__c != null Limit 1];
                    if(usrRec != null && !usrRec.isEmpty()){
                    List<Contact> contactRec = [select id, NT_Login_Name__c from contact where NT_Login_Name__c=:usrRec[0].NT_Login_Name__c ORDER by LastModifiedDate DESC Limit 1];         
                        if (contactRec != null && !contactRec.isEmpty()){
                          List<Participant__c> participantRec = [select Id, Name,Survey_Taken_Date__c from Participant__c where Participant__c=:contactRec[0].Id AND Request__c=:requestObj[0].Id ORDER by CreatedDate DESC LIMIT 1];
                            if(participantRec != null && !participantRec.isEmpty()){
                                if(participantRec[0].Survey_Taken_Date__c == null)
                                { 
                                ParticipantId = participantRec[0].Id;
                                contactId = contactRec[0].Id;
                                requestId = requestObj[0].Id;
                                Participant__c updateSurveyTakenDate = new Participant__c(id = ParticipantId, Survey_Taken_Date__c = System.now());            
                                       upsert updateSurveyTakenDate;  
                                }
                             else{
                              
                            if(caseId==null){
                                caseId = 'none'; 
                            }   
                            if(contactId==null)
                                contactId =   'none';
                            if(requestId==null) 
                                requestId =   'none';   
                            
                            if(ParticipantId==null){            
                                ParticipantId ='none';
                            }

                           Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, System.Label.LABS_SF_You_have_already_taken_this_survey));
                                return false;
                            }
                            } else {
                            if(caseId==null){
                                caseId = 'none'; 
                            }   
                            if(contactId==null)
                                contactId =   'none';
                            if(requestId==null) 
                                requestId =   'none';   
                            
                            if(ParticipantId==null){            
                                ParticipantId ='none';
                            }
                                Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, System.Label.LABS_SF_Participant_Not_Part_Of_This_Pool));                    
                                 return false;
                            }
                        }
                    }
            }
        }
          
Below is the existing test class
==
@istest
private class ViewSurveyController_Test{
    //------------------------------------------------------------------------------//
    //------------------------------------------------------------------------------//
    private static Testmethod void testViewSurveyController() {
        SurveyTestingUtil tu = new SurveyTestingUtil();
        Apexpages.currentPage().getParameters().put('id',tu.surveyId);
        Apexpages.Standardcontroller stc;
        ViewSurveyController vsc = new ViewSurveyController(stc); 
        vsc.init();
        System.assert(vsc.allQuestionsSize == 4);
        System.assert(tu.surveyId != null);


        vsc.submitResults();
        for (SFQuestion q : vsc.allQuestions)
        {
            q.selectedOption = String.valueof(2);
            q.choices = String.valueof(2);
            q.selectedOptions = new List<String>();
            q.selectedOptions.add(String.valueof(2));
            vsc.submitResults();
        }
        System.assertEquals(true, vsc.thankYouRendered);


        //test something
    }


    private static Testmethod void testUpdateSurveyName() {
        SurveyTestingUtil tu = new SurveyTestingUtil();
        Apexpages.currentPage().getParameters().put('id',tu.surveyId);
        Apexpages.Standardcontroller stc;
        ViewSurveyController vsc = new ViewSurveyController(stc);
        vsc.surveyName = 'new name';
        system.assert(vsc.updateSurveyName() == null);

    }


    private static Testmethod void testupdateSurveyThankYouAndLink() {
        SurveyTestingUtil tu = new SurveyTestingUtil();
        Apexpages.currentPage().getParameters().put('id',tu.surveyId);
        Apexpages.Standardcontroller stc;
        ViewSurveyController vsc = new ViewSurveyController(stc);
        vsc.surveyThankYouText = 'new stuff';
        vsc.surveyThankYouURL = 'more new stff';
        system.assert(vsc.updateSurveyThankYouAndLink()==null);
    }

    
    private static Testmethod void testrefreshQuestionList() {
        SurveyTestingUtil tu = new SurveyTestingUtil();
        Apexpages.currentPage().getParameters().put('id',tu.surveyId);
        Apexpages.Standardcontroller stc;
        ViewSurveyController vsc = new ViewSurveyController(stc);
        system.assert(vsc.refreshQuestionList() == null);
    }

}

how should I go about updating it to get at least 75% coverage ?

Thanks,
TM


 
if(requestId != null) {
        
               List<GLOBAL_Request__c> requestObj = [select id, business_unit__c, recordtype.developername from GLOBAL_Request__c where id=:requestId AND recordtype.developername = 'Send_Survey' Limit 1];
            if (requestObj != null){        
            List<User> usrRec =[select id, NT_Login_Name__c from User where id=:UserInfo.getUserId() And NT_Login_Name__c != null Limit 1];
                    if(usrRec != null){
                    List<Contact> contactRec = [select id, contactRec.NT_Login_Name__c from contact where NT_Login_Name__c=:usrRec.NT_Login_Name__c ORDER by LastModifiedDate DESC Limit 1];         
                        if (contactRec != null){
                          List<Participant__c> participantRec = [select Id, Name,Survey_Taken_Date__c from Participant__c where Participant__c=:contactRec.Id AND Request__c=:requestObj.Id ORDER by CreatedDate DESC LIMIT 1];
                            if(participantRec != null && participantRec.Survey_Taken_Date__c == null){
                                ParticipantId = participantRec.Id;
                                contactId = contactRec.Id;
                                requestId = requestObj.Id;
                                Participant__c updateSurveyTakenDate = new Participant__c(id = ParticipantId, Survey_Taken_Date__c = System.now());            
                                       upsert updateSurveyTakenDate;  
                            } else if(participantRec != null && participantRec.Survey_Taken_Date__c != null){
                                Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, System.Label.LABS_SF_You_have_already_taken_this_survey));
                                return false;
                            } else {
                                Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, System.Label.LABS_SF_Participant_Not_Part_Of_This_Pool));                    
                                 return false;
                            }
                        }
                    }
            }
        }
  
And I am getting the following error.


1.Variable does not exist: NT_Login_Name__c
2.Variable does not exist: Id
3.Variable does not exist: Survey_Taken_Date__c
4.Variable does not exist: Id
5.Variable does not exist: Survey_Taken_Date__c

Will appreciate your help.

Thanks,
TM
      
that should check both Contact__c and User__c, if either or both are blank return N/A. 
If both are populated, check if Contact__r.Email equals to User__r.Email return Yes otherwise No.
Please let me know if you need any other information. I have the following so far.

IF(Contact__c = User__c,"Yes","No").
I have the following use case
If a Picklist Field 'Business unit' is 'eBay Plus' then a field 'Accounting' should be set to “Contra Transaction Revenue”. If the picklist 'Business unit' is “Top SKU” then a Field Accounting should be set  to “Marketing”
I have resolved above using standard criteria  in Process builder but having issues with below as I am  trying to use a formula.

If any other Business unit is other than 'eBay Plus Or Top SKU is selected,

And If Any of the 3 picklist fields below 

Has_buyer_committed_to_the_seller__c 
Incentivizing_Selling_Activity__c
Seller_Co_funding__c 

is Set to 'YES', then the  Field Accounting is set to 'Contra Transaction Revenue'.

I have the following but does not seem to work


AND(

OR(
ISPICKVAL([eForm__c].Business_Unit__c <> 'eBay Plus'),
ISPICKVAL([eForm__c].Business_Unit__c <> 'Top SKU'),

)

OR(
ISPICKVAL([eForm__c].Has_eBay_committed_to_the_seller__c = 'Yes'),
ISPICKVAL([eForm__c].Incentivizing_Selling_Activity__c = 'Yes'),
ISPICKVAL([eForm__c].Seller_Co_funding__c = Yes)
)
)

getting Error: Incorrect number of parameters for function 'ISPICKVAL()'. Expected 2, received 3
Would appreciate your help.

Thanks,
TM
if(requestId != null) {
        
               List<GLOBAL_Request__c> requestObj = [select id, business_unit__c, recordtype.developername from GLOBAL_Request__c where id=:requestId AND recordtype.developername = 'Send_Survey' Limit 1];
            if (requestObj != null){        
            List<User> usrRec =[select id, NT_Login_Name__c from User where id=:UserInfo.getUserId() And NT_Login_Name__c != null Limit 1];
                    if(usrRec != null){
                    List<Contact> contactRec = [select id, contactRec.NT_Login_Name__c from contact where NT_Login_Name__c=:usrRec.NT_Login_Name__c ORDER by LastModifiedDate DESC Limit 1];         
                        if (contactRec != null){
                          List<Participant__c> participantRec = [select Id, Name,Survey_Taken_Date__c from Participant__c where Participant__c=:contactRec.Id AND Request__c=:requestObj.Id ORDER by CreatedDate DESC LIMIT 1];
                            if(participantRec != null && participantRec.Survey_Taken_Date__c == null){
                                ParticipantId = participantRec.Id;
                                contactId = contactRec.Id;
                                requestId = requestObj.Id;
                                Participant__c updateSurveyTakenDate = new Participant__c(id = ParticipantId, Survey_Taken_Date__c = System.now());            
                                       upsert updateSurveyTakenDate;  
                            } else if(participantRec != null && participantRec.Survey_Taken_Date__c != null){
                                Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, System.Label.LABS_SF_You_have_already_taken_this_survey));
                                return false;
                            } else {
                                Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, System.Label.LABS_SF_Participant_Not_Part_Of_This_Pool));                    
                                 return false;
                            }
                        }
                    }
            }
        }
  
And I am getting the following error.


1.Variable does not exist: NT_Login_Name__c
2.Variable does not exist: Id
3.Variable does not exist: Survey_Taken_Date__c
4.Variable does not exist: Id
5.Variable does not exist: Survey_Taken_Date__c

Will appreciate your help.

Thanks,
TM
      
if(requestId != null) {
        
               List<GLOBAL_Request__c> requestObj = [select id, business_unit__c, recordtype.developername from GLOBAL_Request__c where id=:requestId AND recordtype.developername = 'Send_Survey' Limit 1];
            if (requestObj != null){        
            List<User> usrRec =[select id, NT_Login_Name__c from User where id=:UserInfo.getUserId() And NT_Login_Name__c != null Limit 1];
                    if(usrRec != null){
                    List<Contact> contactRec = [select id, contactRec.NT_Login_Name__c from contact where NT_Login_Name__c=:usrRec.NT_Login_Name__c ORDER by LastModifiedDate DESC Limit 1];         
                        if (contactRec != null){
                          List<Participant__c> participantRec = [select Id, Name,Survey_Taken_Date__c from Participant__c where Participant__c=:contactRec.Id AND Request__c=:requestObj.Id ORDER by CreatedDate DESC LIMIT 1];
                            if(participantRec != null && participantRec.Survey_Taken_Date__c == null){
                                ParticipantId = participantRec.Id;
                                contactId = contactRec.Id;
                                requestId = requestObj.Id;
                                Participant__c updateSurveyTakenDate = new Participant__c(id = ParticipantId, Survey_Taken_Date__c = System.now());            
                                       upsert updateSurveyTakenDate;  
                            } else if(participantRec != null && participantRec.Survey_Taken_Date__c != null){
                                Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, System.Label.LABS_SF_You_have_already_taken_this_survey));
                                return false;
                            } else {
                                Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, System.Label.LABS_SF_Participant_Not_Part_Of_This_Pool));                    
                                 return false;
                            }
                        }
                    }
            }
        }
  
And I am getting the following error.


1.Variable does not exist: NT_Login_Name__c
2.Variable does not exist: Id
3.Variable does not exist: Survey_Taken_Date__c
4.Variable does not exist: Id
5.Variable does not exist: Survey_Taken_Date__c

Will appreciate your help.

Thanks,
TM
      
I have the following use case
If a Picklist Field 'Business unit' is 'eBay Plus' then a field 'Accounting' should be set to “Contra Transaction Revenue”. If the picklist 'Business unit' is “Top SKU” then a Field Accounting should be set  to “Marketing”
I have resolved above using standard criteria  in Process builder but having issues with below as I am  trying to use a formula.

If any other Business unit is other than 'eBay Plus Or Top SKU is selected,

And If Any of the 3 picklist fields below 

Has_buyer_committed_to_the_seller__c 
Incentivizing_Selling_Activity__c
Seller_Co_funding__c 

is Set to 'YES', then the  Field Accounting is set to 'Contra Transaction Revenue'.

I have the following but does not seem to work


AND(

OR(
ISPICKVAL([eForm__c].Business_Unit__c <> 'eBay Plus'),
ISPICKVAL([eForm__c].Business_Unit__c <> 'Top SKU'),

)

OR(
ISPICKVAL([eForm__c].Has_eBay_committed_to_the_seller__c = 'Yes'),
ISPICKVAL([eForm__c].Incentivizing_Selling_Activity__c = 'Yes'),
ISPICKVAL([eForm__c].Seller_Co_funding__c = Yes)
)
)

getting Error: Incorrect number of parameters for function 'ISPICKVAL()'. Expected 2, received 3
Would appreciate your help.

Thanks,
TM