You need to sign in to do that
Don't have an account?
Dorian Kane 5
hello i need a uni test to pass the auto convert lead to deploy
This is the apex clas i need to deploy
I dont know muth about apex code and i need help
- Public class AutoConvertLeads
- {
- @InvocableMethod
- public static void LeadAssign(List<Id> LeadIds)
- {
- Database.LeadConvert Leadconvert = new Database.LeadConvert();
- Leadconvert.setLeadId(LeadIds[0]);
- LeadStatus Leads= [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
- Leadconvert.setConvertedStatus(Leads.MasterLabel);
- Leadconvert.setDoNotCreateOpportunity(TRUE); //Remove this line if you want to create an opportunity from Lead Conversion
- Database.LeadConvertResult Leadconverts = Database.convertLead(Leadconvert);
- System.assert(Leadconverts.isSuccess());
- }
- }
All Answers
Public class AutoConvertLeads
{
@InvocableMethod
public static void LeadAssign(List<Id> LeadIds)
{
Database.LeadConvert Leadconvert = new Database.LeadConvert();
Leadconvert.setLeadId(LeadIds[0]);
LeadStatus Leads= [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
Leadconvert.setConvertedStatus(Leads.MasterLabel);
Leadconvert.setDoNotCreateOpportunity(TRUE); //Remove this line if you want to create an opportunity from Lead Conversion
Database.LeadConvertResult Leadconverts = Database.convertLead(Leadconvert);
System.assert(Leadconverts.isSuccess());
}
}