• Arjun Anilkumar
  • NEWBIE
  • 25 Points
  • Member since 2017

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 5
    Replies
Hello All,

I have created an Apex class with invocable method and using it in a Process builder to automate my lead convrsion. The code is working but I need help with 2 things:
1. My code is creating duplicate accounts. Can someone help with the de-duplication of the Account. Basically what I am looing for is that if there is already an account, the lead should only be converted to Contact and if there is no Account, then it should create both Account and Contact.
2. I need help with writing a Test Class so that I can deploy it to Production.

Do I need to make sure that both my Apex class and Test Class have a 75% code coverage or more.

Below is my Apex Class code:

Public class AutoConvertLeads
{
    @InvocableMethod
    public static void LeadAssign(List<Id> LeadIds)
    {
        LeadStatus CLeadStatus= [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true Limit 100];
        List<Database.LeadConvert> MassLeadconvert = new List<Database.LeadConvert>();
        for(id currentlead: LeadIds){
                Database.LeadConvert Leadconvert = new Database.LeadConvert();
                Leadconvert.setLeadId(currentlead);                
                Leadconvert.setConvertedStatus(CLeadStatus.MasterLabel);
                Leadconvert.setDoNotCreateOpportunity(TRUE);
                MassLeadconvert.add(Leadconvert);
        }
        
        if (!MassLeadconvert.isEmpty()) {
            List<Database.LeadConvertResult> lcr = Database.convertLead(MassLeadconvert);
        }
    }
}

Any quick help will be appreciated. Thanks in advance!
Hello All,

I have created an Apex class with invocable method and using it in a Process builder to automate my lead convrsion. The code is working but I need help with 2 things:
1. My code is creating duplicate accounts. Can someone help with the de-duplication of the Account. Basically what I am looing for is that if there is already an account, the lead should only be converted to Contact and if there is no Account, then it should create both Account and Contact.
2. I need help with writing a Test Class so that I can deploy it to Production.

Do I need to make sure that both my Apex class and Test Class have a 75% code coverage or more.

Below is my Apex Class code:

Public class AutoConvertLeads
{
    @InvocableMethod
    public static void LeadAssign(List<Id> LeadIds)
    {
        LeadStatus CLeadStatus= [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true Limit 100];
        List<Database.LeadConvert> MassLeadconvert = new List<Database.LeadConvert>();
        for(id currentlead: LeadIds){
                Database.LeadConvert Leadconvert = new Database.LeadConvert();
                Leadconvert.setLeadId(currentlead);                
                Leadconvert.setConvertedStatus(CLeadStatus.MasterLabel);
                Leadconvert.setDoNotCreateOpportunity(TRUE);
                MassLeadconvert.add(Leadconvert);
        }
        
        if (!MassLeadconvert.isEmpty()) {
            List<Database.LeadConvertResult> lcr = Database.convertLead(MassLeadconvert);
        }
    }
}

Any quick help will be appreciated. Thanks in advance!
after installing node.js when i am running the command ask deploy i am getting the following error

Profile for the deployment: [default]
Skill Id: amzn1.ask.skill.f0439ae9-befa-4ece-a4c7-293f30e1669f
Skill deployment finished.
Call update-model error.
Error code: 400
{
  "message": "Interaction model is not valid.",
  "violations": [
    {
      "message": "InvalidSlotTypeName: Slot type name \"AMAZON.SearchQuery\" is invalid. The name of a custom slot type must begin with an alphabetic character and can consist only of alphabetic characters or underscores."
    }
  ]
}
How to solve this error
I am attempting to complete the aforementioned trailhead step on a Windows 10 machine. When I attempt to test the setup via sfdx force:auth:jwt:grant, I get the following error:

This org appears to have a problem with its OAuth configuration. Reason: invalid_grant - user hasn't approved this consumer

When it gives the error, SFDX provides a list of possible issues to check for. I have done so repeatedly. I have gone through the Trailhead step backwards and forwards. Every other part seems to work just fine. This part does not. Unfortuntely the Google results haven't really been all that helpful, so now I turn to you oh great and powerful forum. What do you say?

How do I create a "tab" for an installed package?

 

I have installed a package from a link on a website - an object called "proposals" specifically designed for the nonprofit version of Salesforce.  I can see the object in "view installed packages", but I don't know how to access it, and make a tab for it. 

 

Can someone help me please.