• fiona gentry
  • NEWBIE
  • 460 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 70
    Questions
  • 20
    Replies
Dear Folks,

I need to create and add this kind of Tick marked screen flow in one of my Tab ,how do i do it?

User-added image
Regards
Fiona
Dear folks,

How to find smallest number in array using Map

Example 1:

Input: nums = [2,5,6,9,10]

Explanation:
The smallest number in nums is 2.


Here is code tried using Maps but no success
public class GCDArray {
    public static List<String> greatestdiv(String input) {
        system.debug(input);
        List<String> inputList = input.split('');
        system.debug(inputList);
        Map<String,Integer> counts = new Map<String,Integer>();
        system.debug(counts);
        for(String s1:inputList) {
            counts.put(s1,0);
            system.debug(counts);
        }
        for(String s1:inputList) {
            counts.put(s1,counts.get(s1)+1);
        }
        system.debug(counts);
        String maxKey = counts.isEmpty()?null:new List<String>(counts.keyset())[0];
        system.debug(maxKey);
        for(String s1:counts.keySet()) {
            maxKey = counts.get(s1)>counts.get(maxKey)?s1:maxKey;
        }
        system.debug('The smallest number in array is'+ maxKey);
        system.debug(counts.get(maxKey));
        
        List<String> resultList = maxKey.split('');
        for( Integer S : counts.keySet() ){
            system.debug(S);
            resultList.add(S,counts.get(S));
            system.debug(resultList);
            
            
        }
        
        
        return resultList;      
    }
    
    
}

Regards,
Fiona
 
Hi Folks,

Trying to solve the problem of Find Greatest Common Divisor of Array

Given an integer array nums, return the greatest common divisor of the smallest number and largest number in nums.

The greatest common divisor of two numbers is the largest positive integer that evenly divides both numbers.

Example 1:

Input: nums = [2,5,6,9,10]
Output: 2
Explanation:
The smallest number in nums is 2.
The largest number in nums is 10.
The greatest common divisor of 2 and 10 is 2.

Example 2:

Input: nums = [7,5,6,8,3]
Output: 1
Explanation:
The smallest number in nums is 3.
The largest number in nums is 8.
The greatest common divisor of 3 and 8 is 1.

Example 3:

Input: nums = [3,3]
Output: 3
Explanation:
The smallest number in nums is 3.
The largest number in nums is 3.
The greatest common divisor of 3 and 3 is 3.

Here is code tried using Maps but no success ,any help is appreciated
 
public class GCDArray {
    public static List<String> greatestdiv(String input) {
        system.debug(input);
        List<String> inputList = input.split('');
        system.debug(inputList);
        Map<String,Integer> counts = new Map<String,Integer>();
        system.debug(counts);
        for(String s1:inputList) {
            counts.put(s1,0);
            system.debug(counts);
        }
        for(String s1:inputList) {
            counts.put(s1,counts.get(s1)+1);
        }
        system.debug(counts);
        String maxKey = counts.isEmpty()?null:new List<String>(counts.keyset())[0];
        system.debug(maxKey);
        for(String s1:counts.keySet()) {
            maxKey = counts.get(s1)>counts.get(maxKey)?s1:maxKey;
        }
        system.debug('The smallest number in array is'+ maxKey);
        system.debug(counts.get(maxKey));
        
        List<String> resultList = maxKey.split('');
        for( Integer S : counts.keySet() ){
            system.debug(S);
            resultList.add(S,counts.get(S));
            system.debug(resultList);
            
            
        }
        
        
        return resultList;      
    }
    
    
}

Regards,
Fiona
Hi Folks,

Trust you doing great...!

i tried Paypal integration To LWC by 
Copy and pasting this code into an HTML page and viewed it in  browser. Used the code below to start a basic integration.
 
<script src="https://www.paypal.com/sdk/js?client-id=test"></script>
<script>paypal.Buttons().render('body');</script>



But looks like this didnt worked,can some one help me in writing doing Paypal integration with LWC

I followed this documentation -->  
https://developer.paypal.com/docs/checkout/

Regards
Fiona
Hi,

Dear folks,

Here is what i want to do and thankfully was able to get answer using thread below with List
https://developer.salesforce.com/forums/ForumsMain?id=9062I000000BjjoQAC
,but now i am rewriting the same code using Map,but am getting error as 
 
Method does not exist or incorrect signature: void get(String) from the type Map
Here is what the end goal is 
 
For example, if s = "zbax" and k = 2, then the resulting integer would be 8 by the following operations:

Convert: "zbax" ➝ "(26)(2)(1)(24)" ➝ "262124" ➝ 262124
Transform #1: 262124 ➝ 2 + 6 + 2 + 1 + 2 + 4 ➝ 17
Transform #2: 17 ➝ 1 + 7 ➝ 8

Here is code with Map
public class SDASMapConvert {
    

    
    
public static Integer returnInteger(String z, integer k){
        Integer retInt;
        String key = 'abcdefghijklmnopqrstuvwxyz';

        List<String>myAlphabets = z.split('');
        Map<String, String> myMap = new Map<String, String>();
        String strarr = '';

       for (integer i = 0; i < myAlphabets.size(); i += 2) {
        myMap.put(myAlphabets[i], myAlphabets[i + 1]);
    }

    for (String s : myMap.keySet()) {
        System.debug(s + ' is ' + map.get(s));
        strarr += string.valueOf(s);
    }
        
        system.debug('strarr --> ' + strarr);
        String s = '';
        for(integer i = 0; i < k ; i++){
            system.debug(' strarr --> ' + strarr);
            Integer total = 0;
            for(String s1 : strarr.split('')){
                total += integer.valueOf(s1);
            }
            system.debug(' total --> ' + total);
            strarr = string.valueOf(total);
        }
        
        system.debug(' ************* ' + strarr);
        if(!string.isEmpty(strarr))
            retInt = integer.valueOf(strarr);
        
        system.debug(' ************* ' + retInt);
        
        return retInt;
    }
    


}

Regards
Fiona
Dear folks,

Here is what i want to do
 
For example, if s = "zbax" and k = 2, then the resulting integer would be 8 by the following operations:

Convert: "zbax" ➝ "(26)(2)(1)(24)" ➝ "262124" ➝ 262124
Transform #1: 262124 ➝ 2 + 6 + 2 + 1 + 2 + 4 ➝ 17
Transform #2: 17 ➝ 1 + 7 ➝ 8



Hence ,Wrote a apex class for To  convert string into an integer by replacing each letter with its position in the alphabet,but it doesnt seems working,error i get on Anonymus Console Window for below command
is 
Line: 14, Column: 1
System.TypeException: Invalid integer: a
Here is anonymous code
SDSAfterConvert.returnInteger();

Here is apex code
 
public class SDSAfterConvert {
    
    
public static List<Integer> returnInteger(){


List<Integer> inputList = new List<Integer>();
             
String[] myAlphabets = new String[]{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'g'};
 
for (String s1 : myAlphabets) {
   
    System.debug(s1);
    Integer d = integer.ValueOf(s1);
    inputList.add(d);
}
        
return inputList;
             
}
    
}



Regards,
Fiona​​​​​​​
 
Dear folks,

I have a custom object ,How To Create Stages In Custom Object as As Shown in Image,I want stages like New>>Get Record>>Work In Progress >> CloseTicket

User-added image
Regards,
Fiona
Hi,

Below is apex code which i am terying to execue in "Open Execute Anonymous Window"
SDSAfterConvert n1 = new SDSAfterConvert();
n1.returnInteger();


Here is Apex class
public class SDSAfterConvert {
    
    
public static List<String> returnInteger(){

List<String> inputList = new List<String>();
             
String[] myAlphabets = new String[]{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'g'};
 
for (String s1 : myAlphabets) {
    System.debug(s1);
    inputList.add(s1);
}
        
return inputList;
             
}
    
}


Can anyone help why i am getting this error as My method is static and arrays can be returned from static

Regards,
Fiona



 
Created a new Custom object ,now i want to create this Custom Object as Tab in the App ,but when i create a "Lightning App",can't see the Custom object in Navigation Items,I checked in profiles as well ,i had full access to the custom object as i am salesforce admin

User-added image
Your help is highly appreciated

Fiona
Hi Folks,

 I have a problem where for Given an integer n, i want to return true if n has exactly three positive divisors. Otherwise, return false.

Example 1:

Input: n = 2
Output: false
Explantion: 2 has only two divisors: 1 and 2.

Example 2:

Input: n = 4
Output: true
Explantion: 4 has three divisors: 1, 2, and 4.

Tried to use List to achieve ,but no success,can any one solve the code below or it needs a Map?
public class ThreeDivisors {
    
    public static List<Integer> returnThreeDivisors(Integer input){
        
        List<Integer> inputList = new List<Integer>();
        Integer divisor = 0;
        
        for (Integer i=0; i<inputList.size(); i++) {
                    Integer var = inputList[i];
                    
                    if ( Math.mod(var,i) == 0)
                    {
                        divisor++;
                    }
                }
        
        return inputList;
    }

}

Regards,
Fiona
 
Dear Folks,

I have to display a field named Score from a nested Rest API JSON response in a "Aura Lightning Component"  and this component will be shown in Related Details of Contacts .

Can some one help provide a code to do this ,The Response schema which looks like this 
User-added imageHere is the Nested JSON response sample
{
  "responseID": "bb24077b-12c9-4ffe-ac7b-61cafe7281c2",
  "requestID": "1112211",
  "responseDate": "10/8/2019 12:34:58 PM",
  "prospectScoringOverallScoreID": 2213,
  "model": "your_code",
  "personID": "3333",
  "error": null,
  "blackList": false,
  "approved": false,
  "score": 0,
  "decisions": [
    {
      "code": "approved",
      "description": "Approved"
    }
  ],
  "followUpActions": null,
  "dashboardLink": "https://dashboard.vspinsight.net/app/eligibility-checks/2213",
  "vendors": {
    "primCipScore": {
      "FraudID": "385092122",
      "cvi": 20,
      "nas": 0,
      "nap": 0,
      "cmra": false,
      "poBox": false,
      "dobVerified": false,
      "riskIndicators": [
        {
          "code": "02",
          "description": "The input name matches the OFAC file",
          "sequence": 1
        },
        {
          "code": "19",
          "description": "Unable to verify name  address  SSN/TIN and phone",
          "sequence": 2
        },
        {
          "code": "79",
          "description": "The input SSN/TIN was missing or incomplete",
          "sequence": 3
        },
        {
          "code": "16",
          "description": "The input phone number and input zip code combination in invalid",
          "sequence": 4
        },
        {
          "code": "82",
          "description": "The input name and address return a different phone number",
          "sequence": 5
        },
        {
          "code": "64",
          "description": "The input address returns a different phone number",
          "sequence": 6
        }
      ],
      "followUpActions": [
        {
          "code": "A",
          "description": "Follow your internal policy regarding potential matches to OFAC database information"
        },
        {
          "code": "B",
          "description": "Verify name with Social (via SSN card  DL if applicable  paycheck stub  or other Government Issued I"
        },
        {
          "code": "C",
          "description": "Verify name with Address (via DL  utility bill  Directory Assistance  paycheck stub  or other Govern"
        },
        {
          "code": "D",
          "description": "Verify phone (Directory Assistance  utility bill)"
        }
      ],
      "errorMessage": null
    },
    "primFraudScore": {
      "FraudID": "385092122",
      "fraudScore": 453,
      "stolenIdentityIndex": 0,
      "syntheticIdentityIndex": 0,
      "manipulatedIdentityIndex": 0,
      "vulnerableVictimIndex": 0,
      "friendlyFraudIndex": 0,
      "suspiciousActivityIndex": 0,
      "warningCodes": [
        {
          "code": "IA",
          "description": "The input IP address is not assigned to the United States",
          "sequence": 0
        },
        {
          "code": "38",
          "description": "The input SSN is associated with mulitiple last names",
          "sequence": 0
        },
        {
          "code": "MN",
          "description": "The input SSN was issued within the last seventeen years",
          "sequence": 0
        },
        {
          "code": "PA",
          "description": "Potential address discrepancy - the input address may be a previous address",
          "sequence": 0
        }
      ],
      "followUpActions": [],
      "errorMessage": null
    },
    "primDeviceScore": {
      "score": 0,
      "riskLevel": 0,
      "tdl": null
    },
    "primEmailScore": {
      "easCore": 0,
      "riskBand": 0
    },
    "primTelcoScore": {
      "Impact": "FirstNameScore: 9\nLastNameScore: 0\nStreetAddressScore: 0\nCityScore: 0\nStateScore: 0\nZipCodeScore: 0\nEmailAddressScore: 0\nDataSource: Third-Party\n"
    },
    "primAbuseScore": {
      "score": "0644",
      "unpaidClosures": "",
      "partiallyPaidClosures": "",
      "previousInquiries": "002",
      "reportedClosures": null,
      "reasonCodes": [
        {
          "reasonCode": "CN",
          "reasonText": "PROPERTY OWNERSHIP HISTORY UNKNOWN"
        },
        {
          "reasonCode": "CQ",
          "reasonText": "ASSET OWNERSHIP HISTORY UNKNOWN"
        },
        {
          "reasonCode": "CK",
          "reasonText": "NON-DEROGATORY PUBLIC RECORD HISTORY UNKNOWN"
        },
        {
          "reasonCode": "CG",
          "reasonText": "TIME AT CURRENT ADDRESS UNKNOWN"
        },
        {
          "reasonCode": "CB",
          "reasonText": "TIME SINCE DDA INQUIRY ACTIVITY"
        }
      ]
    },
    "primGeoScore": {
      "geolocation": null,
      "anonymousProxy": false,
      "legitimateProxy": false
    }
  }
}
Regards,
Fiona

 
Dear gurus,

I have a problem where 

GIVEN there is a string of characters, and i need to ivoke a reverse method is invoked such that it returns an array of characters in reversed order for alphanumeric characters only however all other non-alphanumeric characters need to retain their original position -
How to Implement solution in Apex?

I tried below code but no luck
public class assessment {
  public static List<String> reverseSpecialString(String input) {
        List<String> resultList = new List<String>();
         // IMPLEMENT
        resultList = input.split('');
        string reversedString='';
        for(integer i=resultList.size()-1;i>=0;i--)
            {
             
            reversedString=reversedString+resultList[i];
               
            }
    
       
        
        
         return resultList;
      
       }
    
    public static void validateSolution() {
        String input = 'ABC@HI#J2';
        List<String> expected = new List<String> {'2','J','I','@','H','C','#','B','A'};
        List<String> actual = reverseSpecialString(input);
        
        System.assertEquals(expected, actual, 'Invalid Results');
    }
}

Thanks,
Fiona​​​​​​​

 
I have a interview question below 

GIVEN:     a string of characters,
 WHEN:     reverse method is invoked
  THEN:    return an array of characters in reversed order for alphanumeric characters only however all other non-alphanumeric characters need to retain their original position
        
        - Implement solution in Apex
public class Class {
    /*
		PROBLEM:
		- User Story: 
			As an organizer, I need to sort in reverse order,
			so that I can help those at the end of the line.

        - Acceptance Criteria:
			GIVEN: 	a string of characters,
            WHEN: 	reverse method is invoked
			THEN:	return an array of characters in reversed order for alphanumeric characters only
					however all other non-alphanumeric characters need to retain their original position
        
        - Implement solution in Apex
      

		VALIDATE SOLUTION:
		// Run anonymous apex
		ASSESSMENT_UtilityClass2.validateSolution();
	
	*/
    
    // SAMPLE:
    // 1. input: 'ABC@HI#J2'
    // 	  output: ['2','J','I','@','H','C','#','B','A']
    
    public static List<String> reverseSpecialString(String input) {
        List<String> resultList = new List<String>();
         // IMPLEMENT
        resultList = input.split('');
        string reversedString='';
        for(integer i=resultList.size()-1;i>=0;i--)
            {
             
            resultList[i]=reversedString+resultList[i];
               
            }
    
       
        
        
         return resultList;
    }
    
    public static void validateSolution() {
        String input = 'ABC@HI#J2';
        List<String> expected = new List<String> {'2','J','I','@','H','C','#','B','A'};
        List<String> actual = reverseSpecialString(input);
        
        System.assertEquals(expected, actual, 'Invalid Results');
    }
}
can any one help solve above for me ,need to validate the code in anonymus apex by writing 
 
Class.validateSolution();

Regards,
Fiona​​​​​​​
Dear gurus,

On trailhead Salesforce today saw a  Salesforce Sandbox Seeding  tool  to  propagate (targeted) data to lower environments with some clicks, my question is it really helpful? , i saw Salesforce was pushing  in this direction for migrating data from current company org  to the new org.. but won't it  make companies  to enter into a licensed product agreement if it’s a one time thing. 

Also Would this empower devs or help with automated testing in lower environments?Your honest responses are highly appreciated

Here is the link of product https://www.ownbackup.com/products-sandbox-seeding/ 

Regards,
Fiona
Dear gurus,

I need  To build LWC component Interactive calendar to display products from Salesforce

Below is base query :-
[SELECT Id,Name,Calendar_Start_Date_Time__c,Calendar_End_Date_Time__c,Description,Topics__c from Product2];
Now i want below things:-
  • Ability to search the Calendar when i type a text say "Mass Communication training" on text box then calendar date should get displayed
  • Ability to filter the calenda i.e. Filters shuld be defined by the values returned in query's Topics__c
  • Ability for on click function when user clicks on event. then Display a modal based on product id,below is the example of final results
User-added image

Appreciate the help,thanks in advance

Fiona

 
Hi,
i need to send current case to lightning component and wrote below apex but seems i am not able to send current case record  id to lightning component,any solution
 
public static Case getCaseFromId(Id caseID) { 


    if(caseID == null) {
            return [SELECT ID, Subject, Description, STATUS from Case LIMIT 1];
        }
    
     List<Case> cases = [ SELECT Id, Subject, Description, Status from CASE where ID = :caseID ];
        
        if(cases.size() == 0) {
            return [SELECT ID, Subject, Description, STATUS from Case LIMIT 1];
        } else {
            return cases[0];
        }        

}
cmp file
<aura:attribute name="record" type="case[]"/>

controller file
var action = component.get("c.getCaseFromId");
    action.setCallback(this, function(response){
        var state = response.getState();
        if (state === "SUCCESS") {
          
            var navEvent = $A.get("e.force:navigateToSObject");
             alert("hello there!"+ component.get("v.record",response.getReturnValue())); 
            navEvent.setParams({

               "recordId": component.get("v.record",response.getReturnValue())

            });
            navEvent.fire();

Problem is alert shows "undefined" in browser that means something is wrong,any suggestions

Fiona
Dear pals,

How do i Get Case Id in Lightning such that after save Case is shown and not related list,

currently after save Most recent cases are shown ,i need to show the associated Case after save and not List view,how to achieve this

current apex class for list view is
@AuraEnabled 

public static List<ListView> getListViews() { 

    List<ListView> listviews = [SELECT Id, Name FROM ListView WHERE SobjectType = 'Case' and Name = 'Recently Viewed Cases']; 
    
    return listviews;

Lightning component cmp file is
 
var action = component.get("c.getListViews");
    action.setCallback(this, function(response){
        var state = response.getState();
        if (state === "SUCCESS") {
            var listviews = response.getReturnValue();
            var navEvent = $A.get("e.force:navigateToList");
            navEvent.setParams({
                "listViewId": listviews.Id,
                "listViewName": null,
                "scope": "Case"
            });
            navEvent.fire();
        }
    });
        $A.enqueueAction(action);

any help to display the Case itself after save is highly appreciated

Regards,
Fiona

 
Dear Gurus,

I have a need where in i require to execute below code in Anonymous block,

what changes i need to make in below scheduled apex to make it execute in anonymous block,i just need to execute the code 
 
global class ERT_CaseCopyBatch implements Database.Batchable<sObject>, Database.Stateful {
    private List<ERT_Case_Type__c> processedRecords;
global Database.QueryLocator start(Database.BatchableContext BC) {
    processedRecords = new List<ERT_Case_Type__c>();
    // collect the batches of records or objects to be passed to execute        
    String query = 'SELECT Case__c, Level_1__c, Level_2__c,Level_3__c,UniqueGUID__c  FROM ERT_Case_Type__c WHERE createddate = today AND IsProcessed__c = false';
    return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<ERT_Case_Type__c> exeList) {   
    // process each batch of records
    List<Case_Type__c> listCTD = new List<Case_Type__c>();
   
    for(ERT_Case_Type__c exe : exeList)
    {        
        listCTD.add(new Case_Type__c(Case__c=exe.Case__c,Level_1__c=exe.Level_1__c,Level_2__c=exe.Level_2__c,Level_3__c=exe.Level_3__c,ERTUniqueGUID__c=exe.UniqueGUID__c));
       exe.IsProcessed__c = true;    
    }
    try {
        
        insert listCTD;
        //only successful batches will be processed 
        processedRecords.addAll(exeList);
        update processedRecords;
    } catch(Exception e) {
        System.debug(e);
    }
}   
global void finish(Database.BatchableContext BC) {
   
  
}
}

Thanks in advance,
Fiona
Dear Gurus,

I am starting with a new project where basically need to do Migration of Organization's current database to Salesforce and for that i want to create a customized set of objects, single-record editing of data and field history tracking

What I have Now ?
Now I have spreadsheets and detailed information that needs tracking question is How To Do Data Setup & Customization for such scenario

Like what woud be the first milestone

Regards,
Fiona
Dear pals,

I have a detailed page and i need to show / hide email and phone number, based on checkbox selection...how can i do that?

Your help is highly appreciated

Fiona
Hi,

Dear folks,

Here is what i want to do and thankfully was able to get answer using thread below with List
https://developer.salesforce.com/forums/ForumsMain?id=9062I000000BjjoQAC
,but now i am rewriting the same code using Map,but am getting error as 
 
Method does not exist or incorrect signature: void get(String) from the type Map
Here is what the end goal is 
 
For example, if s = "zbax" and k = 2, then the resulting integer would be 8 by the following operations:

Convert: "zbax" ➝ "(26)(2)(1)(24)" ➝ "262124" ➝ 262124
Transform #1: 262124 ➝ 2 + 6 + 2 + 1 + 2 + 4 ➝ 17
Transform #2: 17 ➝ 1 + 7 ➝ 8

Here is code with Map
public class SDASMapConvert {
    

    
    
public static Integer returnInteger(String z, integer k){
        Integer retInt;
        String key = 'abcdefghijklmnopqrstuvwxyz';

        List<String>myAlphabets = z.split('');
        Map<String, String> myMap = new Map<String, String>();
        String strarr = '';

       for (integer i = 0; i < myAlphabets.size(); i += 2) {
        myMap.put(myAlphabets[i], myAlphabets[i + 1]);
    }

    for (String s : myMap.keySet()) {
        System.debug(s + ' is ' + map.get(s));
        strarr += string.valueOf(s);
    }
        
        system.debug('strarr --> ' + strarr);
        String s = '';
        for(integer i = 0; i < k ; i++){
            system.debug(' strarr --> ' + strarr);
            Integer total = 0;
            for(String s1 : strarr.split('')){
                total += integer.valueOf(s1);
            }
            system.debug(' total --> ' + total);
            strarr = string.valueOf(total);
        }
        
        system.debug(' ************* ' + strarr);
        if(!string.isEmpty(strarr))
            retInt = integer.valueOf(strarr);
        
        system.debug(' ************* ' + retInt);
        
        return retInt;
    }
    


}

Regards
Fiona
Dear folks,

Here is what i want to do
 
For example, if s = "zbax" and k = 2, then the resulting integer would be 8 by the following operations:

Convert: "zbax" ➝ "(26)(2)(1)(24)" ➝ "262124" ➝ 262124
Transform #1: 262124 ➝ 2 + 6 + 2 + 1 + 2 + 4 ➝ 17
Transform #2: 17 ➝ 1 + 7 ➝ 8



Hence ,Wrote a apex class for To  convert string into an integer by replacing each letter with its position in the alphabet,but it doesnt seems working,error i get on Anonymus Console Window for below command
is 
Line: 14, Column: 1
System.TypeException: Invalid integer: a
Here is anonymous code
SDSAfterConvert.returnInteger();

Here is apex code
 
public class SDSAfterConvert {
    
    
public static List<Integer> returnInteger(){


List<Integer> inputList = new List<Integer>();
             
String[] myAlphabets = new String[]{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'g'};
 
for (String s1 : myAlphabets) {
   
    System.debug(s1);
    Integer d = integer.ValueOf(s1);
    inputList.add(d);
}
        
return inputList;
             
}
    
}



Regards,
Fiona​​​​​​​
 
Dear gurus,

I have a problem where 

GIVEN there is a string of characters, and i need to ivoke a reverse method is invoked such that it returns an array of characters in reversed order for alphanumeric characters only however all other non-alphanumeric characters need to retain their original position -
How to Implement solution in Apex?

I tried below code but no luck
public class assessment {
  public static List<String> reverseSpecialString(String input) {
        List<String> resultList = new List<String>();
         // IMPLEMENT
        resultList = input.split('');
        string reversedString='';
        for(integer i=resultList.size()-1;i>=0;i--)
            {
             
            reversedString=reversedString+resultList[i];
               
            }
    
       
        
        
         return resultList;
      
       }
    
    public static void validateSolution() {
        String input = 'ABC@HI#J2';
        List<String> expected = new List<String> {'2','J','I','@','H','C','#','B','A'};
        List<String> actual = reverseSpecialString(input);
        
        System.assertEquals(expected, actual, 'Invalid Results');
    }
}

Thanks,
Fiona​​​​​​​

 
Dear Pals,

I need to  Fire ShowNavigateToList After ShowToast On Single Save Function Of JS file,somehow only ShowToast working and not the ShowNavigateToList,Here is  what i have written for Save button,basically after the record is Upserted i want the page to move to ListView,what change is needed below
 
onConfirm:function(component, event, helper){
        var picklist=component.find('ddLevel1');
        var picklistvalue=picklist.get('v.value');
        var picklistdep=component.find('ddLevel2');
        var picklistvaluedep2=picklistdep.get('v.value');
        var picklistoldL1=component.get('v.oldL1');
        var picklistoldL2=component.get('v.oldL2');
        var picklistoldL3=component.get('v.oldL3');
        var ertrecordGuid=component.get('v.ertGUID');
        var picklistdep3=component.find('ddLevel3');
        var picklistvaluedep3=picklistdep3.get('v.value');
        var action = component.get("c.savecasetype");
       
        action.setParams({  'level1' : picklistvalue,
                          'level2' : component.get('v.secondlevelselected'),
                          'level3' : picklistvaluedep3,
                          'oldlevel1' : picklistoldL1,
                          'oldlevel2' : picklistoldL2,
                          'oldlevel3' : picklistoldL3,
                          'guid':ertrecordGuid,
                          'id' : component.get("v.recordId")});
        
        
        var toastEvent = $A.get("e.force:showToast");
        action.setCallback(this, function(e) {
            if(e.getState()=='SUCCESS'){
                var result=e.getReturnValue();
                        
                
                if(result==='successfull'){
                    toastEvent.setParams({
                        "title": "Success!",
                        "message": "The record has been Upserted  successfully."
                         
                    });
                    
                    toastEvent.fire();
                   
                }else{
                   
                    toastEvent.setParams({
                        "title": "Error",
                        "message": "The record has not been Upserted  successfully."
                    });
                    toastEvent.fire();
                }
            }
            
            
          
             $A.get('e.force:refreshView').fire(); 
             
        });
        
           var action = component.get("c.getListViews");
    action.setCallback(this, function(response){
        var state = response.getState();
        if (state === "SUCCESS") {
            var listviews = response.getReturnValue();
            var navEvent = $A.get("e.force:navigateToList");
            navEvent.setParams({
                "listViewId": listviews.Id,
                "listViewName": null,
                "scope": "Case"
            });
            navEvent.fire();
        }
    });
        $A.enqueueAction(action);
        
          
        
    }

Here is ListView controller
 
@AuraEnabled 

public static List<ListView> getListViews() { 

    List<ListView> listviews = 

        [SELECT Id, Name FROM ListView WHERE SobjectType = 'Case' and Name='Recently Viewed Cases']; 

  

   

    return listviews; 

}



Your help is needed and appreciated
Regards,
Fiona​​​​​​​

 
Hi Pals,

My code is showing Red for Upsert statement,can someone help me in completing Test apex class write up for Upsert statments below
@isTest
public class ERT_MultiLevelSelectEditTest {
  
  @testSetup static void setup() {
        
    Case_Type_Data__c ct = new Case_Type_Data__c();
    ct.Level_1__c = 'Test Level 1';
    ct.Level_2__c = 'Test Level 2';
    ct.Level_3__c = 'Test Level 3';
    insert ct; 

    }
    
  @isTest
   static  void testGetLevel1()
   {
    
    Case cas = new Case(Status ='New', Priority = 'Medium', Origin = 'Email'); 
    insert cas;
    ERT_Case_Type__c  obj = new ERT_Case_Type__c ();
    obj.Level_1__c = 'Test Level 1';
    obj.Level_2__c = 'Test Level 2';
    obj.Level_3__c = 'Test Level 3';
    obj.Case__c = cas.id;
    upsert obj;
       
   test.startTest();
   List<ERT_MultiLevelSelectEdit.LevelWrapper> lstWrapper= ERT_MultiLevelSelectEdit.getLevel1(obj.id);
   test.stopTest();
   system.assertEquals('Test Level 1', lstWrapper[0].strL1val);
     
   
     
    

   }

  @isTest
   static void testGetLevel2()
   {
   test.startTest();
   List<String> s = ERT_MultiLevelSelectEdit.getLevel2('Test Level 1');
   test.stopTest();
   system.assertEquals('Test Level 2', s[0]);
      
   

   }
    
  @isTest
   static void testGetLevel3()
   {
    test.startTest();
    List<String> s = ERT_MultiLevelSelectEdit.getLevel3('Test Level 1','Test Level 2');
    test.stopTest();
    system.assertEquals('Test Level 3', s[0]);
   }
    
  @isTest 
   static  void testsaveCaseType(){
   
        Case cas = new Case(Status ='New', Priority = 'Medium', Origin = 'Email'); 
        insert cas;
       
        ERT_Case_Type__c obj=new ERT_Case_Type__c();
        string one='one';
        string two='two';
        string three='three';
        test.startTest();
        String testing=ERT_MultiLevelSelectEdit.savecasetype(one,two,three,cas.id);
        test.stopTest();
        system.assertEquals('successfull', testing);
    }
    
 public class LevelWrapper{
        @AuraEnabled
        public string strLevelType{get;set;}
        @AuraEnabled
        public string strL1val{get;set;}
        @AuraEnabled
        public string strL2val{get;set;}
        @AuraEnabled
        public string strL3val{get;set;}
        @AuraEnabled
        public boolean isSelected{get;set;}
        
    }
    
    

}


Here is controller class
public class ERT_MultiLevelSelectEdit {
    @AuraEnabled
    public static List<LevelWrapper> getLevel1(string recID){
        List<String> tempLst1 = new List<String>();
        list<LevelWrapper> lstWrap=new list<LevelWrapper>();
        
        list<ERT_Case_Type__c>  lstertcase=new list<ERT_Case_Type__c>();
        lstertcase=[select id,Level_1__c,Level_2__c,Level_3__c from ERT_Case_Type__c where id=:recID];
        string strL1,strL2,strL3;
        if(lstertcase.size()>0){
            strL1=lstertcase[0].Level_1__c;
            strL2=lstertcase[0].Level_2__c;
            strL3=lstertcase[0].Level_3__c;
        }
        
        for(AggregateResult  ar : [select Level_1__c,COUNT(id) from Case_Type_Data__c  group by Level_1__c]) {
            LevelWrapper obj= new LevelWrapper();
            string strLev1=(string)ar.get('Level_1__c');
            obj.strLevelType='recL1';
            obj.strL1val=strLev1;
            if(strLev1==strL1)
                obj.isSelected=true;
            else
                obj.isSelected=false; 
            lstWrap.add(obj);
            
        }

        for(string ar:getLevel2(strL1)){
            if(strL1!=null){
                LevelWrapper obj= new LevelWrapper();
                
                string strLev2=(string)ar;
                obj.strLevelType='recL2';
                obj.strL2val=strLev2;
                if(strLev2==strL2)
                    obj.isSelected=true;
                else
                    obj.isSelected=false; 
                lstWrap.add(obj);
            }
        }
        
        for(string ar:getLevel3(strL1,strL2)){
            if(strL2!=null){
                LevelWrapper obj= new LevelWrapper();
                
                string strLev2=(string)ar;
                obj.strLevelType='recL3';
                obj.strL3val=strLev2;
                if(strLev2==strL3)
                    obj.isSelected=true;
                else
                    obj.isSelected=false; 
                lstWrap.add(obj);
            }
        }
        System.debug(' wrapper '+lstWrap);
        return lstWrap;
        
        
    } 
    
    @AuraEnabled
    public static List<String> getLevel2(string strName){
        List<String> tempLst2 = new List<String>();
        for(AggregateResult  ar : [select Level_2__c,COUNT(id) from Case_Type_Data__c where Level_1__c=:strName  group by Level_2__c])
        {
            tempLst2.add(''+ar.get('Level_2__c'));
        }
        
        return tempLst2;
        
    } 
    
    @AuraEnabled
    public static List<String> getLevel3(string strName1,string strName2){
        List<String> tempLst3 = new List<String>();
        for(AggregateResult  ar : [select Level_3__c,COUNT(id) from Case_Type_Data__c  where Level_1__c=:strName1 and Level_2__c=:strName2 group by Level_3__c])
        {
            tempLst3.add(''+ar.get('Level_3__c'));
        }
        
        return tempLst3;
        
        
    } 
    
    @AuraEnabled
    public  static String  savecasetype(string level1,string level2,string level3,string id){
        string strMsg='successfull';
        try{
            ERT_Case_Type__c obj=new ERT_Case_Type__c();
            
            System.debug('CASE  = '+ Obj.Case__c); 
            Obj.Level_1__c=level1;
            System.debug('Level1  = '+ Obj.Level_1__c); 
            Obj.Level_2__c=level2;
            System.debug('Level2  = '+ Obj.Level_2__c); 
            Obj.Level_3__c=level3;
            System.debug('Level3  = '+ Obj.Level_3__c);
            List<Case_Type__c> lstCTD = new List<Case_Type__c>();
            lstCTD=[select id,Level_1__c,Level_2__c,Level_3__c from Case_Type__c];
            
            lstCTD[0].Level_1__c=level1;
            
            lstCTD[0].Level_2__c=level2;
            
             lstCTD[0].Level_3__c=level3;
            if(id.startsWithIgnoreCase('500'))
                Obj.Case__c = id;
            
            else
                obj.id=id;
            upsert  obj;
              upsert  lstCTD;
            
          
            
          
            
        }
        
        catch(Exception ex){
            strMsg='error';
        }
        return strMsg;  
    }
    
    public class LevelWrapper{
        @AuraEnabled
        public string strLevelType{get;set;}
        @AuraEnabled
        public string strL1val{get;set;}
        @AuraEnabled
        public string strL2val{get;set;}
        @AuraEnabled
        public string strL3val{get;set;}
        @AuraEnabled
        public boolean isSelected{get;set;}
        
    }
    
    
    
 }

It shows   Red for Upsert statements

User-added image


Thanks
Fiona
 
Hi Gurus,

this is an apex controller code to insert a record,please help me in writing a code to load an existing record and modify it as well
 
public class PickListHandler {
    @AuraEnabled
    public static List<String> getLevel1(){
    List<String> tempLst1 = new List<String>();
        for(AggregateResult  ar : [select Level_1__c,COUNT(id) from Case_Type_Data__c  group by Level_1__c])
    {
        tempLst1.add(''+ar.get('Level_1__c'));
    }

    return tempLst1;
      
      
    } 
    
    @AuraEnabled
    public static List<String> getLevel2(string strName){
    List<String> tempLst2 = new List<String>();
       for(AggregateResult  ar : [select Level_2__c,COUNT(id) from Case_Type_Data__c where Level_1__c=:strName  group by Level_2__c])
    {
       tempLst2.add(''+ar.get('Level_2__c'));
    }

    return tempLst2;
      
    } 
    
    @AuraEnabled
    public static List<String> getLevel3(string strName1,string strName2){
     List<String> tempLst3 = new List<String>();
      for(AggregateResult  ar : [select Level_3__c,COUNT(id) from Case_Type_Data__c  where Level_1__c=:strName1 and Level_2__c=:strName2 group by Level_3__c])
    {
       tempLst3.add(''+ar.get('Level_3__c'));
    }

    return tempLst3;
      
      
    } 
         
     @AuraEnabled
     public  static String  savecasetype(string level1,string level2,string level3,string id){
     string strMsg='successfull';
          try{
     ERT_Case_Type__c obj=new ERT_Case_Type__c();
     Obj.Case__c = id;
     System.debug('CASE  = '+ Obj.Case__c); 
     Obj.Level_1__c=level1;
     System.debug('Level1  = '+ Obj.Level_1__c); 
     Obj.Level_2__c=level2;
     System.debug('Level2  = '+ Obj.Level_2__c); 
     Obj.Level_3__c=level3;
     System.debug('Level3  = '+ Obj.Level_3__c); 
     Insert obj;
  
     }
     
    catch(Exception ex){
            strMsg='error';
        }
     return strMsg;  
}
    
     
    
    

}

Your help is highly appreciated

Regards,
Fiona
Hi Gurus,

I am trying to fetch dependent picklist values by referring 
https://sfdcmonkey.com/2018/08/31/dependent-picklist-lightningselect-lightning-salesforce/
 and 
https://developer.salesforce.com/forums/?id=9060G0000005pt3QAA

Here is problem as you see I see no drop down value in "Country" controlling field 

can some one please help ,in the blog they used contact standard object and here I have used custom object and its API name
which is ERT_Case_Type__c

here is my cmp file
 
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction"
                access="global"
                controller="dependentPicklist_UpdateCtrl">
    <!-- call doInit function on component load -->  
    <aura:handler name="init" value="this" action="{!c.doInit}"/>
    
    <!-- aura attributes-->  
    <aura:attribute name="listControllingValues" type="list" default="[]" description="to store controller field values"/>
    <aura:attribute name="listDependingValues" type="list" default="['--- None ---']" description="to store dependent field values"/>
    <aura:attribute name="listSubDependingValues" type="list" default="['--- None ---']" description="to store dependent field values"/>
    
    <aura:attribute name="depnedentFieldMap" type="map" description="map to store dependent values with controlling value"/>
    <aura:attribute name="subDepnedentFieldMap" type="map" description="map to store sub dependent values with controlling value"/>
    <aura:attribute name="bDisabledDependentFld" type="boolean" default="true"/> 
    <aura:attribute name="bDisabledSubDependentFld" type="boolean" default="true"/> 
    
    
    <aura:attribute name="objDetail" type="ERT_Case_Type__c" default="{'sobjectType' : 'ERT_Case_Type__c'}"/>
    <aura:attribute name="controllingFieldAPI" type="string" default="Level_1__c" description="store field API name of Controller field"/>
    <aura:attribute name="dependingFieldAPI" type="string" default="Level_2__c" description="store field API name of dependent field"/>
    <aura:attribute name="subDependingFieldAPI" type="string" default="Level_3__c" description="store field API name of sub dependent field"/>
    
    <!--Controller Field-->
    <lightning:layoutItem size="12" padding="around-small">    
        <lightning:select name="controllerFld"
                          value="{!v.objDetail.Level_1__c}"
                          label="Country"
                          onchange="{!c.onControllerFieldChange}">
            <aura:iteration items="{!v.listControllingValues}" var="val">
                <option value="{!val}">{!val}</option>
            </aura:iteration>
        </lightning:select>
    </lightning:layoutItem>
    
    <!--Dependent Field-->
    <lightning:layoutItem size="12" padding="around-small">
        <lightning:select name="dependentFld"
                          value="{!v.objDetail.Level_2__c}"
                          label="City"
                          disabled="{!v.bDisabledDependentFld}"
                          onchange="{!c.onSubControllerFieldChange}">
            <aura:iteration items="{!v.listDependingValues}" var="val">
                <option value="{!val}">{!val}</option>
            </aura:iteration>
        </lightning:select>
    </lightning:layoutItem>
    
    <!--sub Dependent Field-->
    <lightning:layoutItem size="12" padding="around-small">
        <lightning:select name="subDependentFld"
                          value="{!v.objDetail.Level_3__c}"
                          label="language"
                          disabled="{!v.bDisabledSubDependentFld}">
            <aura:iteration items="{!v.listSubDependingValues}" var="val">
                <option value="{!val}">{!val}</option>
            </aura:iteration>
        </lightning:select>
    </lightning:layoutItem>
    
</aura:component>
Your help is highly appreciated

Regards,
Fiona

 
Hi Gurus,

Step1--> I have a scenario where, in my dependent picklist, first i am setting values for  picklist Level2 and then selected dependent picklist value in Level3
User-added image

Step2--> Now this time removed selection at Level2 ,automatically Level3 selection also got erased and 

User-added image

Step3--> Click Save

User-added image

Here is problem,that value selected in Step2 getting saved rather than the reset value in step3

I have added code to reset values at 
ui:inputSelectOption
but it seems the reset  values from lightning components are not getting reset and saved rather cached values are getting saved after I click save,

Please help in fixing the code, here is the component code
<aura:component controller="PickListHandler" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
					<!-- Actions-->
					<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
					<aura:handler name="change" value="{!v.pageReference}"
								  action="{!c.onPageReferenceChanged}" />
					<!-- variable-->
					<aura:attribute name="lstLevel1" type="String[]" />
					 <aura:attribute name="lstLevel2" type="String[]" />
					  <aura:attribute name="lstL3" type="String[]" />
					<span> Level 1</span>
					<ui:inputSelect aura:id="ddLevel1" change="{!c.getLvl1}">
						<ui:inputSelectOption label="-Select-" value="true"/>        
						<aura:iteration items="{!v.lstLevel1}" var="value">          
							<ui:inputSelectOption label="{!value}" text="{!value}" />
						</aura:iteration>
					</ui:inputSelect>
					<span>Level 2</span>
					<ui:inputSelect aura:id="ddLevel2"  change="{!c.getSelectedValue}">
						 <ui:inputSelectOption label="-Select-" value="{!v.clrlv1}"/>        
						<aura:iteration items="{!v.lstLevel2}" var="value">          
							<ui:inputSelectOption label="{!value}" text="{!value}" />
						</aura:iteration>
					</ui:inputSelect>
					 <span>Level 3</span>
					<ui:inputSelect aura:id="ddLevel3" >
						<ui:inputSelectOption label="-Select-" value="{!v.clrlv2}"/>        
						<aura:iteration items="{!v.lstL3}" var="value">          
							<ui:inputSelectOption label="{!value}" text="{!value}" />
						</aura:iteration>
					</ui:inputSelect>
				   <lightning:button variant="brand" label="Save" onclick="{!c.onConfirm}" />
				</aura:component>

here is controller  code
({
					   reset1 : function(component, event, helper) {
							component.set("v.clrlvl", "");
						},
						reset2 : function(component, event, helper) {
							component.set("v.clrlv2", "");
						},onPageReferenceChanged: function(cmp, event, helper) {
							$A.get('e.force:refreshView').fire();
						},
						doInit : function(component, event, helper) {
							var action = component.get("c.getLevel1");
							action.setCallback(this, function(e) {
								if(e.getState()=='SUCCESS'){
									var result=e.getReturnValue();
									component.set("v.lstLevel1",result);
								}
							});
							$A.enqueueAction(action);
						},    
						getLvl1:function(component, event, helper){
						   
							var picklist=component.find('ddLevel1');
							var picklistvalue=picklist.get('v.value');
							var action = component.get("c.getLevel2");
							action.setParams({  'strName' : picklistvalue  });
							action.setCallback(this, function(e) {
								if(e.getState()=='SUCCESS'){
									var result=e.getReturnValue();
									component.set("v.lstLevel2",result);
								}
							});
							$A.enqueueAction(action);
								},
						getSelectedValue:function(component, event, helper){
							var picklist=component.find('ddLevel1');
							var picklistvalue=picklist.get('v.value');
							var picklistdep=component.find('ddLevel2');
							var picklistvaluedep2=picklistdep.get('v.value');
							var action = component.get("c.getLevel3");
							action.setParams({  'strName1' : picklistvalue,
											 'strName2' : picklistvaluedep2});//
							action.setCallback(this, function(e) {
								if(e.getState()=='SUCCESS'){
									var result=e.getReturnValue();
									component.set("v.lstL3",result);
								}
							});
							$A.enqueueAction(action);
						},
						onConfirm:function(component, event, helper){
							var picklist=component.find('ddLevel1');
							var picklistvalue=picklist.get('v.value');
							var picklistdep=component.find('ddLevel2');
							var picklistvaluedep2=picklistdep.get('v.value');
						   
							var picklistdep3=component.find('ddLevel3');
							var picklistvaluedep3=picklistdep3.get('v.value');
							var action = component.get("c.savecasetype");
							
							action.setParams({  'level1' : picklistvalue,
											  'level2' : picklistvaluedep2,
											  'level3' : picklistvaluedep3,
											  'id' : component.get("v.recordId")});
											  
							
							var toastEvent = $A.get("e.force:showToast");
							action.setCallback(this, function(e) {
								if(e.getState()=='SUCCESS'){
									var result=e.getReturnValue();
									if(result==='successfull'){
										toastEvent.setParams({
											"title": "Success!",
											"message": "The record has been inserted  successfully."
										});
										toastEvent.fire();
									}else{
										toastEvent.setParams({
											"title": "Error",
											"message": "The record has not been inserted  successfully."
										});
										toastEvent.fire();
									}
								}
							});
							$A.enqueueAction(action);
						   
						}
					})

Your help is highy appreciated

Regards,
Fiona

 
Dear gurus,

I would like to know if there is possibility of writing a SOQL similar like we do in SQL
like Distinct of Level_1__c,Level_2__c and Level_3__c

Currently SOQL is 
    
select Case__c, Level_1__c, Level_2__c,Level_3__c  FROM ERT_Case_Type__c



How to rewrite to include Distinct of Level_1__c,Level_2__c and Level_3__c

Thanks & Regards,
Fiona
Hi Gurus,

Need a Test class for Batchable class with database.insert function then saves the results and iterate through each results 
 
global void execute(Database.BatchableContext BC, List<ERT_Case_Type__c> exeList) {
						
						// process each batch of records
						List<Case_Type__c> listCTD = new List<Case_Type__c>();
						System.debug('ERT Case No is =====>' +exeList);
						for(ERT_Case_Type__c exe : exeList)
						{        
							listCTD.add(new Case_Type__c(Case__c=exe.Case__c,Level_1__c=exe.Level_1__c,Level_2__c=exe.Level_2__c,Level_3__c=exe.Level_3__c));
							// System.debug('ERT Case No is =====>' +Case__c);
						}

						System.debug('ERT Case No is =====>' +listCTD);
						insert listCTD;
						
						
						Database.SaveResult[] srList = Database.insert(listCTD, false);
						
						// Iterate through each returned result
						for (Database.SaveResult sr : srList) {
							if (sr.isSuccess()) {
								// Operation was successful, so get the ID of the record that was processed
								System.debug('Successfully inserted Case_Type__c: ' + sr.getId());
							}
							else {
								// Operation failed, so get all errors                
								for(Database.Error err : sr.getErrors()) {
									System.debug('The following error has occurred.');                    
									System.debug(err.getStatusCode() + ': ' + err.getMessage());
									System.debug('Case_Type__c fields that affected this error: ' + err.getFields());
								}
							}
						}            
						
					}   
					
					global void finish(Database.BatchableContext BC) {
						// execute any post-processing operations
					}
				}

 
Dear gurus,

I have custom object1 named Case_Type_Data__c with Level_1__c, Level_2__c,Level_3__c
and i have another custom object2 named  ERT_Case_Type__c with same fields Level_1__c, Level_2__c,Level_3__c

A batch copied data from ERT_Case_Type__c to Case_Type_Data__c

Now i try to write SOQL in workbench to find out which records didnt get copied
 
Select Level_1__c,Level_2__c,Level_3__c From Case_Type_Data__c Where Level_3__c NOT IN (Select Level_3__c From ERT_Case_Type__c)

Workbench throws error
MALFORMED_QUERY: semi join sub selects can only query id fields, cannot use: 'Level_3__c'
Please note Id of ERT_Case_Type__c and Id of Case_Type_Data__c doesnt matches hence cant use Id

Please provide me a Join SOQL to get records which didn't got copied from ERT_Case_Type__c to Case_Type_Data__c
Regards
Fiona
 
Hi Gurus,
I need to build out a solution to create a search field on the new Case Type Data object in all 3 of the Level fields and populate based on selection.

Similar to SF Global Search I  would like to type 2-3 characters in the text search field and it would find the matching text in the Level1-3 fields and when selected the Level 1-3 field would populate.

What do I need to do to achieve thisUser-added image
Regards,
Fiona
Hi ,

Please help in writing a test class for below Schedulable class
 
global class CopyERTBatchDaily implements Schedulable {
  global void execute(SchedulableContext sc) {
//  batchable b = new batchable(); 
      // your batch class
  CopyERTBatch bbb= new copyertbatch();
  database.executebatch(bbb);
  }
}

Regards
Fiona
Dear gurus,

How do i setup this batch job to execute at 6am PST Mon tuesday wed thursday
 
global class CopyExecutive_RTBatch implements Database.Batchable<sObject> {
  
    global Database.QueryLocator start(Database.BatchableContext BC) {
        // collect the batches of records or objects to be passed to execute
        
        String query = 'select Case__c, Level_1__c, Level_2__c,Level_3__c  FROM Executive_RT_Case_Type__c';
        return Database.getQueryLocator(query);
    }
    
    global void execute(Database.BatchableContext BC, List<Executive_RT_Case_Type__c> exeList) {
       
        // process each batch of records
List<Case_Type__c> listCTD = new List<Case_Type__c>();
        
        for(Executive_RT_Case_Type__c exe : exeList)
        {        
           	listCTD.add(new Case_Type__c(Case__c=exe.Case__c,Level_1__c=exe.Level_1__c,Level_2__c=exe.Level_2__c,Level_3__c=exe.Level_3__c));
            //System.debug('Executive_RT Case No is =====>' +Case__c);
        }
        try {
        	
            insExecutive_RT listCTD;
        
        } catch(Exception e) {
            System.debug(e);
        }
        
    }   
    
    global void finish(Database.BatchableContext BC) {
    	// execute any post-processing operations
  }
}

Thanks,
Fiona

 
Hi Gurus,

Please help me in writng a test class for scheduled batch apex below ,i want 100% code coverage please
 
global class ERTExtract255BatchClass implements Database.Batchable<sObject>, Database.Stateful {
    global Database.QueryLocator start(Database.BatchableContext bc) {
        return Database.getQueryLocator(
            'SELECT ID,Description,Case_Desc_255__c FROM Case' 
        );
    }
    global void execute(Database.BatchableContext bc, List<Case> scope){
        // process each batch of record
        List<Case> lstCase = new List<Case>();       
        for (Case cas : scope) {
            cas.Case_Desc_255__c = cas.Description.Left(255);
            lstCase.add(cas);  
        }   
        update lstCase;
    }   
    global void finish(Database.BatchableContext bc){
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
       
    
      AsyncApexJob a = [Select a.TotalJobItems, a.Status, a.NumberOfErrors,
      a.JobType, a.JobItemsProcessed, a.ExtendedStatus, a.CreatedById,
      a.CompletedDate From AsyncApexJob a WHERE id = :BC.getJobId()];
       
      // below code will send an email to User about the status
      String[] email = new String[]{'.com'};
      mail.setToAddresses(email);
      mail.setReplyTo('abc@gmail.com'); 
      mail.setSenderDisplayName('ERT Extract First 255 Char Batch Processing');
      mail.setSubject('Batch Processing '+a.Status);
      mail.setPlainTextBody('The Batch Apex job processed '+ a.TotalJobItems+'batches with '+a.NumberOfErrors+'failures '+'Job Item processed are '+a.JobItemsProcessed);
      Messaging.sendEmail(new Messaging.Singleemailmessage [] {mail});
    }   
     
}

Thanks,
Fiona​​​​​​​



 
i have created a Junction object as below
User-added image

But when I type below query I don't see data why?
select Id from Case_ERT_Junc__c
User-added image
Dear Friends,
Need a help in writing Batch Job that takes the first 255 characters from the existing long description field and  populates it into the new description field

Basically a batch job to copy first 255 characters from Case_Desc and update it to Case_Desc_255__c

Your help is highly appreciated

Regards,
Fiona