LiJinHuan
2023-04-26 8b05a8455721531d0f06991fbd6266bca28eeb59
force-app/main/default/classes/lexPCLLostReportLwcController.cls
@@ -353,6 +353,29 @@
      return dataCheck;
   }
   @AuraEnabled
   public static String searchBrands(){
      String ObjectApi_name = 'PCLLostBrand__c';
      String Field_name = 'Lost_By_Company__c';
        //From the Object Api name retrieving the SObject
        Schema.SObjectType targetType = Schema.getGlobalDescribe().get(ObjectApi_name);
        Sobject Object_name = targetType.newSObject();
         //grab the sobject that was passed
        Schema.sObjectType sobject_type = Object_name.getSObjectType();
        //describe the sobject
        Schema.DescribeSObjectResult sobject_describe = sobject_type.getDescribe();
         //get a map of fields for the passed sobject
        Map<String, Schema.SObjectField> field_map = sobject_describe.fields.getMap();
        //grab the list of picklist values for the passed field on the sobject
        List<Schema.PicklistEntry> pick_list_values = field_map.get(Field_name).getDescribe().getPickListValues();
        List<Map<String, Object>> lstPickvals = new List<Map<String, Object>>();
        for (Schema.PicklistEntry a : pick_list_values)
        { //for all values in the picklist list
         lstPickvals.add(new Map<String, Object>{'label' => a.getValue(), 'value' => a.getValue()});
        }
      String jsonStr = JSON.serialize(lstPickvals);
        return jsonStr;
   }
   @AuraEnabled
   public static list<LostBrand> brandcopy(){
      list<LostBrand> tempbrands = new list<LostBrand>();
      for(LostBrand tempbrand: LostReport.LostBrands) {