• Varshini D
  • NEWBIE
  • 20 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies

Hi,

I have an scenario where I want to call queueable apex when I click an custom button. How to create custom button to call queueable apex.
I called it through the VF page and it works. Is there any way to call a queueable apex directly through custom button.

Please help me to call a queueable apex through custom button.

Thanks In Advance.
 
I have 2 objects Parent and Child. I have a Checkbox field called active in parent. Only one of the parent is active. I want to clone the active parent's child to new Parent using custom button.
 I wrote a class for cloning child for new Parent.
Code:

      
    public class TestCLoneChild {
       // public Parent__c parent{Get;Set;}
        public List<Child__c> ChildSO{get;Set;}
        public void getparent(Parent__c parent){
                Parent__c versionSO = [SELECT Id,(SELECT ID,Name,Data_Type__c FROM Child__r) FROM Parent__c WHERE Active__c = TRUE Limit 1];
            ChildSO= new List<Child__c>();
             for(Child__c attr : versionSO.Child__r){
                  Child__c childd= new Child__c();
                  childd.Name = attr.Name;
                  childd.Data_Type__c = attr.Data_Type__c;
                  childd.Version__c = version.Id;
                  ChildSO.add(childd);
                 } 
              upsert ChildSO;
              System.Debug('Child'+ChildSO);
            }
        }
How can call this class to clone Child Records for new parent.
Please suggest me some ideas.

Thanks in Advance.
I have 2 objects Parent and Child. I have a Checkbox field called active in parent. Only one of the parent is active. I want to clone the active parent's child to new Parent using custom button.
 I wrote a class for cloning child for new Parent.
Code:

      
    public class TestCLoneChild {
       // public Parent__c parent{Get;Set;}
        public List<Child__c> ChildSO{get;Set;}
        public void getparent(Parent__c parent){
                Parent__c versionSO = [SELECT Id,(SELECT ID,Name,Data_Type__c FROM Child__r) FROM Parent__c WHERE Active__c = TRUE Limit 1];
            ChildSO= new List<Child__c>();
             for(Child__c attr : versionSO.Child__r){
                  Child__c childd= new Child__c();
                  childd.Name = attr.Name;
                  childd.Data_Type__c = attr.Data_Type__c;
                  childd.Version__c = version.Id;
                  ChildSO.add(childd);
                 } 
              upsert ChildSO;
              System.Debug('Child'+ChildSO);
            }
        }
How can call this class to clone Child Records for new parent.
Please suggest me some ideas.

Thanks in Advance.