• sfdc@isha.ax1814
  • NEWBIE
  • 75 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 84
    Questions
  • 51
    Replies
Hi Team,

Can you pleae help me out test class for below class which is calling in case trigger before trigger.

Please help me out on this?

public class AH_HN_Stage_Validations {
    public static void validateStatus(List<Case> vListCase){
        for(Case eachCurrentCase : vListCase){
            String skipErrorMessage = 'You are not allowed to skip a stage. Please follow the workflow.';
            Case oldCase = (Case)Trigger.oldMap.get(eachCurrentCase.Id);
            Id recordtypeAPOId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('APO').getRecordTypeId();
            Id recordtypeEARId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('EAR').getRecordTypeId();
            
            If(eachCurrentCase.RecordTypeId == recordtypeAPOId || eachCurrentCase.RecordTypeId == recordtypeEARId){
                //Status validation for - QC1
                If(eachCurrentCase.Status == 'QC1'){
                    If(eachCurrentCase.Status == 'QC1' && oldCase.Status=='MRP'){
                        eachCurrentCase.addError(skipErrorMessage);
                    }                                
                }
                //Status validation for - Physician Expert Review
                If(eachCurrentCase.Status == 'Physician Expert Review'){
                    If(eachCurrentCase.Status == 'Physician Expert Review' && (oldCase.Status=='MRP' || oldCase.Status=='Narrative')){
                        eachCurrentCase.addError(skipErrorMessage);
                    }                                
                }
                //Status validation for - QC2
                If(eachCurrentCase.Status == 'QC2'){
                    If(eachCurrentCase.Status == 'QC2' && (oldCase.Status=='MRP' || oldCase.Status=='Narrative' || oldCase.Status=='QC1')){
                        eachCurrentCase.addError(skipErrorMessage);
                    }                                
                }
                //Status validation for - AH MD Review
                If(eachCurrentCase.Status == 'AH MD Review'){
                    If(eachCurrentCase.Status == 'AH MD Review' && (oldCase.Status=='MRP' || oldCase.Status=='Narrative' || oldCase.Status=='QC1' || oldCase.Status=='Physician Expert Review')){
                        eachCurrentCase.addError(skipErrorMessage);
                    }                                
                }
                //Status validation for - Report Sent
                If(eachCurrentCase.Status == 'Report Sent'){
                    If(eachCurrentCase.Status == 'Report Sent' && (oldCase.Status=='MRP' || oldCase.Status=='Narrative' || oldCase.Status=='QC1' || oldCase.Status=='Physician Expert Review' || oldCase.Status=='QC2')){
                        eachCurrentCase.addError(skipErrorMessage);
                    }                                
                }
                //Status validation for - Peer Consult
                    If(eachCurrentCase.Status == 'Peer Consult  '){
                        If(eachCurrentCase.Status == 'Peer Consult' && (oldCase.Status=='MRP' || oldCase.Status=='Narrative' || oldCase.Status=='QC1' || oldCase.Status=='Physician Expert Review' || oldCase.Status=='QC2' || oldCase.Status=='AH MD Review')){
                        eachCurrentCase.addError(skipErrorMessage);
                    }                                
                }
                //Status validation for - QC3
                If(eachCurrentCase.Status == 'QC3'){
                    If(eachCurrentCase.Status == 'QC3' && (oldCase.Status=='MRP' || oldCase.Status=='Narrative' || oldCase.Status=='QC1' || oldCase.Status=='Physician Expert Review' || oldCase.Status=='QC2' || oldCase.Status=='AH MD Review' || oldCase.Status=='Report Sent')){
                        eachCurrentCase.addError(skipErrorMessage);
                    }                                
                }
                //Status validation for - Peer Consult Review Sent
                If(eachCurrentCase.Status == 'Peer Consult Review Sent'){
                    If(eachCurrentCase.Status == 'Peer Consult Review Sent' && (oldCase.Status=='MRP' || oldCase.Status=='Narrative' || oldCase.Status=='QC1' || oldCase.Status=='Physician Expert Review' || oldCase.Status=='QC2' || oldCase.Status=='AH MD Review' || oldCase.Status=='Report Sent' || oldCase.Status=='Peer Consult')){
                        eachCurrentCase.addError(skipErrorMessage);
                    }                                
                }
                //Status validation for - Closed
                If(eachCurrentCase.Status == 'Closed' && oldCase.Status!='Peer Consult'){
                     If(eachCurrentCase.Status == 'Closed' &&  eachCurrentCase.Close_Reason__c==null && (oldCase.Status=='MRP' || oldCase.Status=='Narrative' || oldCase.Status=='QC1' || oldCase.Status=='Physician Expert Review' || oldCase.Status=='QC2' || oldCase.Status=='AH MD Review' || oldCase.Status=='Report Sent' || oldCase.Status=='QC3')){
                        eachCurrentCase.addError(skipErrorMessage);
                    }                                
                }
            }
        }
    }
    
    //MRP_MR_Review_Validations
    public static void MRPvalidate(List<Case> vListCase){
        for(Case eachCurrentCase : vListCase){
            String skipErrorMessage = 'Please complete MR Review.';
            Case oldCase = (Case)Trigger.oldMap.get(eachCurrentCase.Id);
            Id recordtypeAPOId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('APO').getRecordTypeId();
            Id recordtypeEARId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('EAR').getRecordTypeId();
            
            Id guestRecordtypeId = Schema.SObjectType.Task.getRecordTypeInfosByName().get('AH MR Review').getRecordTypeId();
            
            If(eachCurrentCase.RecordTypeId == recordtypeAPOId || eachCurrentCase.RecordTypeId == recordtypeEARId && eachCurrentCase.status != oldCase.status){
                If(eachCurrentCase.Status == 'Narrative' && [select Id, Status,(select id from Tasks Where RecordTypeId =:guestRecordtypeId) from Case Where Id =: eachCurrentCase.Id].Tasks.size()==0){
                    eachCurrentCase.addError(skipErrorMessage);               
                }    
            }
        }
    }
    //Narrative_Fields_Vaidations
    public static void narrativeValidate(List<Case> vListCase){
        for(Case eachCurrentCase : vListCase){
            String skipErrorMessage = 'Please fill clinical Narration.';
            Case oldCase = (Case)Trigger.oldMap.get(eachCurrentCase.Id);
            Id recordtypeAPOId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('APO').getRecordTypeId();
            Id recordtypeEARId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('EAR').getRecordTypeId();
            
            If(eachCurrentCase.RecordTypeId == recordtypeAPOId || eachCurrentCase.RecordTypeId == recordtypeEARId && eachCurrentCase.status != oldCase.status){
                If(eachCurrentCase.Status == 'QC1' && (eachCurrentCase.Clinical_Narrative__c == null && eachCurrentCase.Clinical_Summary__c == null)){
                    eachCurrentCase.addError(skipErrorMessage);               
                }    
            }
        }
    }
//Qc1 Fields_Vaidations
    public static void QC1validate(List<Case> vListCase){
        for(Case eachCurrentCase : vListCase){
            String skipErrorMessage = 'Please complete QC1 related task';
            Case oldCase = (Case)Trigger.oldMap.get(eachCurrentCase.Id);
            Id recordtypeAPOId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('APO').getRecordTypeId();
            Id recordtypeEARId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('EAR').getRecordTypeId();
            //Id guestRecordtypeId = Schema.SObjectType.Task.getRecordTypeInfosByName().get('AH Qualitycheck').getRecordTypeId();
            If(eachCurrentCase.RecordTypeId == recordtypeAPOId || eachCurrentCase.RecordTypeId == recordtypeEARId && eachCurrentCase.status != oldCase.status){
                If(eachCurrentCase.Status == 'Physician Expert Review' && [select Id, Status,(select id,status,Activity_Type__c from Tasks Where status='Open' and Activity_Type__c='QC1') from Case Where Id =: eachCurrentCase.Id].Tasks.size()>0){
                    eachCurrentCase.addError(skipErrorMessage);               
                }    
            }
        }
    }


    //Physician Review Fields_Vaidations
    public static void PhysicianexpertValidate(List<Case> vListCase){
        for(Case eachCurrentCase : vListCase){
            String skipErrorMessage = 'Please update the Physician clinical Review.';
            Case oldCase = (Case)Trigger.oldMap.get(eachCurrentCase.Id);
            Id recordtypeAPOId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('APO').getRecordTypeId();
            Id recordtypeEARId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('EAR').getRecordTypeId();
            Id PhyRewRecTypeId = Schema.SObjectType.Physician_Review__c.getRecordTypeInfosByName().get('Clinical Review').getRecordTypeId();
            If(eachCurrentCase.RecordTypeId == recordtypeAPOId || eachCurrentCase.RecordTypeId == recordtypeEARId && eachCurrentCase.status != oldCase.status){
            if(eachCurrentCase.status=='QC2' && [select Id, Status,(select id, Name from  Physician_Reviews__r Where RecordTypeId =:PhyRewRecTypeId) from Case Where Id =:eachCurrentCase.Id].Physician_Reviews__r.size()==0){
                    //Case varActualCaseRecord2 = (Case)Trigger.newMap.get(vCase1.Id); 
                    eachCurrentCase.adderror(skipErrorMessage );
                }
                  
            }
        }
    }
   //QC2 Validations   
     public static void QC2validate(List<Case> vListCase){
        for(Case eachCurrentCase : vListCase){
            String skipErrorMessage = 'Please complete QC2 related task';
            Case oldCase = (Case)Trigger.oldMap.get(eachCurrentCase.Id);
            Id recordtypeAPOId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('APO').getRecordTypeId();
            Id recordtypeEARId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('EAR').getRecordTypeId();
            If(eachCurrentCase.RecordTypeId == recordtypeAPOId || eachCurrentCase.RecordTypeId == recordtypeEARId && eachCurrentCase.status != oldCase.status){
                If(eachCurrentCase.Status == 'AH MD Review' && [select Id, Status,(select id from Tasks Where status='Open'and Activity_Type__c='QC2') from Case Where Id =: eachCurrentCase.Id].Tasks.size()>0){
                    eachCurrentCase.addError(skipErrorMessage);               
                }    
            }
        }
    }
    
    //AH MD Review Validations    
     public static void AHMDReviewvalidate(List<Case> vListCase){
        /*for(Case eachCurrentCase : vListCase){
             String skipErrorMessage = 'Please complete AH MD review related task';
            Case oldCase = (Case)Trigger.oldMap.get(eachCurrentCase.Id);
            Id recordtypeAPOId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('APO').getRecordTypeId();
            Id recordtypeEARId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('EAR').getRecordTypeId();            
            If(eachCurrentCase.RecordTypeId == recordtypeAPOId || eachCurrentCase.RecordTypeId == recordtypeEARId && eachCurrentCase.status != oldCase.status){
                If(eachCurrentCase.Status == 'Report Sent' && [select Id, Status,(select id from Tasks Where status='Completed' and Activity_Type__c='MD Review') from Case Where Id =: eachCurrentCase.Id].Tasks.size()==0){
                    eachCurrentCase.addError(skipErrorMessage);               
                }   
            }
        }*/
    }

    //Peer consult Validations 
   public static void Peerconsultvalidate(List<Case> vListCase){
        for(Case eachCurrentCase : vListCase){         
            Case oldCase = (Case)Trigger.oldMap.get(eachCurrentCase.Id);
            Id recordtypeAPOId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('APO').getRecordTypeId();
            Id recordtypeEARId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('EAR').getRecordTypeId();            
            If((eachCurrentCase.RecordTypeId == recordtypeAPOId || eachCurrentCase.RecordTypeId == recordtypeEARId)&& eachCurrentCase.status != oldCase.status){
                If(eachCurrentCase.Status == 'Peer Consult'){                   
                   /* If(eachCurrentCase.Peer_Consult_Required__c=='Yes'){
                       eachCurrentCase.Status = 'QC3';
                    }*/
                    
                    If(eachCurrentCase.Peer_Consult_Required__c=='No'){
                        eachCurrentCase.Status = 'Closed';
                        eachCurrentCase.Sub_Status__c='Completed';
                        //Closedvalidation(vListCase);
                    }      
             }
        }
      }      
    } 
    
     //Peerconsult Validations   
     public static void Peerconsultvalidations(List<Case> vListCase){
        for(Case eachCurrentCase : vListCase){
            String skipErrorMessage = 'Please update the Physician P2P Review.';
            Case oldCase = (Case)Trigger.oldMap.get(eachCurrentCase.Id);
            Id recordtypeAPOId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('APO').getRecordTypeId();
            Id recordtypeEARId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('EAR').getRecordTypeId();
            Id PhyRewRecTypeId = Schema.SObjectType.Physician_Review__c.getRecordTypeInfosByName().get('P2P Review').getRecordTypeId();
            If(eachCurrentCase.RecordTypeId == recordtypeAPOId || eachCurrentCase.RecordTypeId == recordtypeEARId && eachCurrentCase.status != oldCase.status){
                If(eachCurrentCase.Status == 'QC3' && [select Id, Status,(select id, Name from  Physician_Reviews__r Where RecordTypeId =:PhyRewRecTypeId) from Case Where Id =:eachCurrentCase.Id].Physician_Reviews__r.size()==0){
                eachCurrentCase.addError(skipErrorMessage);               
                }    
            }
        }
    }

    //QC3 Validations
     public static void QC3validate(List<Case> vListCase){
        for(Case eachCurrentCase : vListCase){
            String skipErrorMessage = 'Please complete QC3 related task';
            Case oldCase = (Case)Trigger.oldMap.get(eachCurrentCase.Id);
            Id recordtypeAPOId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('APO').getRecordTypeId();
            Id recordtypeEARId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('EAR').getRecordTypeId();
            
            If(eachCurrentCase.RecordTypeId == recordtypeAPOId || eachCurrentCase.RecordTypeId == recordtypeEARId && eachCurrentCase.status != oldCase.status){
                If(eachCurrentCase.Status == 'Peer Consult Review Sent' && [select Id, Status,(select id from Tasks Where status='Open' and Activity_Type__c='QC3') from Case Where Id =: eachCurrentCase.Id].Tasks.size()>0){
                    eachCurrentCase.addError(skipErrorMessage);               
                }    
            }
        }
    }
    
    //Closed Validations    
     public static void Closedvalidation(List<Case> vListCase){
        for(Case eachCurrentCase : vListCase){
            String skipErrorMessage = 'Outcome must be completed in order to close case.';
            Case oldCase = (Case)Trigger.oldMap.get(eachCurrentCase.Id);
            Id recordtypeAPOId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('APO').getRecordTypeId();
            Id recordtypeEARId = Schema.SObjectType.Case.getRecordTypeInfosByName().get('EAR').getRecordTypeId();            
            If(eachCurrentCase.RecordTypeId == recordtypeAPOId || eachCurrentCase.RecordTypeId == recordtypeEARId && eachCurrentCase.status != oldCase.status){
               if(eachCurrentCase.Status=='Closed'){
                       eachCurrentCase.Sub_Status__c='Completed';
                    If(eachCurrentCase.Sub_Status__c =='Completed' &&  (eachCurrentCase.Humanistic_Outcomes__c==null || eachCurrentCase.Appropriate_Use_of_Healthcare__c==null || eachCurrentCase.Area_of_Cost_Savings__c==null || eachCurrentCase.Outcome_of_Review__c==null)){
                        eachCurrentCase.adderror(skipErrorMessage);
                    } 
               }
            }
        }
    }
}

Regards,
Isha
test class:

/**********************************************************************************************
@author         Satmetrix
@date           20 Jan,2012
@description:   Test Class for SMXProcessCaseFaasATIBatch

Revision(s):
ToDo(s):        Usage of Asserts for functional coverage

VR,    
**********************************************************************************************/
@isTest
public class SMXProcessCaseFaasATIBatchTest {
    public static testMethod void testBatch() {
        //Create Test Account
        Map<String, Object>  accMap = new Map<String, Object> {
        };
        List<Account> lstAcc = (List<Account>) ShGl_TestFactory.createSObjectList(new Account(),3,accMap);
        insert lstAcc;
        //Create test contact and associate to Account
        Map<String, Object>  conMap = new Map<String, Object> {
        };
        List<Contact> conL = (List<Contact>) ShGl_TestFactory.createSObjectList(new Contact(),3,conMap);
        insert conL;
        for(integer i=0; i<conL.Size(); i++){
            conL[i].AccountId = lstAcc[i].Id;
        }
        Update conL;
        //Create test Case and associate to Contact
        Map<String, Object> caseMap = new Map<String, Object> {
            'RecordTypeId' => Schema.SObjectType.Case.getRecordTypeInfosByName().get('FaaS Compromise Report').getRecordTypeId()
        };
        List<Case> csL = (List<Case>) ShGl_TestFactory.createSObjectList(new Case(),3,caseMap);
        insert csL;
        for(integer i=0; i<conL.Size(); i++){
            csL[i].AccountId = lstAcc[i].Id;
            if(i==0){
                csL[i].Managed_Defense__c = 'CP';
            }else{
                csL[i].Managed_Defense__c = 'CM';
                csL[i].Status = 'Closed';
            }   
        }
        Update csL;
        //Create test for Custom Object(OCM_Agent__c) 
        List<OCM_Agent__c> ssConLst = new List<OCM_Agent__c>();
        for(integer i=0; i<conL.Size(); i++){
            OCM_Agent__c sscon = new OCM_Agent__c(Contact__c = conL[i].Id, CM_Threat_Contact__c = 'Primary');
            ssConLst.add(sscon);    
        }
        insert ssConLst;
        //Create test for Custom Object(Feedback__c)
        List<Feedback__c> fbkLst= new List<Feedback__c>();
        Integer i=2;
        Feedback__c fbk = new Feedback__c(Contact__c = conL[i].Id, Case__c= csL[i].id, Name = 'Test_Name', DataCollectionId__c = 'Test_SurveyId', DataCollectionName__c = 'Test_SurveyName',Status__c='Response Received');
        fbkLst.add(fbk ); 
        insert fbkLst;
        
        
        System.debug('ssConLst'+ssConLst);
        test.startTest(); 
        Database.executeBatch(new SMXProcessCaseFaasATIBatch(),50);
        test.stopTest();
    }
}

Apex class:

  //Determine Survey Name and Survey Id based on Managed Defence
            if(strManagedDefence.equalsignorecase('CP') || strManagedDefence.equalsignorecase('CV') || strManagedDefence.equalsignorecase('MD13')){
                strSurveyName = 'FaaS Compromise Survey';
                strSurveyId = 'FIREEYE_128387';
            }
            /*else if(strManagedDefence.equalsignorecase('ATI+') || strManagedDefence.equalsignorecase('CM')){
                strSurveyName = 'ATI+ Feedback Survey';
                strSurveyId = 'FIREEYE_132678';
            }
            */  
            
            //Retrieve the List of Contacts associated with the Account
            List<ID> lstContactIDs = mapAccountToContactList.get(csRecord.idAccountID);
            if(lstContactIDs!=null){
                for(ID idContact : lstContactIDs ){
                    Map<ID,ID> mapContactToFeedback = mapCaseToContactToFeedback.get(csRecord.idCaseID);
                    //lgSeed = lgSeed++;
                    System.Debug('lgSeed ==> '+lgSeed);
                    System.Debug('idContact==> '+idContact);
                    System.Debug('csRecord.idCaseID==> '+csRecord.idCaseID);
                    if(mapContactToFeedback == null || mapContactToFeedback.isEmpty()){ 
                          //Prepare Survey Record   
                          lgSeed = lgSeed+1;
                          Feedback__c feedback = new Feedback__c();  
                          feedback.Name = 'P_' + lgSeed;
                          feedback.Contact__c = idContact ; //ContactId to which survey have to be sent out
                          feedback.Case__c = csRecord.idCaseID; // CaseId processed
                          feedback.DataCollectionId__c = strSurveyId;
                          feedback.Status__c = 'Nominated';               
                          feedback.DataCollectionName__c = strSurveyName;
                          lstFeedback.add(feedback);
                    }else{
                        ID idFeedback = mapContactToFeedback.get(idContact);
                        if(idFeedback == null){
                            //Prepare Survey Record
                            lgSeed = lgSeed+1;
                            Feedback__c feedback = new Feedback__c();  
                            feedback.Name = 'P_' + lgSeed;
                            feedback.Contact__c = idContact; //ContactId to which survey have to be sent out
                            feedback.Case__c = csRecord.idCaseId; // CaseId processed
                            feedback.DataCollectionId__c = strSurveyId;
                            feedback.Status__c = 'Nominated';               
                            feedback.DataCollectionName__c = strSurveyName;
                            lstFeedback.add(feedback);  
                        }
                    }
                } // End of loop processing through list of valid contacts           
            }  
        } //End of loop processing through list of valid cases 
        insert lstFeedback; //

Error:

System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [DataCollectionId__c, DataCollectionName__c]: [DataCollectionId__c, DataCollectionName__c]

I already provided the values but still getting errors.

Please fix this error.


Regards,
 Isha
Hi Team,

I have below test class. and iam getting below error while excetuing this testclass.
Iam attaching here the error message . pls help me tofis this issue.
@isTest
// Test Class to execute SMXNominationProcessor Class
global class SMXNominationProcessorTest{
    public static void setTestResponseValues(Integer testCaseNum){
        if(testCaseNum == 1){
            SMXNominationProcessor.testHttpStatusCode = 200;
            SMXNominationProcessor.testHttpResponseXML = '<webserviceresponse><code>0</code><description></description><row value="success"></row></webserviceresponse>';
        }else if(testCaseNum  == 2){
            SMXNominationProcessor.testHttpStatusCode = 200;
            SMXNominationProcessor.testHttpResponseXML = '<webserviceresponse><code>0</code><description></description><row value="No Send Rule is applied for the provider"></row></webserviceresponse>';        
        }else if(testCaseNum  == 3){
            SMXNominationProcessor.testHttpStatusCode = 200;
            SMXNominationProcessor.testHttpResponseXML = '<webserviceresponse><code>-1</code><description></description><row value=""></row></webserviceresponse>';        
        }else if(testCaseNum  == 4){
            SMXNominationProcessor.testHttpStatusCode = 404;
            SMXNominationProcessor.testHttpResponseXML = '<webserviceresponse><code>-1</code><description></description><row value=""></row></webserviceresponse>';        
        }      
    }
 
@isTest
   static void testFeedbackUpdate(){   
       String strFeedbackID = prepareTestData();
       for(Integer i = 1; i<=4; i++){
           SMXNominationProcessorTest.setTestResponseValues(i);
           SMXNominationProcessor.processNomination(strFeedbackID);
       }
   }
     
    static String prepareTestData(){
        //Insert account data using ShGl_TestFactory
        Map<String, Object>  accMap = new Map<String, Object> {
        };
        Account acc = (Account) ShGl_TestFactory.createSObject(new Account(),accMap);
        insert acc;
        //Check for account creation
        system.assertNotEquals(null, acc.Id);
        system.assertNotEquals('', acc.Id);
        //Insert contact data using ShGl_TestFactory       
        Map<String, Object>  conMap = new Map<String, Object> {
            'AccountId' => acc.Id
        };
        Contact con = (Contact) ShGl_TestFactory.createSObject(new Contact(),conMap);
       insert con;
        //Check for Contact creation and associated with account
        system.assertNotEquals(null, con.Id);
        system.assertNotEquals('', con.Id);
        system.assertEquals(acc.Id, con.AccountId);
        //Insert case data using ShGl_TestFactory
        Map<String, Object>  csMap = new Map<String, Object> {
            'ContactId' => con.Id
        };
        Case cs = (Case) ShGl_TestFactory.createSObject(new Case(),csMap);
        insert cs;
        //Check for Case creation and associated with contact
        system.assertNotEquals(null, cs.Id);
        system.assertNotEquals('', cs.Id);
        system.assertEquals(con.Id, cs.ContactId);
        //Insert custom object feedback__c
        Feedback__c fbk = new Feedback__c(Name = 'TEST_CRM_12345', Contact__c = con.Id, DataCollectionId__c = '123456', Status__c = 'Test_Nominated', DataCollectionName__c = 'Test Survey Name', PrimaryScore__c = 9, PrimaryComment__c = 'Test comment', StatusDescription__c = 'Test Description', Case__c = cs.Id);
        insert fbk;
        //Check for Survey record Creation with Name, SurveyID, SurveyName and Staus not BLANK
        system.assertNotEquals(null, fbk.Id);
        system.assertNotEquals('', fbk.Id);
        system.assertEquals(con.Id, fbk.Contact__c);
        system.assertNotEquals('', fbk.Name);
        system.assertNotEquals(null, fbk.Name);
        system.assertNotEquals('', fbk.DataCollectionId__c);
        system.assertNotEquals(null, fbk.DataCollectionId__c);
        system.assertNotEquals('', fbk.DataCollectionName__c);
        system.assertNotEquals(null, fbk.DataCollectionName__c);
        system.assertNotEquals('', fbk.Status__c);
        system.assertNotEquals(null, fbk.Status__c);
        return fbk.Name;
    }  
}

User-added image

Regards,
ISHA
Iam having a query in Account 'SELECT Id,Name,outcome FROM Account WHERE Name LIKE 'Unable to Support%'' and this one we converted into process builder formula as 

NOT(CONTAINS(LOWER(TEXT([Case].Sub_Category__c), 'remove from field notices')))

Iam facing below error.

ERROR:
The formula expression is invalid: Incorrect number of parameters for function 'CONTAINS()'. Expected 2, received 1

Pls help me to fix this.

Regards,
ISHA



.
 
Hi Team,

Iam having a query in Account 'SELECT Id,Name FROM Account WHERE Name LIKE 'Fireeye%'' and this one we converted into process builder formula as 

AND(
NOT(ISBLANK([Case].AccountId )),
NOT(BEGINS([Case].Account.Name, "FireEye"))

another condtion is 
NOT(CONTAINS([Case].Contact.Email, 'FireEye')

But i want to ignore case in my process builder formula as it is validating only 'FireEye' records but i want to validate irrespective of lower/upper/mixed . I want my formula work as Like funtion in Query.


This is urgent change pls help.

Regards,
ISHA
Hi ,

Case trigger handler class:

// Batch Class conversion handler    
        if(checkRecursive.opptyLineItemInsertRunOnce()){
            for(case c: (List<Case>)Trigger.new){
                Case oldCase = (Case)Trigger.oldMap.get(c.Id);
                Boolean oldCaseStatus = oldCase.Status.equals('Closed');
                Boolean newCaseStatus = c.Status.equals('Closed');
                if (oldCaseStatus!=newCaseStatus && c.AccountId!=null && c.ContactId!=null) {
SMXProcessCaseFaasATIHandler smxHandler= new SMXProcessCaseFaasATIHandler();
                    smxHandler.convertBatchToTrigger(trigger.new); 
                }
               }

SMXProcessCaseFaasATIHandler my handler class having logic of after update.
My test class is on after update oncase which is not firing .My method is"convertBatchToTrigger".

My test class:
@isTest
public class CaseTriggerHandlerBatchclassTest{
    public static testMethod void testcreatefeedbacksurvey(){
    
    Account acc = new Account(
            Name='testAcc'
        );
    
    insert acc;
    
    Contact con = new Contact(
            firstname='test',Lastname='Con',
            Email='test@gmail.com',
            AccountId=acc.Id,Not_Active_Contact__c=false,HasOptedOutOfEmail=false
        );
    
    insert con;
    
    
    RecordType red= [SELECT Id FROM RecordType WHERE Name ='FaaS Compromise Report' AND SObjectType = 'Case'];
        Case cse = new Case(
            AccountId=acc.Id,ContactId=con.Id,
            RecordTypeId = red.Id,Status='New',Origin = 'Phone'

        );
        Insert cse;
       
        
          OCM_Agent__c ocm= new OCM_Agent__c(CM_Threat_Contact__c= 'Primary',Contact__c=con.Id);
          Insert ocm;
        
        NPX_Survey_record__c npxsurvey= New NPX_Survey_record__c();
         npxsurvey.Contact__c = cse.ContactId ;
                         npxsurvey.Account__c =acc.id;
                         npxsurvey.Case__c = cse.id; 
                        // npxsurvey.Survey_Id__c = strSurveyId;
                         npxsurvey.Status__c = 'Nominated'; 
                         npxsurvey.Survey_name__c= 'FaaS Compromise Survey';
                         npxsurvey.Person_identifier__c=con.Email;
                         npxsurvey.First_Name__c=con.FirstName;
                         npxsurvey.Last_Name__c=con.LastName;
                         npxsurvey.Email__c=con.Email;
                         npxsurvey.Company_Name__c=acc.Name;
                         npxsurvey.Company_ID__c=acc.Id;
                         npxsurvey.Case_Record_Type__c=cse.RecordTypeId;
                         npxsurvey.Locale_Code__c='test';
                         npxsurvey.Contact__c=con.id;
                         Insert npxsurvey;
                         
         cse.Managed_Defense__c='CV';                       
         cse.Status= 'Closed';
         update cse;
  }
 
 }

Which is not working.

Pls help me on this testclass
 
Hi Team,

I have a process builder where iam creating a record on cutom_object__c and iam mapping a checkbox[Top x Account] which is populating from contact.Account fields

Iam doing a negative testing by removing Account value on contact. So, My proccess builder is failing and getting below error. 

Error:

Can’t Save Record
We can't save this record because the “VOC Create Campaign Nominated Survey Records” process failed. Give your Salesforce admin these details. This error occurred when the flow tried to create records: INVALID_TYPE_ON_FIELD_IN_RECORD: Top X Account: value not of required type: . You can look up ExceptionCode values in the SOAP API Developer Guide. Error ID: 448042294-2763196 (-1395494820)

Click here to return to the previous page.


Can you please help me how to fix this issue.
Note: on Account and Custom_object__c the fields are checkbox


User-added imageRegards,
ISHA
Hi,

At present, we are manually adding campaign members[Contats] to a campaign to avaoid that, we are looking for a automation on this.

Based on certain conditions on Contact, we need to add to a campaign. 
Can you please help me on this requirement with clear implementation.


Regards,
ISHA
Hi ,

We have a processbilder and on Action i selcted update records and selected the campaign object .
I have a custom field called 'Send call' picklist field but iam not able to see that field coming in process builder.

I checked FLS . This field has given acess to all the profiles as edit.

User-added image
Hi Team,

I ahve a below process builder. When ever iam trying to fire process builder iam geeting below error . Please help me how to fix this issue.


AND(
ISPICKVAL([Case].Status , "Closed"),
NOT(ISPICKVAL([Case].Origin , "Satmetrix")),
ISCHANGED([Case].Status) , 
NOT(ISBLANK([Case].ContactID)),
[Case].RecordType.Name =  'Intel Request',
OR(
ISPICKVAL([Case].GiCa_Intel_Request_Subtype__c, "Threat"),
ISPICKVAL([Case].GiCa_Intel_Request_Subtype__c, "Technical")
),
AND(
NOT(ISBLANK([Case].Contact.Account.Name )),
NOT(ISNULL([Case].Contact.AccountId ))
),
NOT(BEGINS([Case].Account.Name, "FireEye")),
NOT(CONTAINS([Case].Contact.Email, '@mandiant.com')),
NOT(CONTAINS([Case].Contact.Email, 'FireEye')),
NOT(CONTAINS(TEXT([Case].Gica_OutCome__c) , 'Unable to Support') )
)


flow error:

Error element myDecision4 (FlowDecision).
The flow failed to access the value for myVariable_current.Account.Id because it hasn't been set or assigned.

Flow Details
Flow API Name: NPX_Case_Closure_Nomination
Type: Record Change Process
Version: 22
Status: Active
Org: FireEye Inc. (00D22000000DBIr)

Flow Interview Details
Interview Label: NPX_Case_Closure_Nomination-22_InterviewLabel
Current User: Nice User (00522000001NTRM)
Start time: 8/27/2019 1:03 AM
Duration: 0 seconds

How the Interview Started
Nice User (00522000001NTRM) started the flow interview.
Some of this flow's variables were set when the interview started.
myVariable_old = Case (500220000035BNpAAM)
myVariable_current = Case (500220000035BNpAAM)

DECISION: myDecision
Skipped this outcome because its conditions weren't met: myRule_1
Outcome conditions:
{!formula_myRule_1} (false) Equals true

Default outcome executed.

Salesforce Error ID: 1861759023-21181 (-1729454283)
Error element myDecision4 (FlowDecision).
The flow failed to access the value for myVariable_current.Account.Id because it hasn't been set or assigned.

Flow Details
Flow API Name: NPX_Case_Closure_Nomination
Type: Record Change Process
Version: 22
Status: Active
Org: FireEye Inc. (00D22000000DBIr)

Flow Interview Details
Interview Label: NPX_Case_Closure_Nomination-22_InterviewLabel
Current User: Nice User (00522000001NTRM)
Start time: 8/27/2019 1:03 AM
Duration: 0 seconds

How the Interview Started
Nice User (00522000001NTRM) started the flow interview.
Some of this flow's variables were set when the interview started.
myVariable_old = Case (500220000035BNpAAM)
myVariable_current = Case (500220000035BNpAAM)

DECISION: myDecision
Skipped this outcome because its conditions weren't met: myRule_1
Outcome conditions:
{!formula_myRule_1} (false) Equals true

Default outcome executed.

Salesforce Error ID: 1861759023-21181 (-1729454283)



Regards,
Isha
Hi Team,

I need help on testclass for below lightning componnet apex class.
Can anyone help me on this .


public class LightningTabComponentController {
/* Method to fetch the parameters used for framing the URL*/ 
    
   @AuraEnabled
    public static OpptyRelatedData getCustomsettingValue()
    {
       OpptyRelatedData returnrelateddata = new  OpptyRelatedData ();
        
       string cusseturl= SMX_URL__c.getInstance().SMX_URL__c;
       returnrelateddata.SMX = cusseturl;
        
       string cusseturl1 = SFDC_URL__c.getInstance().SFDC_URL__c;
       returnrelateddata.SFDCURL = cusseturl1;
        
       String username = UserInfo.getUsername();
       returnrelateddata.username=username;
        
       String sessionId = UserInfo.getsessionId();
       returnrelateddata.sessionId=sessionId;
        
        
       String npxaccview = SFDC_URL__c.getInstance().NPX_Account_View_Embed__c;
       returnrelateddata.npxaccview=npxaccview;
        
        String npxconview = SFDC_URL__c.getInstance().NPX_Contact_View_Embed__c;
       returnrelateddata.npxconview=npxconview;
        
         string urler = URL.getSalesforceBaseUrl().toExternalForm();
        returnrelateddata.urler=urler;
           
       system.debug('returnrelateddatareturn======>'+returnrelateddata); 
       return returnrelateddata;
    }
    
    public class OpptyRelatedData{
        @AuraEnabled 
        Public string SMX{get;set;}
        @auraEnabled
        public string SFDCURL{get;set;}
        @auraEnabled
        public string username{get;set;}
        @auraEnabled
        public string sessionId{get;set;}
        @auraEnabled
        public string npxaccview{get;set;}
        @auraEnabled
        public string npxconview{get;set;}
        @auraEnabled
        public string urler{get;set;}
        
        
    } 
    
}


Regards,
Isha
Hi Everyone.

I need topass the Current Account id in the URL . The problem here is when iam passing accId  into the URL Outside brases Value is coming but not inside brases.Pleas efind screenshot for reference.


<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:hasSObjectName,force:lightningQuickAction,forceCommunity:availableForAllPageTypes" controller="LightningTabComponentController" access="global">
   
    <aura:attribute name="recordId" type="Id"/>
</aura:component>

js controller:

var accId = component.get("v.recordId");
                        alert(accId);
                        
                        var embedChartUrl='/main/embed?'+embeddedLink+'&urlParams={"INTEGRATION_COMPANY_CODE":"{accId}"}'+accId;
                        alert(embedChartUrl);


Canyou please someone help me how to get accId in {"INTEGRATION_COMPANY_CODE":"{accId}"}'  here in between bases value.



User-added image


Regards,
Isha
Helo Everyone,

I have to convert below vf page to Lightning component. 
SMX_URL__c and SFDC_URL__c is custom settings. Can you please help me on creating the Lightning component. 

Iam new to Lightning component. Please help me on this.


<apex:page sidebar="false">
 <apex:iframe id="NPXDashboardFrame" height="600px" scrolling="true"/>
  
  <!-- <iframe  id="NPXDashboardFrame" style="overflow: auto!important; -webkit-overflow-scrolling: touch!important;position:absolute; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%;"/>-->
  
  
       <script type="text/javascript">
    var enterpriseIdfier = 'TEST';//this need to change as per enterprise

    var smxServer = '{!$Setup.SMX_URL__c.SMX_URL__c}'; 
    var varSessionID = '{!$Api.Session_ID}';
     alert(varSessionID);
  var Server ='{!$Setup.SFDC_URL__c.SFDC_URL__c}';
  //var Server ='{!$Api.Partner_Server_URL_330}';
    var varOwner = '{!$User.Id}';
    var varUsername = '{!$User.Username}';
    var embedChartUrl='/main/WebUI.html';
    var url = smxServer + '/app/core/j_satmetrix_security_check?session='+ varSessionID + '&server="'+Server+'"&owner='+varOwner+'&username='+varUsername+'&version=3&enterpriseIdfier='+enterpriseIdfier+'&requestTokenType=SALES_FORCE&requestToken=NONE&targetUrl='+embedChartUrl;
    
    alert(url);
  
    
     document.getElementById('NPXDashboardFrame').src = url;
   
    </script>
</apex:page>

Regards,
Isha
Hi,

I have below vf page where iam calling the values from Custom setting directly.

My requirement is to implement Lightning component i staed of the above page. As Iam new to lightning Can some one help me on creating of lightning component.
Custom setting:SFDC_URL__C
                       SMX_URL__C



VF page:

<apex:page lightningStylesheets="true" showHeader="false">
    <apex:iframe id="NPXDashboardFrame" height="1000px" scrolling="true"/>
   <!-- <iframe  id="NPXDashboardFrame" style="overflow: auto!important; -webkit-overflow-scrolling: touch!important;position:absolute; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%;"/>-->


 <script type="text/javascript">
    var enterpriseIdfier = 'RASMITHA';//this need to change as per enterprise

    var smxServer = '{!$Setup.SMX_URL__c.SMX_URL__c}'; 
    var varSessionID = '{!$Api.Session_ID}';
     alert(varSessionID);
  var Server ='{!$Setup.SFDC_URL__c.SFDC_URL__c}';
  //var Server ='{!$Api.Partner_Server_URL_90}';
    var varOwner = '{!$User.Id}';
    var varUsername = '{!$User.Username}';
    var embedChartUrl='/main/WebUI.html';
    var url = smxServer + '/app/core/j_satmetrix_security_check?session='+ varSessionID + '&server="'+Server+'"&owner='+varOwner+'&username='+varUsername+'&version=3&enterpriseIdfier='+enterpriseIdfier+'&requestTokenType=SALES_FORCE&requestToken=NONE&targetUrl='+embedChartUrl;
      
   
    </script>
</apex:page>


Regards,
Isha
Hi I have Below Vf page and i created a VF tab with URL . The URL is loading in Classic and lightning but not in mobile. I am suspecting the problem with the targetURL parameter which iam passing. Can you please help me solve this.

I tried with some other vfpage passing Accountid it is loading properly. 

Vfpage:



<apex:page lightningStylesheets="true" showHeader="false">
    <apex:iframe id="NPXDashboardFrame" height="1000px" scrolling="true"/>
   <!-- <iframe  id="NPXDashboardFrame" style="overflow: auto!important; -webkit-overflow-scrolling: touch!important;position:absolute; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%;"/>-->


 <script type="text/javascript">
    var enterpriseIdfier = 'ISHA';//this need to change as per enterprise

    var smxServer = '{!$Setup.SMX_URL__c.SMX_URL__c}'; 
    var varSessionID = '{!$Api.Session_ID}';
     alert(varSessionID);
  var Server ='{!$Setup.SFDC_URL__c.SFDC_URL__c}';
  //var Server ='{!$Api.Partner_Server_URL_90}';
    var varOwner = '{!$User.Id}';
    var varUsername = '{!$User.Username}';
    var embedChartUrl='/main/WebUI.html';
    var url = smxServer + '/app/core/j_satmetrix_security_check?session='+ varSessionID + '&server="'+Server+'"&owner='+varOwner+'&username='+varUsername+'&version=3&enterpriseIdfier='+enterpriseIdfier+'&requestTokenType=SALES_FORCE&requestToken=NONE&targetUrl='+embedChartUrl;
    
    alert(url);
    document.getElementById('NPXDashboardFrame').src = url;
    
       
   
    </script>
</apex:page>
User-added image

Can comeone help me on this.


Regards,
Isha
Hi team,

I have a vfpage design which holds the logic of based on the case status change new fields should be displayed and once value will be given and click on save values will be saved and fields should be non edit mode and should hike the save button as well


vfpage:

<apex:page standardController="Case" extensions="caseextension">
    
    <apex:form id="theForm">
        
        <apex:pageBlock mode="inlineEdit">
            <apex:pageblockSection >
                <apex:outputField value="{!Case.Status}">
                    <apex:actionSupport event="onchange" reRender="theForm"/>
                </apex:outputField>
            </apex:pageblockSection>
        </apex:pageBlock>
        
        <apex:pageblock mode="inlineEdit">
       
            <apex:pageblockSection rendered="{!IF(Case.Status = 'Working' && rend,TRUE,FALSE)}">
                <apex:inputField value="{!Case.Working_1__c}"/>
                <apex:inputField value="{!Case.Working_2__c}"/>
            </apex:pageblockSection>
            
            <apex:pageblockSection rendered="{!Case.Status = 'Escalated' && rend}">
                <apex:inputField value="{!Case.NewText1__c}"/>
                <apex:inputField value="{!Case.New_Text2__c}"/>
           
            </apex:pageblockSection>
            
            <apex:pageblockSection rendered="{!Case.Status = 'Working' && rend1}">
                <apex:outputField value="{!Case.Working_1__c}"/>
                <apex:outputField value="{!Case.Working_2__c}"/>
            </apex:pageblockSection>
            
            <apex:pageblockbuttons>
                 <apex:commandButton value="Save" action="{!save}"/>
                 
            </apex:pageblockbuttons>
            
        </apex:pageblock>
    </apex:form>
</apex:page>


Class:

public class caseextension {

    private final Case caseObj;
    public boolean rend{get;set;}
    public boolean rend1{get;set;}

    // get Case record from the standard controller and putting it in a member variable
    public caseextension (ApexPages.StandardController stdController) {
        this.caseObj = (Case)stdController.getRecord();
        rend=true;
        rend1=false;
    }

    public  PageReference save(){
        // TO DO
        rend=false;
        rend1=true;
        
        insert caseObj;
           
        
        
     return null;

    }

}

Iam getting below error User-added image
Regards,
Isha
Hi ,


I need clarification on difference between login via Oauth/login via Password Authentication.


With out Uername/Password can we login to data loader [Using accesstoiken]?
 Apart from securitytoken is there any difference between Oauth/Password Authentication.


Can someone explain me little bit clealry.



Regards,
Isha
Hi Team,

I have a Req that on cas estandard page based on the status value need to display the different fieds.

Status='Working'--> Text1 Text 2 fields should display.
Status='Escalate'--> Text3 Text4 fields should display.

On save of this values it should be saved on the case . Please suggest me how can acheive this.

My Current page:

<apex:pageBlock >
<apex:pageblockSection >
  <apex:inputfield value="{!Case.Status}">
    <apex:actionSupport event="onchange" reRender="theForm" />
</apex:inputField>

  <apex:inputField value="{!Case.NewText1__c}" rendered="{!IF(Case.Status == 'Escalated',true,false)}"/>
  <apex:inputField value="{!Case.New_Text2__c}" rendered="{!IF(Case.Status == 'Escalated',true,false)}" />
  
  <apex:inputField value="{!Case.Working_1__c}" rendered="{!IF(Case.Status == 'Working',true,false)}" />
  <apex:inputField value="{!Case.Working_2__c}" rendered="{!IF(Case.Status == 'Working',true,false)}" />
  
   </apex:pageblockSection>
<apex:pageblockbuttons >
<apex:commandButton value="save" action="{!save}"/>

</apex:pageblockbuttons>
</apex:pageBlock>
</apex:form>

</apex:page>


Please help me on save and any changes on the code.


Regards,
Isha 

 
Hi I have a requirement that , ihava a object called survey record and field called folowupowner lookup to Survey record
My req is when ever sttaus on survey record is nominated we ahve to send the email to followup owner.

Condition: If there are multiple records with same followupowner email should send once.

I thoughtit can be done via flows and can be used in process buildr. But iam new to flow and not understand what can be done. If some one help me on this it will be very helpful.


Regards,
Isha
Hello Everyone,

I have a webtab called "Custom dashboards". But that i can not find it out in mobile[salesforce 1] app. How we can see the tabs in mobile view.


Can any one help me on this.


Regards,
Isha
Hi Team,

Iam having a query in Account 'SELECT Id,Name FROM Account WHERE Name LIKE 'Fireeye%'' and this one we converted into process builder formula as 

AND(
NOT(ISBLANK([Case].AccountId )),
NOT(BEGINS([Case].Account.Name, "FireEye"))

another condtion is 
NOT(CONTAINS([Case].Contact.Email, 'FireEye')

But i want to ignore case in my process builder formula as it is validating only 'FireEye' records but i want to validate irrespective of lower/upper/mixed . I want my formula work as Like funtion in Query.


This is urgent change pls help.

Regards,
ISHA
Hi Team,

I ahve a below process builder. When ever iam trying to fire process builder iam geeting below error . Please help me how to fix this issue.


AND(
ISPICKVAL([Case].Status , "Closed"),
NOT(ISPICKVAL([Case].Origin , "Satmetrix")),
ISCHANGED([Case].Status) , 
NOT(ISBLANK([Case].ContactID)),
[Case].RecordType.Name =  'Intel Request',
OR(
ISPICKVAL([Case].GiCa_Intel_Request_Subtype__c, "Threat"),
ISPICKVAL([Case].GiCa_Intel_Request_Subtype__c, "Technical")
),
AND(
NOT(ISBLANK([Case].Contact.Account.Name )),
NOT(ISNULL([Case].Contact.AccountId ))
),
NOT(BEGINS([Case].Account.Name, "FireEye")),
NOT(CONTAINS([Case].Contact.Email, '@mandiant.com')),
NOT(CONTAINS([Case].Contact.Email, 'FireEye')),
NOT(CONTAINS(TEXT([Case].Gica_OutCome__c) , 'Unable to Support') )
)


flow error:

Error element myDecision4 (FlowDecision).
The flow failed to access the value for myVariable_current.Account.Id because it hasn't been set or assigned.

Flow Details
Flow API Name: NPX_Case_Closure_Nomination
Type: Record Change Process
Version: 22
Status: Active
Org: FireEye Inc. (00D22000000DBIr)

Flow Interview Details
Interview Label: NPX_Case_Closure_Nomination-22_InterviewLabel
Current User: Nice User (00522000001NTRM)
Start time: 8/27/2019 1:03 AM
Duration: 0 seconds

How the Interview Started
Nice User (00522000001NTRM) started the flow interview.
Some of this flow's variables were set when the interview started.
myVariable_old = Case (500220000035BNpAAM)
myVariable_current = Case (500220000035BNpAAM)

DECISION: myDecision
Skipped this outcome because its conditions weren't met: myRule_1
Outcome conditions:
{!formula_myRule_1} (false) Equals true

Default outcome executed.

Salesforce Error ID: 1861759023-21181 (-1729454283)
Error element myDecision4 (FlowDecision).
The flow failed to access the value for myVariable_current.Account.Id because it hasn't been set or assigned.

Flow Details
Flow API Name: NPX_Case_Closure_Nomination
Type: Record Change Process
Version: 22
Status: Active
Org: FireEye Inc. (00D22000000DBIr)

Flow Interview Details
Interview Label: NPX_Case_Closure_Nomination-22_InterviewLabel
Current User: Nice User (00522000001NTRM)
Start time: 8/27/2019 1:03 AM
Duration: 0 seconds

How the Interview Started
Nice User (00522000001NTRM) started the flow interview.
Some of this flow's variables were set when the interview started.
myVariable_old = Case (500220000035BNpAAM)
myVariable_current = Case (500220000035BNpAAM)

DECISION: myDecision
Skipped this outcome because its conditions weren't met: myRule_1
Outcome conditions:
{!formula_myRule_1} (false) Equals true

Default outcome executed.

Salesforce Error ID: 1861759023-21181 (-1729454283)



Regards,
Isha
Hi I have Below Vf page and i created a VF tab with URL . The URL is loading in Classic and lightning but not in mobile. I am suspecting the problem with the targetURL parameter which iam passing. Can you please help me solve this.

I tried with some other vfpage passing Accountid it is loading properly. 

Vfpage:



<apex:page lightningStylesheets="true" showHeader="false">
    <apex:iframe id="NPXDashboardFrame" height="1000px" scrolling="true"/>
   <!-- <iframe  id="NPXDashboardFrame" style="overflow: auto!important; -webkit-overflow-scrolling: touch!important;position:absolute; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%;"/>-->


 <script type="text/javascript">
    var enterpriseIdfier = 'ISHA';//this need to change as per enterprise

    var smxServer = '{!$Setup.SMX_URL__c.SMX_URL__c}'; 
    var varSessionID = '{!$Api.Session_ID}';
     alert(varSessionID);
  var Server ='{!$Setup.SFDC_URL__c.SFDC_URL__c}';
  //var Server ='{!$Api.Partner_Server_URL_90}';
    var varOwner = '{!$User.Id}';
    var varUsername = '{!$User.Username}';
    var embedChartUrl='/main/WebUI.html';
    var url = smxServer + '/app/core/j_satmetrix_security_check?session='+ varSessionID + '&server="'+Server+'"&owner='+varOwner+'&username='+varUsername+'&version=3&enterpriseIdfier='+enterpriseIdfier+'&requestTokenType=SALES_FORCE&requestToken=NONE&targetUrl='+embedChartUrl;
    
    alert(url);
    document.getElementById('NPXDashboardFrame').src = url;
    
       
   
    </script>
</apex:page>
User-added image

Can comeone help me on this.


Regards,
Isha
Hi team,

I have a vfpage design which holds the logic of based on the case status change new fields should be displayed and once value will be given and click on save values will be saved and fields should be non edit mode and should hike the save button as well


vfpage:

<apex:page standardController="Case" extensions="caseextension">
    
    <apex:form id="theForm">
        
        <apex:pageBlock mode="inlineEdit">
            <apex:pageblockSection >
                <apex:outputField value="{!Case.Status}">
                    <apex:actionSupport event="onchange" reRender="theForm"/>
                </apex:outputField>
            </apex:pageblockSection>
        </apex:pageBlock>
        
        <apex:pageblock mode="inlineEdit">
       
            <apex:pageblockSection rendered="{!IF(Case.Status = 'Working' && rend,TRUE,FALSE)}">
                <apex:inputField value="{!Case.Working_1__c}"/>
                <apex:inputField value="{!Case.Working_2__c}"/>
            </apex:pageblockSection>
            
            <apex:pageblockSection rendered="{!Case.Status = 'Escalated' && rend}">
                <apex:inputField value="{!Case.NewText1__c}"/>
                <apex:inputField value="{!Case.New_Text2__c}"/>
           
            </apex:pageblockSection>
            
            <apex:pageblockSection rendered="{!Case.Status = 'Working' && rend1}">
                <apex:outputField value="{!Case.Working_1__c}"/>
                <apex:outputField value="{!Case.Working_2__c}"/>
            </apex:pageblockSection>
            
            <apex:pageblockbuttons>
                 <apex:commandButton value="Save" action="{!save}"/>
                 
            </apex:pageblockbuttons>
            
        </apex:pageblock>
    </apex:form>
</apex:page>


Class:

public class caseextension {

    private final Case caseObj;
    public boolean rend{get;set;}
    public boolean rend1{get;set;}

    // get Case record from the standard controller and putting it in a member variable
    public caseextension (ApexPages.StandardController stdController) {
        this.caseObj = (Case)stdController.getRecord();
        rend=true;
        rend1=false;
    }

    public  PageReference save(){
        // TO DO
        rend=false;
        rend1=true;
        
        insert caseObj;
           
        
        
     return null;

    }

}

Iam getting below error User-added image
Regards,
Isha
Hi Team,

I have a Req that on cas estandard page based on the status value need to display the different fieds.

Status='Working'--> Text1 Text 2 fields should display.
Status='Escalate'--> Text3 Text4 fields should display.

On save of this values it should be saved on the case . Please suggest me how can acheive this.

My Current page:

<apex:pageBlock >
<apex:pageblockSection >
  <apex:inputfield value="{!Case.Status}">
    <apex:actionSupport event="onchange" reRender="theForm" />
</apex:inputField>

  <apex:inputField value="{!Case.NewText1__c}" rendered="{!IF(Case.Status == 'Escalated',true,false)}"/>
  <apex:inputField value="{!Case.New_Text2__c}" rendered="{!IF(Case.Status == 'Escalated',true,false)}" />
  
  <apex:inputField value="{!Case.Working_1__c}" rendered="{!IF(Case.Status == 'Working',true,false)}" />
  <apex:inputField value="{!Case.Working_2__c}" rendered="{!IF(Case.Status == 'Working',true,false)}" />
  
   </apex:pageblockSection>
<apex:pageblockbuttons >
<apex:commandButton value="save" action="{!save}"/>

</apex:pageblockbuttons>
</apex:pageBlock>
</apex:form>

</apex:page>


Please help me on save and any changes on the code.


Regards,
Isha 

 
HI team,


I have my below vfpage . which is working on both lighting and classic with mobile. but in mobile scroll bar is not working kindly any help on this.


<apex:page standardController="Account" tabStyle="Account">
 <!--<apex:includeLightning />-->
 <apex:slds >
   <apex:iframe src="" scrolling="true" height="650px" id="NPXAccountChartFrame"/>
  

   <!--if you embed mutiple chart add some index to id-->
   <script>
    document.getElementById("NPXAccountChartFrame").style.overflow:auto; 
   
    var embeddedLink = '{!$Setup.SFDC_URL__c.NPX_Account_View_Embed__c}';
    var embedChartUrl = '/main/embed?'+embeddedLink;//this need to change as per chart/view embed link
    //var enterpriseIdfier = 'SMXCONNECTORS';//this need to change as per enterprise
    var enterpriseIdfier = 'RASMITHA';//this need to change as per enterprise
    console.log('Account.Id = {!Account.Id}');
    var smxServer = '{!$Setup.SMX_URL__c.SMX_URL__c}'; 
    var varSessionID = '{!$Api.Session_ID}';
    var saleforceServer = '{!$Setup.SFDC_URL__c.SFDC_URL__c}';
    var varOwner = '{!$User.Id}';
    var varUsername = '{!$User.Username}';
    embedChartUrl = embedChartUrl + '&urlParams={"INTEGRATION_COMPANY_CODE":"{!Account.Id}"}';
    
    var url = smxServer + '/app/core/j_satmetrix_security_check?session='+ varSessionID + '&server="'+saleforceServer+'"&owner='+varOwner+'&username='+varUsername+'&version=3&enterpriseIdfier='+enterpriseIdfier+'&requestTokenType=SALES_FORCE&requestToken=NONE&targetUrl='+embedChartUrl;
    
    document.getElementById('NPXAccountChartFrame').src = url;
    
    <!--if you embed mutiple chart add some index to id-->
   </script>
    </apex:slds>   
</apex:page>


Regards,
Isha
Hi , Iam writing belowtest class . But Iam getting below error.

"System.QueryException: List has no rows for assignment to SObject ".


@isTest 
private class SMXNPXSurveyBLTest {     

static testMethod void testNPXsurveycasecreation(){   
  
User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
       // Insert account as current user
        
            Profile p = [SELECT Id FROM Profile WHERE Name='Standard User'];
            UserRole r = [SELECT Id FROM UserRole WHERE Name='COO'];
          user u = new User(alias = 'jsmith', email='jsmith@acme.com', 
                emailencodingkey='UTF-8', lastname='Smith', 
                languagelocalekey='en_US', 
                localesidkey='en_US', profileid = p.Id, userroleid = r.Id,
                timezonesidkey='America/Los_Angeles', 
                username='jsmith@acme.com');
                
                System.RunAs(thisUser){
            insert u;
            
       
      Account a = new Account(Name='SMX Test Account', Industry='Test Industry',BillingPostalCode='211212',BillingStreet='TestStreet',BillingCity='TestCity',BillingCountry='Japan');
      insert a;
        
     Contact c = new Contact(FirstName='SMX TestFName1', LastName='SMX TestLName1', AccountID=a.id, Email='this.is.a.smx.test@acmedemo.com', Phone='9999999');
     insert c;  
        
  
 Workgroup__c wg=New Workgroup__c();
 wg.Name='test';
 insert wg;
 
 
 Workgroup_User_Role__c WUR = new Workgroup_User_Role__c();
 WUR.Workgroup__c=wg.Id;
 WUR.Case_type__c='Admin SR';
 WUR.Product_Series__c='PULSE ONE';
 WUR.Role_Name__c=r.id;
 insert WUR;
 

 case ca= new case();
 ca.Accountid=a.id;
 ca.contactid=c.id;
 ca.subject='testsubject';
 ca.Description='testdescription';
 ca.status='submitted';
 ca.Priority='High';
 ca.Severity__c='test';
 ca.origin='Email';
 ca.Transaction_Type__c='Admin SR';
 ca.Product_Series__c='PULSE ONE';
 ca.Platform__c='PUSE ONE CONSOLE';
 ca.Release__c ='2.0';
 ca.Category__c='AAA';
 ca.SR_Category1__c='Question';
 ca.SR_Category2__c='Other';
 Test.starttest();
 insert ca;
 Test.stoptest();

 
NPX_Survey_Record__c npx = new NPX_Survey_Record__c();
npx.Account__c=a.id;
npx.contact__c=c.id;
npx.case__c=ca.id;
npx.name='test';
npx.Primary_Score__c=10;
npx.primary_comment__c='test comment';
npx.Survey_ID__c='PULSESECURE_127771';
npx.Nomination_Process__c='Case Closure Nomination';
npx.Status__c='Nominated';
npx.Survey_Name__c='Technical Support Survey';
npx.Product_Series__c='CONNECT-SECURE';
npx.Survey_Details_URL__c='';
npx.Status_Description__c='test description';
Test.starttest();
insert npx;

test.stoptest();
npx.Primary_Score__c=6;
update npx;


}

}
}


Apex class:


public with sharing class SMXNPXSurveyBL
{  
  
    /*
     * Method which takes a set of NPX Survey records and check for the primary score lessthan or equal to 6 and 
     *then create case if there is no case existed on the NPX Survey record.  
   */
  public static void createCase(List<NPX_Survey_Record__c> newRecords)
    {
    
    String severity;
    String IsAlert = 'N';
    
    Set<Id> nPXIds = new Set<Id>();    
    for(NPX_Survey_Record__c npx:newRecords){
    
        nPXIds.add(npx.id);
    }
    List<case> caseList = new  List<case>();
    List<Case> ListCases = new List<Case>();
    
     caseList=[select id,Casenumber,NPX_Survey_Record__c from Case where NPX_Survey_Record__c in :nPXIds];
     
         if(!nPXIds.isEmpty()){
         
             for(NPX_Survey_Record__c npx:newRecords){                            
                 
                 if(npx.Primary_Score__c <= 6 && npx.Survey_ID__c =='PULSESECURE_127771'){
                      
                         severity='High';
                         
                         IsAlert = 'Y';
                    }
                                       
                  if(caseList.isEmpty() && (IsAlert == 'Y')){
                    Case c=new Case();
                    c.OwnerId=npx.OwnerID;
                    c.parentid=npx.case__c;
                    c.Subject='CPSE Negative Survey for '+npx.Account__r.Name;
                    c.Survey_Details__c ='Primary Score: '+ npx.Primary_Score__c+ '\n Primary Comment: '+npx.Primary_Comment__c;
                    //c.Status=status;
                    c.Priority=severity;
                    c.AccountId=npx.Account__c;
                    c.ContactId=npx.Contact__c;
                    c.Origin='Satmetrix';
                    //c.RecordTypeId=recType.Id;
                    c.NPX_Survey_Record__c=npx.id;
                    c.SurveyDetailsURL__c = npx.Survey_Details_URL__c;
                    ListCases.add(c);
                    
                }
                
                 
             }  
              
              insert ListCases;
        }
    }
    
}


Can you please help me out on this . how to pass this one


Regards,
Isha
Hi Everyone,

I ha ve below code. Iam trying to delete the customteammember based on the inactive users(User is a lookup field on customteammember object).  Iam getting below error.


System.SObjectException: DML statement cannot operate on trigger.new or trigger.old: Class.CustomTeamMemberTriggerBL.DeleteInactiveMembers: line 26, column 1


Code:

public class CustomTeamMemberTriggerBL{

 public static void DeleteInactiveMembers(Map<id,CustomTeamMember__c> newRecords){
 
    set<Id> cmIDs = new set<Id>();
    for(CustomTeamMember__c cm:newRecords.values()){
       cmIDs.add(cm.Distribution_List__c);
    }
    
    List<CustomTeams__c> cus = new List<CustomTeams__c>();
    List<CustomTeamMember__c> cus1 = new List<CustomTeamMember__c>();
      
    cus = [SELECT Id,Name FROM CustomTeams__c WHERE id IN: cmIDs];
    
      for(CustomTeams__c ct: cus){
     
        for(CustomTeamMember__c cm: newRecords.values()){
        
                
            if( ct.id == cm.Distribution_List__c && cm.User__r.IsActive == false){
                cus1.add(cm);
            }                   
        }        
     }  
      
    Delete cus1;
     
   }
   
  }

Please help me on this code and any changes please let me know.

Regards,
Isha
 
Hi Everyone,

I have below vfpage code. iam getting value of daterangevalue onclick action in jquery. i need to send this value to controller after click on save . they are already using the commandlink in the code.
i tried with param but iam geeting blank  value in the controller
 
 
 i need help on to pass "daterangevalue" variable from controller to page . 


         <input name="dateRangeSelect" id="dateRangeSelect">                                 
                                            <img src="{!$Resource.Downarrowimage}" width="8" height="8" style="margin-left:-16px;margin-top:-2px;position: relative;"/>
                                            </input>
                                            <output id="outputid" type="text" value="daterangevalue1"/>
                                             
                                              <script>
                                               $("#dateRangeSelect").daterangepicker({
                                                 open: function(event, data) {  },
                                                 change: function(event, data) {
                                                    $("li.ui-menu-item").click(function(){
                                                        console.log($(this).text());
                                                      $("#outputid").val("Date range : "+$(this).text());
                                                       var daterangevalue=  ($(this).text());
                                                        alert(daterangevalue);
                                                    });
                                                   var a = '{!daterangevalue}';
                                                   alert(a);
                                                  
                                                  
<apex:commandLink status="renderLightningSpinner" action="{!saveSettings}" value="Save" reRender="pgMsgPnl" title="Save Setting" style="width:25px;height:25px;" onclick={} >
                                            <apex:param name="daterangevalue" value="" assignTo="{!daterangevalue}"/>
                                            </apex:commandLink>
                                            
        controller:
        public string daterangevalue{get;set;}
        public void saveSettings(){
    
    string value=Apexpages.currentPage().getParameters().get('daterangevalue');

    system.debug('@@test:'+value);



result:  @@test:[blank]
Regards,
Isha
Hi everyone,

i am trying to write the testclass on below class.  some one help me on the test class. I have tried the below given test class but got 0% coverage



public class Trendingfeedbackiconextension{
 
    
    public Id RecordId{get;set;}       
    public String param1 { get; set; }
    public String buttonText{get;set;}
    public string reportComponentName{get;set;}
    public string reportComponentUniqueName{get; 
            set {
            reportComponentUniqueName = value;
            Trendingfeedbackhelperextensionmethod();
            }}
              
    Map<String,Integer> likedislikeCountMap = new Map<String,Integer>();
     
    public pagereference likeDislikemethod(){
     likedislikeCountMap.clear();
    RecordId= Apexpages.currentPage().getParameters().get('id');
    
    System.debug('@@'+RecordId);   
         system.debug('reportComponentUniqueName==>'+reportComponentUniqueName );
        system.debug('reportComponentName==>'+reportComponentName);
        string value= Apexpages.currentPage().getParameters().get('param1');
        system.debug('param1==>'+param1);  
        string componentName = param1.split('-')[0];
        string actionName = param1.split('-')[1];  
        system.debug('componentName==>'+componentName);    
        system.debug('actionName==>'+actionName);    
        //sentdata= Userinfo.getUserId();
        system.debug('@@'+value);
        list<Feedback__c> flist= new list<Feedback__c>();
        Feedback__c f=new Feedback__c();
        flist=[select id,Name,Action__c,User__c,Comment__c from Feedback__c where Name=:componentName And ((Action__c='Like' Or Action__c='Dislike') And User__c=:Userinfo.getUserId()) And AccountId__c=:RecordId];
        system.debug('@@'+flist);
        if(flist.size()== 0){
            system.debug('@@'+flist.size());
            f.Action__c = actionName;
            //sendAction = f.Action__c;
            f.Name = componentName;
            f.AccountId__c=RecordId;
            f.Comment__c=buttonText;
            f.User__c = UserInfo.getUserId();
            system.debug('f===>'+f);
            insert f;

        }
        else {
            system.debug('elseenter');
            for(Feedback__c f2:flist){
                f2.Action__c = actionName;
                f2.Comment__c= buttonText;
              /*  if(f2.Action__c == 'Like'){
                    system.debug('@@'+likedata);
                    system.debug('@@'+dislikedata);
                    likedata =True;
                    dislikedata = false;

                }
                else if(f2.Action__c == 'Dislike'){
                    likedata =false;
                    dislikedata = true;

                }*/

            }
            update flist;
            Trendingfeedbackhelperextensionmethod();
        }
         buttonText='';
        return null;

    }


    

    public void Trendingfeedbackhelperextensionmethod(){ 

     RecordId= Apexpages.currentPage().getParameters().get('id');   
     System.debug('@@'+RecordId);   
       
        system.debug('method enter');
        system.debug('reportComponentUniqueName==>'+reportComponentUniqueName );
        system.debug('reportComponentName==>'+reportComponentName);
        system.debug('@@'+RecordId);
        //list<AggregateResult> results = [select count(Id) Quantity,Action__c FROM Feedback__c WHERE Name In('AORT1','AORT2') GROUP BY  Action__c];        
        list<AggregateResult> results = [select count(Id) Quantity,Action__c FROM Feedback__c WHERE Name =:reportComponentUniqueName and AccountId__c=:RecordId GROUP BY  Action__c having Action__c='Like' OR Action__c='Dislike'];        

        system.debug('@@'+results);
        for(AggregateResult ar : results){
            system.debug('@@'+results);            
            likedislikeCountMap.put((string)ar.get('Action__c'), (integer)ar.get('Quantity'));
            system.debug('@@'+likedislikeCountMap); 
        
       getLikeCount();
       getDislikeCount();
        

        }              

    }
   
    public Trendingfeedbackiconextension(){
   Trendingfeedbackhelperextensionmethod();    
       //system.debug('method enter');
    }
        
/*

        //list<AggregateResult> results = [select count(Id) Quantity,Action__c FROM Feedback__c WHERE Name In('AORT1','AORT2') GROUP BY  Action__c];        
        list<AggregateResult> results = [select count(Id) Quantity,Action__c FROM Feedback__c WHERE Name ='AccountOrganizationRevenueTrend' GROUP BY  Action__c];        

        system.debug('@@'+results);
        for(AggregateResult ar : results){
            system.debug('@@'+results);            
            likedislikeCountMap.put((string)ar.get('Action__c'), (integer)ar.get('Quantity'));
            system.debug('@@'+likedislikeCountMap); 
        }
    
    }*/

     public Integer getLikeCount(){
        if(likedislikeCountMap.get('Like') == null) {
        system.debug('like');
            return 0;
        } 
        return likedislikeCountMap.get('Like');
        
        
    }  
    public Integer getDislikeCount(){
    
        if(likedislikeCountMap.get('Dislike') == null) {
        system.debug('Dislike');
            return 0;
        }
        return likedislikeCountMap.get('Dislike');
    }


    public PageReference Save() {
    string value2= Apexpages.currentPage().getParameters().get('param2');
        string componentName = value2.split('-')[0];
        string actionName = value2.split('-')[1];
        list<Feedback__c> f=new list<Feedback__c>();
        Feedback__c fb=new Feedback__c();
        fb.Action__c=actionName;
        fb.Name=componentName;    
        fb.Comment__c=buttonText;
        fb.AccountId__c=Apexpages.currentPage().getParameters().get('id');
        fb.User__c=userinfo.getuserid();
        f.add(fb);
        insert f; 

        buttonText='';
        return null;
       }




}

Test class:

@isTest
public class TrendingfeedbackiconextensionTest {
    
private static testMethod void trendingfeedbacktest() {

    //list<Feedback__c> f1 = new list<Feedback__c>();
    Feedback__c f2 = new Feedback__c();
    f2.AccountId__c = 'testid';
    f2.Action__c = 'Like';
    f2.Comment__c = 'testcomment';
    f2.User__c = UserInfo.getUserId();
   // f1.add(f2);
    insert f2;
    
    f2.Action__c= 'Dislike';
    
    Update f2;
  
   
    
}
}


Regards,
Isha
Hello Eevryone,

If i click on the quickaction i need to display the below URL in case object.Can you help me how to do this.


http://compass/trainer/mycompass/patients?pageaction=search&mrn=\{!Account.Mrn__pc}


Regards,
Isha

Hi,

I have below formuls.Getting the below error that "Compiled formula is too big to execute (6,846 characters). Maximum size is 5,000 characters".

Can you please help on this?

IF (OR ((Initial_Engagement_Date__c>Contract_Provided_Date__c),
          (Initial_Engagement_Date__c>Contract_Signed_Date__c),
          (Initial_Engagement_Date__c>Latest_Implementation_Date__c),
          (Initial_Engagement_Date__c>Go_Live_Date__c)),"Engaged",          
IF(OR ((Contract_Provided_Date__c>= Initial_Engagement_Date__c),
          (Contract_Provided_Date__c>Contract_Signed_Date__c),
          (Contract_Provided_Date__c>Latest_Implementation_Date__c),
          (Contract_Provided_Date__c>Go_Live_Date__c)),"Contract Provided",                    
IF(OR ((Contract_Signed_Date__c>= Initial_Engagement_Date__c),
          (Contract_Signed_Date__c>=Contract_Provided_Date__c),
          (Contract_Signed_Date__c>Latest_Implementation_Date__c),
          (Contract_Signed_Date__c>Go_Live_Date__c)),"Contract Signed",
IF(OR ((Latest_Implementation_Date__c>= Initial_Engagement_Date__c),
          (Latest_Implementation_Date__c>=Contract_Provided_Date__c),
         (Latest_Implementation_Date__c>= Contract_Signed_Date__c),
          (Latest_Implementation_Date__c>Go_Live_Date__c)),"Implementation",
IF(OR ((Go_Live_Date__c>= Initial_Engagement_Date__c),
          (Go_Live_Date__c>=Contract_Provided_Date__c),
          (Go_Live_Date__c>=Latest_Implementation_Date__c)), "Live",
IF(ISPICKVAL(CL360_Status__c, "Declined"), "Declined",NULL))))))



Regards,
Isha