• kiran25
  • NEWBIE
  • 10 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 15
    Replies

Hi, 
I am New Bie to salesforce development , changed my Role Admin to development recently. 
I have requirement to recieve 3 feilds data from SAP 

I am trying to create Webservice SOAP UI class to provide for Third party team as WSDL file .

I was able to achieve with this but they responded after providning WSDL file.
 

global Class Routecode {
//add webservice method in order to use Soap API 

Webservice Static String CreateNewPoint(String Name, String CountryCode, String PortName,String Route_Code)
{
Point__c Point = new Point__c();
try{
Point.Name = Point.Name;
Point.CountryCode__c =Point.CountryCode__c;
Point.PortName__c= Point.PortName__c;

Insert Point;
}
catch(Exception ex){
System.debug('Exception'+ex.getMessage());
}
return Point.Id;
}
}

Response : 

In your wsdl, only allowed single record. The web service should allow list of records. Request to make change to wsdl.

 






 

Hi I am New Bie to salesforce development moved from Admin to Development few weeks ago .

I am trying to write a test class for the below code.
 
Public class TriggerHandler_Controller
{         
    
    public void afterInsert(List<RPR__c> objList){
        List<Quote> quoteList = new List<Quote>();
        List<QuoteLineItem> qliList = new List<QuoteLineItem>();
        
        Pricebookentry pbe = [select Id,pricebook2Id,product2Id from PricebookEntry where product2id = '01t28000000cRQsAAM'];
        Id oppId = [select id from opportunity where id =: '0060k00000CuKIw' LIMIT 1].Id;
        
        Set<Id> accId = new Set<Id>();
        List<RPR__c> rprList = new List<RPR__c>();
        for(RPR__c rpr : objList)
        {
            rprList.add(rpr);
            accId.add(rpr.Account__c);
        }
        List<Opportunity> oppList = [SELECT Id,Name FROM Opportunity
                                     WHERE AccountId IN : accId];
        System.debug('Account Set'+accId + ' Opportunity List '+ oppList);
        for(RPR__c rprNew : rprList){
            Quote q = new Quote();
            q.Name = 'Teston New Quote'+rprNew.Name;
            
            q.OpportunityId = oppList[0].Id;
            q.Ship_To_City__c = rprNew.Shipment_From__c;
            q.Pricebook2Id = pbe.pricebook2id;
            quoteList.add(q);
        }
        
        if(!quoteList.isEmpty()){
            insert quoteList;
        }
        
        for(Quote q : quoteList){
            QuoteLineItem qli = new QuoteLineItem();
  
            qli.QuoteId = q.Id;
            qli.quantity = 2;
            qli.pricebookentryId = pbe.id;
            qli.unitprice = 10;
            qli.product2Id = pbe.product2Id;
            qli.Packing_Style__c = q.X1_Packing_Style__c;
            
            qliList.add(qli);
        }
        
        if(!qliList.isEmpty()){
            insert qliList;
        }      
        
        
        
        
    }
    public void beforeUpdate(List<RPR__c> objList){
        
        Set<Id> RPR_Ids = new Set<Id>();
        for(RPR__c obj : objList){
            RPR_Ids.add(obj.Id);
        }
        
        Map<Id, RPR__c> oppMap = new Map<Id, RPR__c>([
            Select (Select IsPending, ProcessInstanceId, TargetObjectId, StepStatus, OriginalActorId, ActorId,Actor.Name, RemindersSent, Comments, IsDeleted, CreatedDate, CreatedById, SystemModstamp 
                    From ProcessSteps where StepStatus IN ('Approved','Rejected') ORDER BY CreatedDate DESC) From RPR__c WHERE Id IN : RPR_Ids]);
        
        for(RPR__c opp: objList) {
            RPR__c opp1 = oppMap.get(opp.Id);
            opp.Approver_Comments__c = '';
            for (ProcessInstanceHistory processStep : opp1.ProcessSteps) {
                opp.Approver_Comments3__c = 'aa'; //This is a dummy value & field only.
                opp.Approver_Comments__c += 'Comments: ' + processStep.comments + ' . Status: ' + processStep.StepStatus + ' . Date: ' + processStep.CreatedDate +' . Commentor Name: ' + processStep.Actor.Name + '\\';
                //opp.Approved_Date__c = DateTime.parse(system.now().format());
                opp.Approver_Comments3__c = 'aa'; //This is a dummy value & field only, DO NOT DELETE, MAY EFFECT REPORT TYPE
            }
            opp.Approver_Comments3__c = 'aa';
        }
        
    }
    
}


The test class with i wrote is showing zero code coverage , please help me out what went wrong and what should be added to get the code coverage for this.

@isTest (SeeAllData=false)
public class TriggerHandlerTest {
    
    @isTest
    public static void test()
    {
        

  RPR__c RPR = new RPR__c();
        //RPR.id = 'a0A0k00000Pk6GgEAJ';
        RPR.Requested_Date__c = Date.newInstance(2010, 07, 15);
        RPR.Approval_Status2__c = 'Draft';
        RPR.Account__c = '0012800000mRNOaAAO';
        RPR.Approver_Comments3__c = 'ok';
        insert RPR;
        
        User submitter = [SELECT Id FROM User WHERE IsActive = true LIMIT 1];
        
        
        //System.runAs(submitter) {
            Approval.ProcessSubmitRequest r = new Approval.ProcessSubmitRequest();
            r.setObjectId(RPR.Id);
            r.setNextApproverIds(new Id[] {UserInfo.getUserId()});
            //r.setNextApproverIds(null);      
            //r.setNextApproverIds('80010000000EAMZ');
            Approval.process(r);
        //}
        
        
        Test.startTest();
        update RPR;
        Test.stopTest();
    }
 






 

We have Hybris External system which is trying to send data to salesforce for this we need to provide this class so that  once they send data opportunity record will be created .
That data includes quote and quoteline item details as well . 
Hybris system is using REST API , Please Suggest Webservice class which helps

Hi I am Newbie to Development from Salesforce Admin .

I was able to write a trigger for a requirment to create Quote and Quoteline item from custom object named RPR , But i have this sutiation that i already have a trigger in same object which is causing my newly created trigger to get dectiavted .

As per research that i have done i got to know that it can be sloved by creating an apex trigger handler .

This is my newly created trigger .

 

trigger RPRTrigger on RPR__c (after insert) 
{
    List<Quote> quoteList = new List<Quote>();
    List<QuoteLineItem> qliList = new List<QuoteLineItem>();
    
    Pricebookentry pbe = [select Id,pricebook2Id,product2Id from PricebookEntry where product2id = '01t2s00000077OF'];
    Id oppId = [select id from opportunity where id =: '006p000000Abxrb' LIMIT 1].Id;
    if(trigger.isInsert && trigger.isAfter)
    {
        Set<Id> accId = new Set<Id>();
        List<RPR__c> rprList = new List<RPR__c>();
        for(RPR__c rpr : trigger.new)
        {
            rprList.add(rpr);
            accId.add(rpr.Account__c);
        }
        List<Opportunity> oppList = [SELECT Id,Name FROM Opportunity
                                     WHERE AccountId IN : accId];
        System.debug('Account Set'+accId + ' Opportunity List '+ oppList);
        for(RPR__c rprNew : rprList){
            Quote q = new Quote();
            q.Name = 'Teston New Quote'+rprNew.Name;
            
            q.OpportunityId = oppList[0].Id;
            q.Ship_To_City__c = rprNew.Shipment_From__c;
            q.Pricebook2Id = pbe.pricebook2id;
            quoteList.add(q);
        }
        
        if(!quoteList.isEmpty()){
            insert quoteList;
        }
        
        for(Quote q : quoteList){
            QuoteLineItem qli = new QuoteLineItem();
            qli.QuoteId = q.Id;
            qli.quantity = 2;
            qli.pricebookentryId = pbe.id;
            qli.unitprice = 10;
            qli.product2Id = pbe.product2Id;
            qli.Packing_Style__c = q.X1_Packing_Style__c;
            
            qliList.add(qli);
        }
        
        if(!qliList.isEmpty()){
            insert qliList;
        }      
        
    }
}

 

This trigger is getting deactived if the below existing trigger fires .

trigger pullCommentsApproval on RPR__c (before update) {
    Map<Id, RPR__c> oppMap = new Map<Id, RPR__c>([
        Select (Select IsPending, ProcessInstanceId, TargetObjectId, StepStatus, OriginalActorId, ActorId,Actor.Name, RemindersSent, Comments, IsDeleted, CreatedDate, CreatedById, SystemModstamp 
         From ProcessSteps where StepStatus IN ('Approved','Rejected') ORDER BY CreatedDate DESC) From RPR__c WHERE Id IN : Trigger.new]);
    
    for(RPR__c opp: Trigger.new) {
        RPR__c opp1 = oppMap.get(opp.Id);
        opp.Approver_Comments__c = '';
        for (ProcessInstanceHistory processStep : opp1.ProcessSteps) {
            opp.Approver_Comments3__c = 'aa'; //This is a dummy value & field only.
            opp.Approver_Comments__c += 'Comments: ' + processStep.comments + ' . Status: ' + processStep.StepStatus + ' . Date: ' + processStep.CreatedDate +' . Commentor Name: ' + processStep.Actor.Name + '\\';
            //opp.Approved_Date__c = DateTime.parse(system.now().format());
            opp.Approver_Comments3__c = 'aa'; //This is a dummy value & field only, DO NOT DELETE, MAY EFFECT REPORT TYPE
        }
        opp.Approver_Comments3__c = 'aa';
    }
}

 

what should i consider and how i can complete a trigger handler in order make my newly created trigger stable without getting deactivated .

Any suggestions will be a great help ! Thanks in advance :)

 

 

 

Hi i have a requirement to copy a quote and quote line item record details to its related custom object called RPR__c  i am wondering if one trigger can do an ideas ?

can i have a sample trigger that can clone both object record into its related list called RPR

Hi, 
I am New Bie to salesforce development , changed my Role Admin to development recently. 
I have requirement to recieve 3 feilds data from SAP 

I am trying to create Webservice SOAP UI class to provide for Third party team as WSDL file .

I was able to achieve with this but they responded after providning WSDL file.
 

global Class Routecode {
//add webservice method in order to use Soap API 

Webservice Static String CreateNewPoint(String Name, String CountryCode, String PortName,String Route_Code)
{
Point__c Point = new Point__c();
try{
Point.Name = Point.Name;
Point.CountryCode__c =Point.CountryCode__c;
Point.PortName__c= Point.PortName__c;

Insert Point;
}
catch(Exception ex){
System.debug('Exception'+ex.getMessage());
}
return Point.Id;
}
}

Response : 

In your wsdl, only allowed single record. The web service should allow list of records. Request to make change to wsdl.

 






 

Hi I am New Bie to salesforce development moved from Admin to Development few weeks ago .

I am trying to write a test class for the below code.
 
Public class TriggerHandler_Controller
{         
    
    public void afterInsert(List<RPR__c> objList){
        List<Quote> quoteList = new List<Quote>();
        List<QuoteLineItem> qliList = new List<QuoteLineItem>();
        
        Pricebookentry pbe = [select Id,pricebook2Id,product2Id from PricebookEntry where product2id = '01t28000000cRQsAAM'];
        Id oppId = [select id from opportunity where id =: '0060k00000CuKIw' LIMIT 1].Id;
        
        Set<Id> accId = new Set<Id>();
        List<RPR__c> rprList = new List<RPR__c>();
        for(RPR__c rpr : objList)
        {
            rprList.add(rpr);
            accId.add(rpr.Account__c);
        }
        List<Opportunity> oppList = [SELECT Id,Name FROM Opportunity
                                     WHERE AccountId IN : accId];
        System.debug('Account Set'+accId + ' Opportunity List '+ oppList);
        for(RPR__c rprNew : rprList){
            Quote q = new Quote();
            q.Name = 'Teston New Quote'+rprNew.Name;
            
            q.OpportunityId = oppList[0].Id;
            q.Ship_To_City__c = rprNew.Shipment_From__c;
            q.Pricebook2Id = pbe.pricebook2id;
            quoteList.add(q);
        }
        
        if(!quoteList.isEmpty()){
            insert quoteList;
        }
        
        for(Quote q : quoteList){
            QuoteLineItem qli = new QuoteLineItem();
  
            qli.QuoteId = q.Id;
            qli.quantity = 2;
            qli.pricebookentryId = pbe.id;
            qli.unitprice = 10;
            qli.product2Id = pbe.product2Id;
            qli.Packing_Style__c = q.X1_Packing_Style__c;
            
            qliList.add(qli);
        }
        
        if(!qliList.isEmpty()){
            insert qliList;
        }      
        
        
        
        
    }
    public void beforeUpdate(List<RPR__c> objList){
        
        Set<Id> RPR_Ids = new Set<Id>();
        for(RPR__c obj : objList){
            RPR_Ids.add(obj.Id);
        }
        
        Map<Id, RPR__c> oppMap = new Map<Id, RPR__c>([
            Select (Select IsPending, ProcessInstanceId, TargetObjectId, StepStatus, OriginalActorId, ActorId,Actor.Name, RemindersSent, Comments, IsDeleted, CreatedDate, CreatedById, SystemModstamp 
                    From ProcessSteps where StepStatus IN ('Approved','Rejected') ORDER BY CreatedDate DESC) From RPR__c WHERE Id IN : RPR_Ids]);
        
        for(RPR__c opp: objList) {
            RPR__c opp1 = oppMap.get(opp.Id);
            opp.Approver_Comments__c = '';
            for (ProcessInstanceHistory processStep : opp1.ProcessSteps) {
                opp.Approver_Comments3__c = 'aa'; //This is a dummy value & field only.
                opp.Approver_Comments__c += 'Comments: ' + processStep.comments + ' . Status: ' + processStep.StepStatus + ' . Date: ' + processStep.CreatedDate +' . Commentor Name: ' + processStep.Actor.Name + '\\';
                //opp.Approved_Date__c = DateTime.parse(system.now().format());
                opp.Approver_Comments3__c = 'aa'; //This is a dummy value & field only, DO NOT DELETE, MAY EFFECT REPORT TYPE
            }
            opp.Approver_Comments3__c = 'aa';
        }
        
    }
    
}


The test class with i wrote is showing zero code coverage , please help me out what went wrong and what should be added to get the code coverage for this.

@isTest (SeeAllData=false)
public class TriggerHandlerTest {
    
    @isTest
    public static void test()
    {
        

  RPR__c RPR = new RPR__c();
        //RPR.id = 'a0A0k00000Pk6GgEAJ';
        RPR.Requested_Date__c = Date.newInstance(2010, 07, 15);
        RPR.Approval_Status2__c = 'Draft';
        RPR.Account__c = '0012800000mRNOaAAO';
        RPR.Approver_Comments3__c = 'ok';
        insert RPR;
        
        User submitter = [SELECT Id FROM User WHERE IsActive = true LIMIT 1];
        
        
        //System.runAs(submitter) {
            Approval.ProcessSubmitRequest r = new Approval.ProcessSubmitRequest();
            r.setObjectId(RPR.Id);
            r.setNextApproverIds(new Id[] {UserInfo.getUserId()});
            //r.setNextApproverIds(null);      
            //r.setNextApproverIds('80010000000EAMZ');
            Approval.process(r);
        //}
        
        
        Test.startTest();
        update RPR;
        Test.stopTest();
    }
 






 

Hi I am Newbie to Development from Salesforce Admin .

I was able to write a trigger for a requirment to create Quote and Quoteline item from custom object named RPR , But i have this sutiation that i already have a trigger in same object which is causing my newly created trigger to get dectiavted .

As per research that i have done i got to know that it can be sloved by creating an apex trigger handler .

This is my newly created trigger .

 

trigger RPRTrigger on RPR__c (after insert) 
{
    List<Quote> quoteList = new List<Quote>();
    List<QuoteLineItem> qliList = new List<QuoteLineItem>();
    
    Pricebookentry pbe = [select Id,pricebook2Id,product2Id from PricebookEntry where product2id = '01t2s00000077OF'];
    Id oppId = [select id from opportunity where id =: '006p000000Abxrb' LIMIT 1].Id;
    if(trigger.isInsert && trigger.isAfter)
    {
        Set<Id> accId = new Set<Id>();
        List<RPR__c> rprList = new List<RPR__c>();
        for(RPR__c rpr : trigger.new)
        {
            rprList.add(rpr);
            accId.add(rpr.Account__c);
        }
        List<Opportunity> oppList = [SELECT Id,Name FROM Opportunity
                                     WHERE AccountId IN : accId];
        System.debug('Account Set'+accId + ' Opportunity List '+ oppList);
        for(RPR__c rprNew : rprList){
            Quote q = new Quote();
            q.Name = 'Teston New Quote'+rprNew.Name;
            
            q.OpportunityId = oppList[0].Id;
            q.Ship_To_City__c = rprNew.Shipment_From__c;
            q.Pricebook2Id = pbe.pricebook2id;
            quoteList.add(q);
        }
        
        if(!quoteList.isEmpty()){
            insert quoteList;
        }
        
        for(Quote q : quoteList){
            QuoteLineItem qli = new QuoteLineItem();
            qli.QuoteId = q.Id;
            qli.quantity = 2;
            qli.pricebookentryId = pbe.id;
            qli.unitprice = 10;
            qli.product2Id = pbe.product2Id;
            qli.Packing_Style__c = q.X1_Packing_Style__c;
            
            qliList.add(qli);
        }
        
        if(!qliList.isEmpty()){
            insert qliList;
        }      
        
    }
}

 

This trigger is getting deactived if the below existing trigger fires .

trigger pullCommentsApproval on RPR__c (before update) {
    Map<Id, RPR__c> oppMap = new Map<Id, RPR__c>([
        Select (Select IsPending, ProcessInstanceId, TargetObjectId, StepStatus, OriginalActorId, ActorId,Actor.Name, RemindersSent, Comments, IsDeleted, CreatedDate, CreatedById, SystemModstamp 
         From ProcessSteps where StepStatus IN ('Approved','Rejected') ORDER BY CreatedDate DESC) From RPR__c WHERE Id IN : Trigger.new]);
    
    for(RPR__c opp: Trigger.new) {
        RPR__c opp1 = oppMap.get(opp.Id);
        opp.Approver_Comments__c = '';
        for (ProcessInstanceHistory processStep : opp1.ProcessSteps) {
            opp.Approver_Comments3__c = 'aa'; //This is a dummy value & field only.
            opp.Approver_Comments__c += 'Comments: ' + processStep.comments + ' . Status: ' + processStep.StepStatus + ' . Date: ' + processStep.CreatedDate +' . Commentor Name: ' + processStep.Actor.Name + '\\';
            //opp.Approved_Date__c = DateTime.parse(system.now().format());
            opp.Approver_Comments3__c = 'aa'; //This is a dummy value & field only, DO NOT DELETE, MAY EFFECT REPORT TYPE
        }
        opp.Approver_Comments3__c = 'aa';
    }
}

 

what should i consider and how i can complete a trigger handler in order make my newly created trigger stable without getting deactivated .

Any suggestions will be a great help ! Thanks in advance :)