• vinayak bule 16
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
The first 2 have same id and 2nd having same id. I want to combined records based on IDs

Target__c:{ActualJun__c=1006019.98, Id=a0C7E00000D2UdeUAF}
 Target__c:{Actualoct__c=1331.01, Id=a0C7E00000D2UdeUAF}

Target__c:{ActualJun__c=1006019.98, Id=a0C7E00000D2V4GUAV}
 Target__c:{Actualoct__c=1331.01, Id=a0C7E00000D2V4GUAV}
I have created a VFPage extension to overide standard button New For opp page. In Desktop version while clicking on new its redirecting to the vfpage. I have checked the available to mobile page in vfpage. And trying to access the same component in mobile Applicatoin 
@isTest
public with sharing class Batch_KnowledgeEditAsDraft_Test {
    
    @IsTest
    static void Batch_knowledgeEditAsDraft_testbatchmethod() {
        user knowPublisher = Utils_TestMethods_Knowledge.getKnowledgePublisher();
        System.runAs(knowPublisher){
            List<Knowledge__kav> lstKnowledge= new List<Knowledge__kav>();
            Id kaRecordTypeId = Schema.SObjectType.Knowledge__kav.getRecordTypeInfosByName().get('Knowledge Article').getRecordTypeId();
            // Creating a batch of 100 Knowledge Article of Recordtype 'Knowledge Article'
            set<string> KnowledgeArticleIds=new set<string>();
            for(Integer i=0;i <100;i++)
            {
                Knowledge__kav know = new Knowledge__kav();
                know.Title ='Name'+i;
                know.UrlName ='Name'+i;
                know.RecordTypeId = kaRecordTypeId;
                know.ProblemDescription__c = 'problem description';
                //know.BatchNumber__c = 'batch1';
                know.ValidationStatus='Not Validated';
                lstKnowledge.add(know);
            }
            insert lstKnowledge;
            // Query the records created above
            List<Knowledge__kav> lstKnowledgeafterInsert= new List<Knowledge__kav>();
            lstKnowledgeafterInsert = [select id,PublishStatus,KnowledgeArticleId from Knowledge__kav where Id IN: lstKnowledge AND PublishStatus='Draft'];
            system.debug('lstKnowledgeafterInsert'+lstKnowledgeafterInsert);

            for(Knowledge__kav k:lstKnowledgeafterInsert) {
                KnowledgeArticleIds.add(k.KnowledgeArticleId);
                system.debug('lstKnowledgeafterInsert'+k.KnowledgeArticleId); 
            }
            
            Map<string,Knowledge__kav> mpknow=new Map<string,Knowledge__kav>(lstKnowledgeafterInsert); 
            List<KnowledgeProduct__c> ProdList=new List<KnowledgeProduct__c>();
             List<Knowledge_Customer_Feedback__c> kcflist=new List<Knowledge_Customer_Feedback__c>();
            Id recordTypeIdKCF =Schema.SObjectType.Knowledge_Customer_Feedback__c.getRecordTypeInfosByDeveloperName().get('External').getRecordTypeId();
            for(Knowledge__kav KnowId:lstKnowledgeafterInsert)
            {
            Knowledge_Customer_Feedback__c kcf = new Knowledge_Customer_Feedback__c();
            kcf.Knowledge__c=KnowId.Id;
            kcf.No__c=true;
            kcf.RecordTypeId=recordTypeIdKCF;
            kcflist.add(kcf);
            Knowledge_Customer_Feedback__c kcf1 = new Knowledge_Customer_Feedback__c();
            kcf1.Knowledge__c=KnowId.Id;
            kcf1.No__c=true;
            kcf1.RecordTypeId=recordTypeIdKCF;
            kcflist.add(kcf1);
            
            Knowledge_Customer_Feedback__c kcf2 = new Knowledge_Customer_Feedback__c();
            kcf2.Knowledge__c=KnowId.Id;
            kcf2.No__c=true;
            kcf2.RecordTypeId=recordTypeIdKCF;
            kcflist.add(kcf2);
              KnowledgeProduct__c knowprod1=new KnowledgeProduct__c();
            knowprod1.CurrencyIsoCode='USD';
            knowprod1.Knowledge__c=KnowId.id;
            KnowledgeProduct__c knowprod2=new KnowledgeProduct__c();
            knowprod2.CurrencyIsoCode='USD';
            knowprod2.Knowledge__c=KnowId.id;
            KnowledgeProduct__c knowprod3=new KnowledgeProduct__c();
            knowprod3.CurrencyIsoCode='USD';
            knowprod3.Knowledge__c=KnowId.id;
            ProdList.add(knowprod1);
            ProdList.add(knowprod2);
            ProdList.add(knowprod3);
            
      
            }    
            insert ProdList; 
            insert kcflist;
            
            
            Test.startTest();
            Batch_PublishknowledgeArticle obj = new Batch_PublishknowledgeArticle();
            Database.QueryLocator ql = obj.start(null);
            obj.execute(null,lstKnowledgeafterInsert);
            obj.Finish(null);
            //DataBase.executeBatch(obj); 
            
             system.debug('KnowledgeArticleIds size-------------------------------'+KnowledgeArticleIds.size());
            
              String query='SELECT id,Title,BatchNumber__c,publishstatus,KnowledgeArticleId FROM Knowledge__kav  where Publishstatus=\'Online\' and KnowledgeArticleId in:KnowledgeArticleIds';
             system.debug(query);
             
            batch_convertPublish_to_draftArticle obj1 = new batch_convertPublish_to_draftArticle(query);
            DataBase.executeBatch(obj1); 
             
             Test.stopTest();  
        }
    }
}
The first 2 have same id and 2nd having same id. I want to combined records based on IDs

Target__c:{ActualJun__c=1006019.98, Id=a0C7E00000D2UdeUAF}
 Target__c:{Actualoct__c=1331.01, Id=a0C7E00000D2UdeUAF}

Target__c:{ActualJun__c=1006019.98, Id=a0C7E00000D2V4GUAV}
 Target__c:{Actualoct__c=1331.01, Id=a0C7E00000D2V4GUAV}
I have created a VFPage extension to overide standard button New For opp page. In Desktop version while clicking on new its redirecting to the vfpage. I have checked the available to mobile page in vfpage. And trying to access the same component in mobile Applicatoin