• Ryan Khan 1
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
I need to add an approval process to a custom button in salesforce. The process will go as follows:

1. Sale is closed and won
2. Send New Sale Email (The custom button) is clicked and you are taken to the custom new sale email template where you can also add attachements.
3. When you click send we need this to be sent to one person for approval before it is sent to the executives. 

Can this be done?
Hi All,
I am facing issues with test class for batch apex. Please find below my classes.

Batch Apex:
 
global class conuserDeactivate implements Database.Batchable<sObject>{
   
    global Database.Querylocator Start(Database.BatchableContext BC)
    {
		set<id> userId = new set<id>();
        List<contact> conList = [select id,User__c from contact where user__r.lastlogindate < =:syste.now().adddays(-14)];        
       for(contact c : caseList){
            uid.add(c.User__c);
           
        }
        string s = 'select isActive from user where id =: userid';    
        return Database.getQuerylocator(s);
    }
   
    global void Execute(Database.BatchableContext BC, List<User> scope){      
        for(User u : scope){
            u.isActive = false;
        }        
        update scope;
    }  
   
    global void finish(Database.BatchableContext BC){
       
    }
}

Test class:
@isTest
public class conuserDeactivateTest {
    static testMethod void deactivateMethod() {
        
        List<sObject> us = Test.loadData(User.sObjectType, 'userResource');
        User u = (User)us[0];
        Id uid = u.id;    
        
        Contact c = new Contact();
        c.LastName = 'TestContact';
       
        c.UserB__c = uid;
        insert c;
       
        Test.startTest();
        conuserDeactivate CUD = new conuserDeactivate();
        DataBase.executeBatch(CUD);            
        Test.stopTest();
    }
}


​​​​​​​
I am facing issues in covering of for loop in start method. I am not able to get user based on last log in date in test class.
Please help me how to cover this in test class.
Thanks in Advance
Regards,
Ramana V
 
Hi,

I have a custom multi-select picklist which contains some languages like "German" "English" and "French" on Contact.
Now, I need to pass the selected languages to my formula for a button/link URL on Opportunities.
This is my test code:
{!IF(INCLUDES(Contact.Language__c, "German"), "10202", "")
&IF(INCLUDES(Contact.Language__c, "English"), "10201", "")
&IF(ISBLANK(Contact.Language__c), "10204", "")}
But the INCLUDES always return false and in this case the empty string.
I tested mutliple combinations in the picklist.
Btw if I just let it print out "Contact.Language__c", it works fine.

What am I missing?

Thanks
  • November 30, 2020
  • Like
  • 0
Is there a way to refresh the data in a lightning datatable after making an update via an apex class?