• VRK
  • NEWBIE
  • 205 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 88
    Questions
  • 67
    Replies

Hi All,
When i run the test class, it covers only 50% not covering the  For loop condition , can you pls help me how to cover this :
User-added image
Apex class:
public class SortedLineItemsController {
public Opportunity opportunity { get; set; }
    
    public OpportunityLineItem[] getSorted() {
        if (opportunity == null || opportunity.opportunityLineItems== null) {
            return null;
        }
        
        // TODO: Add your sorting logic here (demo just reverses the list)
        OpportunityLineItem[] result = new OpportunityLineItem[1];
        for (OpportunityLineItem item : opportunity.opportunityLineItems) {
            result.add(0, item);
        }
        
        return result;
   }
}

Test class :

@isTest
public class SortedLineItemsController_Test {
    @isTest static void insertOpp() {
        Id pricebookId = Test.getStandardPricebookId();
        
        Test.startTest();
        // insert product
        Product2 p = new Product2();
        p.Name = ' Test Product ';
        p.Description='Test Product Entry For Product';
        p.productCode = 'SFDCPanther-123';
        p.isActive = true;
        insert p;
        
        // insert pricebook entry for the product
        PricebookEntry standardPrice = new PricebookEntry();
        standardPrice.Pricebook2Id = Test.getStandardPricebookId();
        standardPrice.Product2Id = p.Id;
        standardPrice.UnitPrice = 100;
        standardPrice.IsActive = true;
        standardPrice.UseStandardPrice = false;
        insert standardPrice ;
        
        Account testAccount1 = new Account();
        testAccount1.Name = 'Test Account 1';
        testAccount1.Industry__c    = 'Aerospace';
        insert testAccount1;
        
        Opportunity testOpportunity1 = new Opportunity();
        testOpportunity1.Name = 'Test Opportunity';
        testOpportunity1.AccountId = testAccount1.Id;
        testOpportunity1.StageName = '0 - Qualify Opportunity';
        testOpportunity1.Probability_2__c = '10%' ;
        testOpportunity1.CloseDate = system.today() + 10;
        testOpportunity1.Pricebook2Id = Test.getStandardPricebookId();
        
        insert testOpportunity1; 
        
        Opportunity testOpportunity2 = new Opportunity();
        testOpportunity2.Name = 'Test Opportunity';
        testOpportunity2.AccountId = testAccount1.Id;
        testOpportunity2.StageName = '0 - Qualify Opportunity';
        testOpportunity2.Probability_2__c = '10%' ;
        testOpportunity2.CloseDate = system.today() + 10;
        testOpportunity2.Pricebook2Id = Test.getStandardPricebookId();
        
        insert testOpportunity2; 
        
        // Add product and Pricebook to the particular opportunity using OpportunityLineItem 
        OpportunityLineItem oppLineItem = new OpportunityLineItem();
        oppLineItem.OpportunityId = testOpportunity1.Id;
        oppLineItem.PricebookEntryId = standardPrice.Id;
        oppLineItem.UnitPrice = 7000.00;
        oppLineItem.Quantity = 5;
        oppLineItem.Amount_Updated__c = True;
        oppLineItem.Service_Percentage__c = 10;
        insert oppLineItem;
        
        // Add product and Pricebook to the particular opportunity using OpportunityLineItem 
        OpportunityLineItem oppLineItem1 = new OpportunityLineItem();
        oppLineItem1.OpportunityId = testOpportunity2.Id;
        oppLineItem1.PricebookEntryId = standardPrice.Id;
        oppLineItem1.UnitPrice = 6000.25;
        oppLineItem1.Quantity = 5;
        oppLineItem1.Amount_Updated__c = True;
        oppLineItem1.Service_Percentage__c = 15;
        insert oppLineItem1;
        
        
        SortedLineItemsController slic = new SortedLineItemsController();
        List<OpportunityLineItem> slic_q = slic.getSorted();
        OpportunityLineItem[] slic_qli = slic.getSorted();
        OpportunityLineItem[] slic_qli1 = slic.getSorted(); 
        
        Test.stopTest();
    }
}

can you  pls check and let me know how to cover ...

Thanks in Advance

Hi folks,
we plan to migrate existing data from thousand to millions .
my approach here is :
i. i need to export data 
ii. convert thousand to millions in excel sheet
iii. update new data 

But i am in struck in convert data to Million ....i saw few articles in google, its not much clear .
exisitng field data type is (Currency(16, 1)
 
11434
1828786
960
14426
2862161
2056369
2342
 

can anyone help me to covert data to Millions ....in excel .

or if you have any best approaches pls suggest 
Thanks 
VRK
Hi Team,
I got one question from the interviewer that:
I have two users I want to show A user half of the fields of XYZ object and B wants to show remaining fields in the aura component, how we can achieve this.
 
Hi ..
HI i am created one formula field which fetch value of StageName( picklist ) value.
if picklist value select As 01 - Funded, the formula field updated As 01.
if picklist value select As 02 - Approved, the formula field updated As 02.
Below coding is working fine, But i need write Dynmic instead of pass static Values.
We have 100 picklist values, So is there any way to write logic as dynamic ..

IF(ISPICKVAL( StageName , "01 - Funded"), "01",
IF(ISPICKVAL( StageName , "02 - Approved"), "02",
IF(ISPICKVAL( StageName , "03 - Underwriting - In Process"), "03",
IF(ISPICKVAL( StageName , "04 - Term Sheet Issued/Pre-Underwriting"), "04", ""))))

Thanks
VRK
Hi folks,
Below logic for 
When Deal Team records created, then same records created into Opp Team member records .
But , i required Logic AS :
If already records available in Opp Team Member , Then we can skip and create only new records
can any one helpme how to write logic for this :

global class BatchClass implements Database.Batchable<sobject>{
    
   Set<Id> dealIds = new Set<Id>();
   String sQuery;
   map<id, opportunity> mapOppIdRec = new map<id, opportunity>();
    // Start Method
    global Database.Querylocator start (Database.BatchableContext BC) {
        String sQuery;
       List<Deal_Team__c> listDealIds = [SELECT Name, Description, Deal__c FROM Deal_Team__c WHERE createdDate = yesterday];
       if (listDealIds.size()>0){
            sQuery='SELECT Name, Description, Deal__c FROM Deal_Team__c'; 
        }else {
            sQuery='SELECT Name, Description, Deal__c FROM Deal_Team__c where id=null';
        }
        return Database.getQueryLocator(sQuery);
    }
    
    // Execute method
    global void execute (Database.BatchableContext bc , List<Deal_Team__c> records){
        if (records.size()>0){
            List<OpportunityTeamMember> listToBeInserted = new List<OpportunityTeamMember>();           
            for (Deal_Team__c dealTeams : records){ 
            OpportunityTeamMember newOtm = new OpportunityTeamMember();
            newOtm.OpportunityId = dealTeams.Deal__c;
            //newOtm.CreatedBy = 'OpportunityTeamMember is created by' +userInfo.getUserId();
            listToBeInserted.add(newOtm);
            }         
            upsert listToBeInserted;     
        }
    }
 
    // Finish Method
    global void finish(Database.BatchableContext BC) {}
}
Hi pls l can et me know if anyone have idea on below points:

1. What is the difference between Salesforce IQ Inbox & salesforce Inbox?
ii. is it Licensed or Free ?

I need basic understandings, Pls don't share google stuff ....

Thannks
VRK
Hi 
------------
Issue : Insufficinet access rights on cross-reference ID

Scenario : 
created process builder based on the Asset Object by follow critiria:

AND( AND( NOT ( ISPICKVAL([Asset].ADV_Classification__c,"") ), 
NOT ( ISPICKVAL([Asset].Accounting_Code__c,"") ), 
NOT ( ISPICKVAL([Asset].Accounting_Product__c,"") ), 
NOT ( ISPICKVAL([Asset].Executive_Summary__c,"") ), 
NOT ( ISPICKVAL([Asset].Accounting_Class__c,"") ) ,
ISPICKVAL( [Asset].Status, "onboarding") , 
OR( ISPICKVAL(PRIORVALUE([Asset].ADV_Classification__c) , ""), 
ISPICKVAL(PRIORVALUE([Asset].Accounting_Code__c) , ""), 
ISPICKVAL(PRIORVALUE([Asset].Accounting_Product__c) , ""), 
ISPICKVAL(PRIORVALUE([Asset].Executive_Summary__c) , ""), 
ISPICKVAL(PRIORVALUE([Asset].Accounting_Class__c) , "") ) ) )

Immediate actions:
Create a Record
RecordType : Task
Assigned To ID  : Assign Task Queue
Related to ID   : {Asset.Id}

This issue is getting for only few profiles, But admin profiles not getting 

I verified, profile have proper access for Task , Asset and required fields

And this is happening after Winter 21 Refresh .................

Do you have any ideas ?

Thanks
VRK
-----------------------
Hi Team
My scenario :
For Test purpose , we configured Lightning Sync in Sandbox for User ( tesUser)  . its working fine .
Now , we configured in Prod for the same user 'testUser'.
its also working fine.
Now the problem is , User can able to both Sandbox & Production calender events his Outlook

So, we removed user from Sandbox, Now in sandbox, stopped getting new calender Syns.
But the problem, Old calender syns are still displaying even if we remove 'testUser ' in lighting sync configuration related to Sandbox

can you pls let me know , how can we remove old user's calender Syncs related to Sandbox ?

Thanks
VRK
 
Hi 
Scenario : when i create new Task / Event , then phone number field value populate from related to Contact Object Phone field.
For example :
I have Contact ' Test Contact ' and phone number is '99999999'.
When i create any Task /  Event, then Test Contact phone number is display as '99999999'.

Thanks
VRK

Hi I have few questions on Einstein activity capture , pls let me know if anyone have idea / Suggest for better solutions :

My requirement :
------------------------------

Calender Sync Salesforce ( bi-direction)
        &&
Task Sync ( bi-direction)

my analysis :
-------------
Lightning Sync :
---- After Dec 2020 , its depreciated and Salesforce suggested go for 'Einstein Actvity Capture'
My questions are ??
i. Is Einstein supports both Calender Sync & Tasks Sync
Note : I am sure, its support for Calender Sync But not sure for Tasks Sync

2. 
License = Sales Cloud Einstein --> Permission Set = Sales Cloud Einstein  
License = Inbox --> Permission Set = Inbox with Einstein Activity Capture
License = Sales Cloud --> Permission Set = Standard Einstein Activity Capture
Any one idea, which License supports for my requirement ? and is this License free or Cost ?

3. Do you have any other Suggestions for Tasks Sync ?
Pls treat this is little bit urget...
Thanks
VRK

Hi all,
pls find my requirment below :

Required to  create http get from complex json  &   cast http response with apex.class of the json
if anyone have scenarios / code pls share

Thanks
VRK
 

Hi
How to Fetch only '"Contract Release' in below JSON Data :::

data->
        [{"Date_Reviewed":"1989-05-06","Date_Sent":"1989-05-05","editable":true,"Form":"Contract Revision 1","Id":"a0S3F000001bXAIUA2"},
        {"Date_Reviewed":"2019-02-01","Date_Sent":"2019-02-01","editable":true,"Form":"Contract Revision 2","Id":"a0S3F000001bXAJUA2"},
        {"Date_Reviewed":"2020-12-27","editable":true,"Form":"Contract Revision 3","Id":"a0S3F000001bXAKUA2"},
        {"Date_Reviewed":"2020-01-03","Date_Sent":"2020-01-03","editable":true,"Form":"Contract Release","Id":"a0S3F000001bXALUA2"},
        {"Date_Reviewed":"2020-12-29","editable":true,"Form":"Contract Revision 4","Id":"a0S3F000001bXAMUA2"},
        {"Date_Reviewed":"2020-12-30","editable":true,"Form":"Contract Revision 5","Id":"a0S3F000001bXANUA2"},
]        

My code :
saveDataTable :function(component, event) {
var data = component.get("v.data"); 
 var editedRecords1 =  component.find("riderStatusDataTable").get("v.draftValues");
for (var x in data)
            {
              var d = data[x];
 if(d.Form == "Contract Release" ){
  TemporaryArray1.Date_Sent__c = editedRecords1[0].Date_Sent;
           TemporaryArray1.Date_Reviewed__c = editedRecords1[0].Date_Reviewed;
break;
}
But , this is not Restrict for Contract Release ........its applied for all the Forms . I need this is for only 'Contract Release'...
can anyone help me...
Thanks
VRK