• Sudhir Narayanswamy
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 3
    Replies
Hi,
   I have a requirement with pick list values 

   Record Type Record_Type_Name__c = ( Partner, Forti User, End User)
  
   profile 1 = 00e340000011weF
   profile 2 = 00e30000000boI5
   User 1 = 00534000008Rauz

 Here Profile 1 and 2 are only allowed to change picklist values other than this no one is allowed to change.
 User 1 is allowed to change only pick list Record_Type_Name__c  value from  (Forti User to End User) other than this he is not allowed to change.
 
 Please suggest me how to add this condition in salesforce formula

Thanks
Sudhir
 
Hi, 

  I have a requirement where user will pass APG-374-NN223-F1 I need to split the string each after - and assign this to a variable to inset into a different custom field Please suggest me how to implement this feature using apex. 

Thanks
Sudhir
Hi, 

   How to get the record id from trigger this need to be mapped in another object after that records is inserted. 

   Below is the code written but not able to achive to get return id

   
trigger AssetHPSyncTrg on Asset_Stage__c (Before Insert, Before Update, After Insert) {

list<String> HPEOppId = new list<String>();
list<String> HPESerialNumber = new list<String>();
list<String> OrderStatus = new list<String>();
list<String> Ordertype = new list<String>();
list<String> HPEOrderNumber = new list<String>();
list<String> HPEQuoteNumber = new list<String>();
list<String> PurchaseDate = new list<String>();
list<String> ShipDate = new list<String>();
list<String> SupportStartDate = new list<String>();
list<String> SupportEndDate = new list<String>();
list<String> InstallAddStreet1 = new list<String>();
list<String> InstallAddStreet2 = new list<String>();
list<String> InstallAddCity = new list<String>();
list<String> InstallAddState = new list<String>();
list<String> InstallAddCountry = new list<String>();
list<String> SLA = new list<String>();
list<String> ContactEmail = new list<String>();
list<String> ContactName = new list<String>();
list<String> AstStageID = new list<String>();

 if(trigger.isBefore && trigger.isInsert){
  for (Asset_Stage__c asts :  Trigger.new)
  {
    HPEOppId.add(asts.HPE_Opportunity_ID__c);    
    HPESerialNumber.add(asts.HPE_Serial_Number__c);
    OrderStatus.add(asts.Order_Status__c);
    Ordertype.add(asts.Order_Type__c);
    HPEOrderNumber.add(asts.HPE_Order_Number__c);
    HPEQuoteNumber.add(asts.HPE_Quote_Number__c);
    PurchaseDate.add(asts.Purchase_Date_HPE_Receive_Date__c);
    ShipDate.add(asts.Order_Ship_Date__c);
    SupportStartDate.add(asts.Support_Start_Date__c);
    SupportEndDate.add(asts.Support_End_Date__c);
    InstallAddStreet1.add(asts.Install_Address_Street1__c);
    InstallAddStreet2.add(asts.Install_Address_Street2__c);
    InstallAddCity.add(asts.Install_Address_City__c);
    InstallAddState.add(asts.Install_Address_State__c);
    InstallAddCountry.add(asts.Install_Address_Country__c); 
    SLA.add(asts.SLA_Support_Level__c);       
    ContactEmail.add(asts.End_Customer_Ship_to_Contact_Email__c);
    ContactName.add(asts.End_Customer_Ship_to_Contact_Name__c);
    AstStageID.add(asts.id);
    asts.Status__c = 'New';
  }
  
   if(HPEOppId!=null && !HPEOppId.isEmpty()){
    AssetHPSyncTrgCls.AssetSync(HPEOppId,
                                HPESerialNumber,
                                OrderStatus,
                                Ordertype,
                                HPEOrderNumber,
                                HPEQuoteNumber,
                                ShipDate,
                                PurchaseDate,
                                SupportStartDate,
                                SupportEndDate,
                                InstallAddStreet1,
                                InstallAddStreet2,
                                InstallAddCity,
                                InstallAddState,
                                InstallAddCountry,
                                SLA,
                                ContactEmail,
                                ContactName,
                                AstStageID                                
                                );
   }
   
 }  
  
  
  
  
}

Please suggest. 

Thanks
Sudhir
Hi, 

 How to remove null values from list in apex

Thanks
Sudhir
Hi, 
   
   We have AfterInsert and AfterUpdate method in a apex class this is not getting coverd in test class please suggest me how to cover this code logic in test class below is the test class

   
@isTest
//(SeeAllData=true)

private class test_WorkOrderInstallationTriggerClass{

    static testMethod void myUnitTest(){
        Test.startTest(); 
 
        Account acc = new Account(); 
        acc.CurrencyIsoCode = 'EUR';
        acc.Name= 'test';
        insert acc;
        Opportunity opp = new opportunity();
        opp.name = 'test';
        opp.AccountId = acc.id;
        opp.Type = 'New Business';
        opp.Sales_Area__c = 'NA Central TOLA';
        opp.CloseDate = System.today();
        opp.StageName = '2-Qualified';
        opp.CurrencyIsoCode = 'EUR';
        opp.Special_Instructions_for_Installation__c = 'test';
        opp.Installation_security_requirements__c = 'None';
        opp.type = 'New Business';
        insert opp;
        opp.Special_Instructions_for_Installation__c = 'test_update';
        update opp;
        Profile p = [SELECT Id FROM Profile WHERE Name='System Administrator'];
        User u = new User(Alias = 'SysAdm', Email='systemadmin@testorg.com', 
                          EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', 
                          LocaleSidKey='en_US', ProfileId = p.Id, 
                          TimeZoneSidKey='America/Los_Angeles', UserName='systemadmin12@testorg.com', Phone = '678836387');
                          insert u;       
        OpportunityTeamMember oppMember = new OpportunityTeamMember();
        oppMember.OpportunityId = opp.id;
        oppMember.TeamMemberRole = 'Account Executive (AE)';
        oppMember.userId = u.id;
        insert oppMember;
        OpportunityTeamMember oppMember1 = new OpportunityTeamMember();
        oppMember1.OpportunityId = opp.id;
        oppMember1.TeamMemberRole = 'Systems Engineer (SE)';
        oppMember1.userId = u.id;
        insert oppMember1;
        Sales_Order__c so = new Sales_Order__c();
        so.Name = 'test';
        so.Type__c = 'Beta';
        so.CurrencyIsoCode = 'EUR';
        so.Opportunity__c = opp.id;
        so.Shipment_Date__c = Date.newInstance(2015,7,27);
        so.Actual_Shipment_Date__c = Date.newInstance(2015,7,27);
        so.Tracking_Number__c = '5247';
        so.SO_Number__c='SO123';
        so.Shipping_Agent_Code__c = 'JIT';
        so.End_Customer_Contact_Name__c = 'test';
        so.End_Customer_Contact_Email__c = 'test@test.com';
        so.End_Customer_Contact_Phone__c = '897372';
        so.Ship_To_Company__c = 'test';
        so.Ship_To_Contact_Name__c = 'test';
        so.Ship_To_Contact_Phone__c = '87988098';
        so.Ship_To_Contact_Email__c = 'test@test.com';
        so.Ship_To_Address_1__c = '562 test';
        so.Ship_To_Address_2__c = '654 test';
        so.Ship_To_City__c = 'test';
        so.Ship_to_State__c = 'test';
        so.Ship_To_Zip_Postal_Code__c = '65787';
        so.Ship_To_Country__c = 'india';
        so.Ship_To_Contact_Name__c = 'test';
        insert so;
        so.Shipment_Date__c = Date.newInstance(2016,7,27);
        so.Actual_Shipment_Date__c = Date.newInstance(2016,7,27);
        so.Tracking_Number__c = '5244';
        so.Shipping_Agent_Code__c = 'AERO';
        so.Pro_Install_Flag__c = true;
        System.debug('test-----');         
        update so;        
        Sales_Order_Line__c soLine = new Sales_Order_Line__c();
        soLine.Sales_Order__c = so.id;
        soLine.CurrencyIsoCode = 'EUR';
        soLine.BOM_Line_Number__c='1';
        soLine.Package_Product_Code__c = 'test';
        soLine.Serial_Number__c = 'SO123';
        soLine.Quantity__c = 1;
        insert soLine;
        Installation_WorkOrder_Contacts__c insWOcontact = new Installation_WorkOrder_Contacts__c();
        insWOcontact.Name = 'test';
        insWOcontact.Email__c = 'test@test.com';
        insWOcontact.Phone__c = '89798890';
        insWOcontact.Role__c = 'coordinator';
        insert insWOcontact;
        Installation_WorkOrder_Contacts__c insWOcontact1 = new Installation_WorkOrder_Contacts__c();
        insWOcontact1.Name = 'test';
  //      insWOcontact1.Email__c = 'test@test.com';
        insWOcontact1.Phone__c = '89798890';
        insWOcontact1.Role__c = 'PSE';
        insWOcontact1.Security_Clear__c = 'TS-SCI clearance';
        insert insWOcontact1;
        WorkOrder__c wo = new WorkOrder__c();
        wo.Name='test';
        wo.Date_installer_confirms_receipt_of_work__c = datetime.newInstance(2015, 7, 28, 13, 5, 23);
        wo.installation_schedule_date_time__c = datetime.newInstance(2015, 7, 28, 13, 5, 23);
        wo.Verified_installation_location__c = true;
        wo.Verified_security_citizenship_rqmnt__c = true;
        wo.Sales_Order_Lookup__c=so.id;
        wo.Installer_coordinator_name1__c = insWOcontact.id;
        wo.PSE_Name1__c = insWOcontact1.id;
        wo.First_attempt_response__c = 'yes';
        wo.new_installation_schedule__c = datetime.newInstance(2015, 7, 28, 13, 5, 23);
        wo.Installation_validation_complete__c = Date.newInstance(2016,7,27);
        wo.Reason_for_escalation__c = 'CUSTOMER unresponsive to initial contact over a 4 day period';
        wo.Escalation_closed1__c = true;
        wo.Ship_to_Company__c='test';
        wo.Ship_to_City__c='test';
        wo.Ship_to_State__c='test';
        wo.Reason_for_escalation1__c = 'CUSTOMER unresponsive to initial contact over a 4 day period';
        wo.Escalation_closed2__c = true;
        wo.Support_Case_closed__c = true;
        wo.Nimble_Customer_Support_case__c = 'WO7892';
        wo.Pre_Inst_Approved__c = datetime.newInstance(2015, 7, 28, 13, 5, 23);
        wo.Escalation_Date_Time__c = datetime.newInstance(2015, 7, 28, 13, 5, 23);
        wo.Security_Requirement_Notes__c = 'TestClass';      
        insert wo;
        
        wo.installation_schedule_date_time__c = datetime.newInstance(2016, 7, 28, 13, 5, 23);
        //Added by Sudhir
        checkRecursive.resetRunOnceFlag(); 
        //checkRecursive.run = true;
        update wo;
         
         
        //System.assertEquals(so.Name,'test');
        //System.assertEquals(wo.Name,'test');
        
  
        Test.stopTest(); 
    } 
 }

 
Hi,
   I have a requirement with pick list values 

   Record Type Record_Type_Name__c = ( Partner, Forti User, End User)
  
   profile 1 = 00e340000011weF
   profile 2 = 00e30000000boI5
   User 1 = 00534000008Rauz

 Here Profile 1 and 2 are only allowed to change picklist values other than this no one is allowed to change.
 User 1 is allowed to change only pick list Record_Type_Name__c  value from  (Forti User to End User) other than this he is not allowed to change.
 
 Please suggest me how to add this condition in salesforce formula

Thanks
Sudhir
 
Hi, 
   
   We have AfterInsert and AfterUpdate method in a apex class this is not getting coverd in test class please suggest me how to cover this code logic in test class below is the test class

   
@isTest
//(SeeAllData=true)

private class test_WorkOrderInstallationTriggerClass{

    static testMethod void myUnitTest(){
        Test.startTest(); 
 
        Account acc = new Account(); 
        acc.CurrencyIsoCode = 'EUR';
        acc.Name= 'test';
        insert acc;
        Opportunity opp = new opportunity();
        opp.name = 'test';
        opp.AccountId = acc.id;
        opp.Type = 'New Business';
        opp.Sales_Area__c = 'NA Central TOLA';
        opp.CloseDate = System.today();
        opp.StageName = '2-Qualified';
        opp.CurrencyIsoCode = 'EUR';
        opp.Special_Instructions_for_Installation__c = 'test';
        opp.Installation_security_requirements__c = 'None';
        opp.type = 'New Business';
        insert opp;
        opp.Special_Instructions_for_Installation__c = 'test_update';
        update opp;
        Profile p = [SELECT Id FROM Profile WHERE Name='System Administrator'];
        User u = new User(Alias = 'SysAdm', Email='systemadmin@testorg.com', 
                          EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', 
                          LocaleSidKey='en_US', ProfileId = p.Id, 
                          TimeZoneSidKey='America/Los_Angeles', UserName='systemadmin12@testorg.com', Phone = '678836387');
                          insert u;       
        OpportunityTeamMember oppMember = new OpportunityTeamMember();
        oppMember.OpportunityId = opp.id;
        oppMember.TeamMemberRole = 'Account Executive (AE)';
        oppMember.userId = u.id;
        insert oppMember;
        OpportunityTeamMember oppMember1 = new OpportunityTeamMember();
        oppMember1.OpportunityId = opp.id;
        oppMember1.TeamMemberRole = 'Systems Engineer (SE)';
        oppMember1.userId = u.id;
        insert oppMember1;
        Sales_Order__c so = new Sales_Order__c();
        so.Name = 'test';
        so.Type__c = 'Beta';
        so.CurrencyIsoCode = 'EUR';
        so.Opportunity__c = opp.id;
        so.Shipment_Date__c = Date.newInstance(2015,7,27);
        so.Actual_Shipment_Date__c = Date.newInstance(2015,7,27);
        so.Tracking_Number__c = '5247';
        so.SO_Number__c='SO123';
        so.Shipping_Agent_Code__c = 'JIT';
        so.End_Customer_Contact_Name__c = 'test';
        so.End_Customer_Contact_Email__c = 'test@test.com';
        so.End_Customer_Contact_Phone__c = '897372';
        so.Ship_To_Company__c = 'test';
        so.Ship_To_Contact_Name__c = 'test';
        so.Ship_To_Contact_Phone__c = '87988098';
        so.Ship_To_Contact_Email__c = 'test@test.com';
        so.Ship_To_Address_1__c = '562 test';
        so.Ship_To_Address_2__c = '654 test';
        so.Ship_To_City__c = 'test';
        so.Ship_to_State__c = 'test';
        so.Ship_To_Zip_Postal_Code__c = '65787';
        so.Ship_To_Country__c = 'india';
        so.Ship_To_Contact_Name__c = 'test';
        insert so;
        so.Shipment_Date__c = Date.newInstance(2016,7,27);
        so.Actual_Shipment_Date__c = Date.newInstance(2016,7,27);
        so.Tracking_Number__c = '5244';
        so.Shipping_Agent_Code__c = 'AERO';
        so.Pro_Install_Flag__c = true;
        System.debug('test-----');         
        update so;        
        Sales_Order_Line__c soLine = new Sales_Order_Line__c();
        soLine.Sales_Order__c = so.id;
        soLine.CurrencyIsoCode = 'EUR';
        soLine.BOM_Line_Number__c='1';
        soLine.Package_Product_Code__c = 'test';
        soLine.Serial_Number__c = 'SO123';
        soLine.Quantity__c = 1;
        insert soLine;
        Installation_WorkOrder_Contacts__c insWOcontact = new Installation_WorkOrder_Contacts__c();
        insWOcontact.Name = 'test';
        insWOcontact.Email__c = 'test@test.com';
        insWOcontact.Phone__c = '89798890';
        insWOcontact.Role__c = 'coordinator';
        insert insWOcontact;
        Installation_WorkOrder_Contacts__c insWOcontact1 = new Installation_WorkOrder_Contacts__c();
        insWOcontact1.Name = 'test';
  //      insWOcontact1.Email__c = 'test@test.com';
        insWOcontact1.Phone__c = '89798890';
        insWOcontact1.Role__c = 'PSE';
        insWOcontact1.Security_Clear__c = 'TS-SCI clearance';
        insert insWOcontact1;
        WorkOrder__c wo = new WorkOrder__c();
        wo.Name='test';
        wo.Date_installer_confirms_receipt_of_work__c = datetime.newInstance(2015, 7, 28, 13, 5, 23);
        wo.installation_schedule_date_time__c = datetime.newInstance(2015, 7, 28, 13, 5, 23);
        wo.Verified_installation_location__c = true;
        wo.Verified_security_citizenship_rqmnt__c = true;
        wo.Sales_Order_Lookup__c=so.id;
        wo.Installer_coordinator_name1__c = insWOcontact.id;
        wo.PSE_Name1__c = insWOcontact1.id;
        wo.First_attempt_response__c = 'yes';
        wo.new_installation_schedule__c = datetime.newInstance(2015, 7, 28, 13, 5, 23);
        wo.Installation_validation_complete__c = Date.newInstance(2016,7,27);
        wo.Reason_for_escalation__c = 'CUSTOMER unresponsive to initial contact over a 4 day period';
        wo.Escalation_closed1__c = true;
        wo.Ship_to_Company__c='test';
        wo.Ship_to_City__c='test';
        wo.Ship_to_State__c='test';
        wo.Reason_for_escalation1__c = 'CUSTOMER unresponsive to initial contact over a 4 day period';
        wo.Escalation_closed2__c = true;
        wo.Support_Case_closed__c = true;
        wo.Nimble_Customer_Support_case__c = 'WO7892';
        wo.Pre_Inst_Approved__c = datetime.newInstance(2015, 7, 28, 13, 5, 23);
        wo.Escalation_Date_Time__c = datetime.newInstance(2015, 7, 28, 13, 5, 23);
        wo.Security_Requirement_Notes__c = 'TestClass';      
        insert wo;
        
        wo.installation_schedule_date_time__c = datetime.newInstance(2016, 7, 28, 13, 5, 23);
        //Added by Sudhir
        checkRecursive.resetRunOnceFlag(); 
        //checkRecursive.run = true;
        update wo;
         
         
        //System.assertEquals(so.Name,'test');
        //System.assertEquals(wo.Name,'test');
        
  
        Test.stopTest(); 
    } 
 }