• OFröhlich
  • NEWBIE
  • 160 Points
  • Member since 2018
  • Vaillant Group Business Services GmbH

  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 32
    Replies
Hi All,
I have a requirement to search Course Name in Visual force page.
I have to return all Training Deal Object values based on the course name entered in the search field value.
Course Master: Master Table
Training Deal:Detail Table

Training Deal has a master-detail datatype Course__c field
when I query the Training Deal table I get RecordID of the Course__c field instead of the Course Code value.
How to pass this RecordID in the query to Course Master and get the search results.
I have tried many combinations in below apex class....sorry for the messy looking queries..
VF Page
<apex:page controller="searchname1">
  <apex:form >
   <apex:pageblock id="one" >
    <apex:pageblockSection >
    <apex:pageblocksectionitem >
       <apex:outputlabel >Course to Search</apex:outputlabel>
         <apex:inputtext value="{!name}"/>
         </apex:pageblocksectionitem>
         <apex:commandButton value="go" action="{!search}"/>
          </apex:pageblockSection>
           </apex:pageBlock> 
           <apex:pageBlock rendered="{!searched}" >
            <apex:pageblocktable value="{!lstcourse}" var="c">
            <apex:column value="{!c.Name}"/>
             <apex:column value="{!c.Course_Name__c}"/>
            </apex:pageblocktable>
            <apex:pageblockbuttons >
             <apex:commandButton value="edit" action="{!edit}"/>
            </apex:pageblockbuttons>
               </apex:pageblock>
  </apex:form>
</apex:page>

Apex Class:

public with sharing class searchname1 {

    public PageReference edit() {
       
        return null;
    }


   
   public String name { get; set; }
    public list<Training_Deal__c> lstdeal { get; set; }
    public list<Course_Master__c> lstcourse { get; set; }
    
    public boolean searched{get;set;}
    
    //default constructor
    public searchname1(){
    searched=false;
    string namestr=apexpages.currentpage().getparameters().get('name');
    if(null!=namestr){
    name=namestr;
    }
    }
    public PageReference search() {
    searched=true;
     string searchstr1=('%'+name+'%');
      lstdeal=[select Name,Course__c from Training_Deal__c ];
      //lstcourse=[select Name,Course_Name__c from Course_Master__c where ID=:Training_Deal__c.Course__c];
    /* lstcourse= [select Name,Course_Name__c from Course_Master__c 
                 where Course_Name__c like :searchstr1 limit 10 ];
     for(Course_Master__c crs:lstcourse )
     {
         //coursecode=crs.Id
         lstdeal=[select Name,Course__c from Training_Deal__c where Course__c LIKE :crs.Course_Name__c ];
     }
     */
    //lstdeal=[select Name,Course__c from Training_Deal__c where Course__c like searchstr1 limit 10 ];
        return null;
    }


    
}



 
  • July 11, 2021
  • Like
  • 0
HI,I HAVE A REQUIREMENT WHICH STATES THAT IF Account.Agreement_type__c AND Opportunity.Agreement_type__c IS NOT BLANK AND IF BOTH THE VALUES ARE THE SAME THEN RETURN 1 OR ELSE 0.

IF(NOT(ISBLANK(Account.Agreement_type__c)) AND NOT(ISBLANK(Opportunity.Agreement_type__c)) 
AND (TEXT(Account.Agreement_type__c) == TEXT(Opportunity.Agreement_type__c)),1,0)


I'M GETTING A ERROR AS MISSING ) AND DON'T KNOW WHETHER THIS CODES WORKS AS PER MY REQUIREMENT OR NOT.
CAN ANYONE GUIDE ME
Hey developers,

I'm little confused trying to access a field in this object, could you help me? 

I have the following sentence in the code:

Map<String, Object> tester = exampleFunction();

When I get the response using "system.debug(tester)" I get the following structure:

{cartId=222222XX, 
messages=(cc_bean_Message:[classToAppend=couponMessagingSection-Error, 
labelId=CouponAddMsg_MaxUseExceeded, 
messageId=null])
}

What I am trying to access is the value of "labelId", how can I do this? 
@RestResource(urlMapping = '/OrdermasterUpdate1/*')
global with sharing class OrdermasterUpdate1 {
    string message;
    boolean status;
    id recordID;
    @httpPost
    global static ordermaster__c dopost(){
        OrdermasterUpdate1 response = new OrdermasterUpdate1();
        id productid = null;
        ordermaster__c s3 = new ordermaster__c();
        ordermaster__c s2 = new ordermaster__c();
      RestRequest req = RestContext.request;
      RestResponse res = Restcontext.response;
        Integer i = 0;
               i++;
            i++;
            i++;
            i++;   
            i++;
            i++;
            i++;
            i++;
            i++;
          
            i++;
            i++;
            i++;
            i++;
            i++;
            i++;
            i++;
            i++;
            i++;
        string requestBody = restContext.request.requestBody.toString();
        list<ordermasterwrapper> u1 = (list<ordermasterwrapper>)JSON.deserializeStrict(requestBody, list<ordermasterwrapper>.class); 
        for(ordermasterwrapper oi : u1){
            List<ordermaster__c> s = new List<ordermaster__c>();
            s =[select problem_box_number__c,selected_for_process_time__c,selected_for_process_by__c,selected_for_process_box__c,processing_box_number__c,retail_approved_by__c,
        receiveddate__c,transction_id__c,id__c,website_id__c,company_id__c,custom_order_id__c,channel_order_id__c,customer_id__c
        ,customer_name__c,payment_method_name__c,payment_date__c,billing_name__c,billing_company__c,billing_email_address__c,billing_street_address__c,billing_city__c,billing_postcode__c,billing_state__c
        ,billing_country__c,billing_phone__c,billing_fax__c,delivery_name__c,delivery_email_address__c,delivery_street_address__c,delivery_city__c,delivery_postcode__c,delivery_state__c,
         delivery_country__c,delivery_phone__c,shippingdate__c,delivery_fax__c,net_amount__c,shipping_cost__c,paid_amount__c,gross_discount_amount__c,tax_amount__c,order_status__c,currency_code__c,ip_address__c
        ,created_date__c,bonusdate__c,is_mail__c,response_msg__c,send_notes__c,received_amount__c,assign_to__c,assign_wh__c,pay_txnTranID__c,ordertype__c,additionalshiipingtax_amount__c,member_discount__c
        ,cart_discount__c,delivery_father_name__c,delivery_grndfather_name__c,refund_stock__c,doll_to_iqd__c,eqipped_date__c,cancel_date__c,ready_for_shipment__c,is_replacement__c
        ,is_acknowledged__c,not_received_note__c,gen_note__c,gen_note_admin_uid__c,cancel_note__c,cancel_note_admin_uid__c,not_receive_date__c,replace_date__c,ready_to_ship_uid__c,ship_uid__c
        ,receive_uid__c,not_receive_uid__c,replacement_uid__c,is_problem__c,problemdate__c,is_returned__c,is_confirmed__c,returndate__c,replaced_status__c,replacementcount__c,probflag__c
        ,coupon_discount__c,coupon_id__c,shipment_waiting__c,waiting_invoice__c,waiting_reason__c,delivery_user__c,waiting_date__c,notification_send__c,device_token__c,device_type__c
        ,replaced_cancel_note__c,replaced_cancel_note_admin_uid__c,replaced_cancel_date__c,admin_viewed_waiting__c,assembly_confirm__c,remove_from_lottery__c
        ,equipped_cancelled__c,old_order_id__c,old_ship_cost__c,old_gt__c,new_order_id__c,reviews_given__c,points_received__c,points_conversion_value__c,review_points_percentage__c,retail_price__c
        ,retail_installation_price__c,retail_approve_date__c,order_retail_ratio__c,total_retail_emi__c,retail_emi_paid__c,retail_emi_deadline__c,first_retail_payment_date__c
        ,last_retail_payment_date__c,retail_selary__c,down_payment__c,shipping_code__c,shipping_addresses_id__c,neighborhood__c,delevery_name__c,delevery_phonenumber__c,delevery_reason__c
        ,refund_shipping_cost_onreturn__c,delevery_ammont_usd__c,delevery_ammont_iqd__c,received_latitude__c,received_longitude__c from ordermaster__c where id__c =: oi.id];
        if(s.size()>0){ 
                 productid = s.get(0).id;
            s.get(0).transction_id__c = oi.transction_id;
            s.get(0).id__c = oi.id;          
            s.get(0).customer_id__c = oi.customer_id;
            s.get(0).customer_name__c = oi.customer_name;
            s.get(0).payment_method_name__c = oi.payment_method_name;
            s.get(0).payment_date__c = oi.payment_date;
            s.get(0).billing_name__c = oi.billing_name;
            s.get(0).billing_company__c = oi.billing_company;
            s.get(0).billing_email_address__c = oi.billing_email_address;
            s.get(0).billing_street_address__c = oi.billing_street_address;
            s.get(0).billing_city__c = oi.billing_city;
            s.get(0).billing_postcode__c = oi.billing_postcode;
            s.get(0).billing_state__c = oi.billing_state;
            s.get(0).billing_country__c = oi.billing_country;
            s.get(0).billing_phone__c = oi.billing_phone;
            s.get(0).billing_fax__c = oi.billing_fax;
            s.get(0).delivery_name__c = oi.delivery_name;
            s.get(0).delivery_email_address__c = oi.delivery_email_address;
            s.get(0).delivery_street_address__c = oi.delivery_street_address;
            s.get(0).delivery_city__c = oi.delivery_city;
            s.get(0).delivery_postcode__c = oi.delivery_postcode;
            s.get(0).delivery_state__c = oi.delivery_state;
               s.get(0).delivery_country__c = oi.delivery_country;
            s.get(0).delivery_phone__c = oi.delivery_phone;
            s.get(0).shippingdate__c = oi.shippingdate;
            s.get(0).delivery_fax__c = oi.delivery_fax;
            s.get(0).net_amount__c = oi.net_amount;
            s.get(0).shipping_cost__c = oi.shipping_cost;
            s.get(0).paid_amount__c = oi.paid_amount;
            s.get(0).gross_discount_amount__c = oi.gross_discount_amount;
            s.get(0).tax_amount__c = oi.tax_amount;
            s.get(0).order_status__c = oi.order_status;
            s.get(0).currency_code__c = oi.currency_code;
            s.get(0).ip_address__c = oi.ip_address;
            s.get(0).created_date__c = oi.created_date;
            s.get(0).problem_box_number__c = oi.problem_box_number;
                try{
                update s.get(0);
                response.status=true;
                response.message='Product Updated Successfully';
            }catch(exception e){
                response.status=false; 
                response.message = 'Failed';
            }
            
            }else{
                 ordermaster__c o1 = new ordermaster__c();
            o1.transction_id__c = oi.transction_id;
            o1.id__c = oi.id;
            o1.website_id__c = oi.website_id;
            o1.company_id__c = oi.company_id;
            o1.custom_order_id__c = oi.custom_order_id;
            o1.channel_order_id__c = oi.channel_order_id;
            o1.customer_id__c = oi.customer_id;
            o1.delivery_name__c = oi.delivery_name;
            o1.delivery_email_address__c = oi.delivery_email_address;
            o1.delivery_street_address__c = oi.delivery_street_address;
            o1.delivery_city__c = oi.delivery_city;
            o1.delivery_postcode__c = oi.delivery_postcode;
            o1.delivery_state__c = oi.delivery_state;       
            o1.gross_discount_amount__c = oi.gross_discount_amount;   
            o1.response_msg__c = oi.response_msg;
            o1.send_notes__c = oi.send_notes;
            o1.received_amount__c = oi.received_amount;
            o1.assign_to__c = oi.assign_to;
            o1.assign_wh__c = oi.assign_wh;
            o1.pay_txnTranID__c = oi.pay_txnTranID;
            o1.ordertype__c = oi.ordertype;
            o1.additionalshiipingtax_amount__c = oi.additionalshiipingtax_amount;
            o1.member_discount__c = oi.member_discount;
            o1.cart_discount__c = oi.cart_discount;
            o1.delivery_father_name__c = oi.delivery_father_name;
            o1.delivery_grndfather_name__c = oi.delivery_grndfather_name;
            o1.refund_stock__c = oi.refund_stock;
            o1.doll_to_iqd__c = oi.doll_to_iqd;
            o1.eqipped_date__c = oi.eqipped_date;
            o1.cancel_date__c = oi.cancel_date;
            o1.ready_for_shipment__c = oi.ready_for_shipment;
            o1.is_replacement__c = oi.is_replacement;
            o1.is_acknowledged__c = oi.is_acknowledged;
            o1.replaced_cancel_note__c = oi.replaced_cancel_note;
            o1.replaced_cancel_note_admin_uid__c = oi.replaced_cancel_note_admin_uid;
              o1.replaced_cancel_date__c = oi.replaced_cancel_date;
            o1.admin_viewed_waiting__c = oi.admin_viewed_waiting;
            o1.assembly_confirm__c = oi.assembly_confirm;
            o1.remove_from_lottery__c = oi.remove_from_lottery;
                o1.selected_for_process_time__c = oi.selected_for_process_time;
                o1.problem_box_number__c = oi.problem_box_number;
            try{
                insert o1;
                response.status=true;
                response.message='Product Updated Successfully';
            }catch(exception e){
                response.status=false; 
                response.message = 'Failed';
            }
   
        }
            }
         return s3;
        
    }
    global class ordermasterwrapper{
        public double problem_box_number{get;set;}
        public datetime selected_for_process_time{get;set;}
        public integer selected_for_process_by{get;set;}
        public integer selected_for_process_box{get;set;}
        public double processing_box_number{get;set;}
        public double retail_approved_by{get;set;}
        public datetime receiveddate{get;set;}
        public string transction_id{get;set;}
        public double id{get;set;}
        public double website_id{get;set;}
        public double company_id{get;set;}
        public string custom_order_id{get;set;}
        public string channel_order_id{get;set;}
        public integer customer_id{get;set;}
        public string customer_name{get;set;}
        public string payment_method_name{get;set;}
        public datetime payment_date{get;set;}
        public string billing_name{get;set;}
        public string billing_company{get;set;}
        public string billing_email_address{get;set;}
        public string billing_street_address{get;set;}
        public double billing_city{get;set;}
        public string billing_postcode{get;set;}
        public string billing_state{get;set;}
        public integer billing_country{get;set;}
        public string billing_phone{get;set;}
        public string billing_fax{get;set;}
        public string delivery_name{get;set;}
        public string delivery_email_address{get;set;}
        public string delivery_street_address{get;set;}
        public integer delivery_city{get;set;}
        public string delivery_postcode{get;set;}
        public string delivery_state{get;set;}
        public integer delivery_country{get;set;}
        public string delivery_phone{get;set;}
        public datetime shippingdate{get;set;}
        public string delivery_fax{get;set;}
        public double net_amount{get;set;}
        public double shipping_cost{get;set;}
        public double paid_amount{get;set;}
        public double gross_discount_amount{get;set;}
        public double tax_amount{get;set;}
        public integer order_status{get;set;}
        public string currency_code{get;set;}
        public string ip_address{get;set;}
        public datetime created_date{get;set;}
        public datetime bonusdate{get;set;}
        public double is_mail{get;set;}
        public string response_msg{get;set;}
        public string send_notes{get;set;}
        public decimal received_amount{get;set;}
        public integer assign_to{get;set;}
        public integer assign_wh{get;set;}
        public string pay_txnTranID{get;set;}
        public string ordertype{get;set;}
        public decimal additionalshiipingtax_amount{get;set;}
        public decimal member_discount{get;set;}
        public decimal cart_discount{get;set;}
        public string delivery_father_name{get;set;}
        public string delivery_grndfather_name{get;set;}
        public integer refund_stock{get;set;}
        public decimal doll_to_iqd{get;set;}
        public datetime eqipped_date{get;set;}
        public datetime cancel_date{get;set;}
        public datetime ready_for_shipment{get;set;}
        public integer is_replacement{get;set;}
        public integer is_acknowledged{get;set;}
        public string not_received_note{get;set;}
        public string gen_note{get;set;}
        public double gen_note_admin_uid{get;set;}
        public string cancel_note{get;set;}
        public double cancel_note_admin_uid{get;set;}
        public datetime not_receive_date{get;set;}
        public datetime replace_date{get;set;}
        public double ready_to_ship_uid{get;set;}
        public double ship_uid{get;set;}
        public double receive_uid{get;set;}
        public double not_receive_uid{get;set;}
        public double replacement_uid{get;set;}
        public integer is_problem{get;set;}
        public datetime problemdate{get;set;}
        public integer is_returned{get;set;}
        public integer is_confirmed{get;set;}
        public datetime returndate{get;set;}
        public integer replaced_status{get;set;}
        public integer replacementcount{get;set;}
        public integer probflag{get;set;}
        public decimal coupon_discount{get;set;}
        public double coupon_id{get;set;}
        public integer shipment_waiting{get;set;}
        public double waiting_invoice{get;set;}
        public string waiting_reason{get;set;}
        public double delivery_user{get;set;}
        public datetime waiting_date{get;set;}
        public integer notification_send{get;set;}
        public string device_token{get;set;}
        public string device_type{get;set;}
        public string replaced_cancel_note{get;set;}
        public double replaced_cancel_note_admin_uid{get;set;}
        public datetime replaced_cancel_date{get;set;}
        public integer admin_viewed_waiting{get;set;}
        public integer assembly_confirm{get;set;}
        public integer remove_from_lottery{get;set;}
        public integer equipped_cancelled{get;set;}
        public integer old_order_id{get;set;}
        public decimal old_ship_cost{get;set;}
        public decimal old_gt{get;set;}
        public double new_order_id{get;set;}
        public integer reviews_given{get;set;}
        public integer points_received{get;set;}
        public integer points_conversion_value{get;set;}
        public integer review_points_percentage{get;set;}
        public decimal retail_price{get;set;}
        public decimal retail_installation_price{get;set;}
        public datetime retail_approve_date{get;set;}
        public integer order_retail_ratio{get;set;}
        public integer total_retail_emi{get;set;}
        public integer retail_emi_paid{get;set;}
        public datetime retail_emi_deadline{get;set;}
        public datetime first_retail_payment_date{get;set;}
        public datetime last_retail_payment_date{get;set;}
        public string retail_selary{get;set;}    
        public decimal down_payment{get;set;}
        public string shipping_code{get;set;}
        public integer shipping_addresses_id{get;set;}
        public integer neighborhood{get;set;}
        public string delevery_name{get;set;}
        public string delevery_phonenumber{get;set;}
        public string delevery_reason{get;set;}
        public integer refund_shipping_cost_onreturn{get;set;}
        public integer delevery_ammont_usd{get;set;}
        public integer delevery_ammont_iqd{get;set;}
        public string received_latitude{get;set;}
        public string received_longitude{get;set;}
    }
}

 
Is there an easy way to count how many times some text or substring appears in an apex string variable?  So if a a varibale holds "The quick brown fox jumps over the lazy dog"  i want to find how many times fox appears in this string.
  • November 13, 2019
  • Like
  • 0
How can I change the send from for case escalation email notifications. Is it the primary contact users email address? Is there another way, than changing the primary contact.
Hi,
I'm trying to send a push notification to the standard salesforce app (salesforce for android) by an apex class. Notifications from chatter or approvals work fine.
Enclosed my test code and the error message I get. Any ideas what's the right API name for salesforce for android? Chatter_for_Android does not work.

Messaging.PushNotification msg = new Messaging.PushNotification();
Map<String, Object> androidPayload = new Map<String, Object>();
androidPayload.put('number', 1);
androidPayload.put('name', 'test');
msg.setPayload(androidPayload);
String userId1 = '005200000016UYe';
Set<String> users = new Set<String>();
users.add(userId1);                      
msg.send('Chatter_for_android', users);

13:15:40.21 (22939313)|PUSH_NOTIFICATION_INVALID_APP||Chatter_for_Android 13:15:40.21 (23141398)|SYSTEM_MODE_EXIT|false 13:15:40.21 (23282513)|FATAL_ERROR|System.NoAccessException: Invalid connected application: Chatter_for_Android Class.Messaging.PushNotification.send: line 28, column 1 AnonymousBlock: line 9, column 1 AnonymousBlock: line 9, column 1
When a Vacation_Package__c is created if Package_Type = 'Select,  set the Balance_Type to 'Nights' and set Sales_Company__c to 'Upgrade Sales'.  Upgrade Sales is an Account Record, this is a lookup field.

I am wondering why my SOQL search in the test class does not show any rows.  WHen I do a system.debug I can see that records are created, but my SOQL is not getting results.
 
trigger SelectVacationPackage on Vacation_Package__c (before insert, before update) {
List<Vacation_Package__c> PackagesToUpdate = new List<Vacation_Package__c>();
   
    List<Vacation_Package__c> WorkingPackages = [SELECT Id, Package_Type__c, Sales_Company__c, Package_Status__c
 FROM Vacation_Package__c WHERE Id In :Trigger.New];
   
   
    for(Vacation_Package__c vp: WorkingPackages){        
            if(vp.Package_Type__c == 'Select' && vp.Package_Status__c != 'Canceled'){
      PackagesToUpdate.add(vp);
        }
}
 
    for (Vacation_Package__c vsp : PackagesToUpdate){
     
        vsp.Sales_Company__c = [Select ID from Account WHERE Name = 'Upgrade Sales'].id;
        vsp.Balance_Type__c = 'Nights';
    }

        upsert PackagesToUpdate;      
  
}
@isTest
private class SelectVacationPackageTest {
private static testMethod void SelectVacations(){
   
        Account newAcc = FlowTestUtils.createHouseholdAccount();
        newAcc.Name = 'Upgrade Sales';
    	insert newAcc;
       
        Product2 newProd = new Product2();
        newProd.Name = 'Testing';
    	newProd.Family = 'Sub-Type';
        newProd.Select_Package_Sub_Type__c = True;
        insert newProd;
       
  List<Vacation_Package__c> packList = new List<Vacation_Package__c>();

       
        Vacation_Package__c vacPac = new Vacation_Package__c();
        vacPac.Service_Charge_Frequency__c = 'Annual';
        vacPac.Service_Charge_Start_Date__c = Date.today().addMonths(1).toStartofMonth();
        vacPac.Package_Type__c = 'Select';
        vacPac.Package_Status__c = 'Draft';
        vacPac.Household__c = newAcc.id;
        vacPac.Sale_Date__c = Date.today().addMonths(1).toStartofMonth();
        vacPac.Package_Sub_Type__c = newProd.Id;
       
        packList.add(vacPac);
           
        Vacation_Package__c vacPac1 = new Vacation_Package__c();
        vacPac1.Service_Charge_Frequency__c = 'Annual';
        vacPac1.Service_Charge_Start_Date__c = Date.today().addMonths(1).toStartofMonth();
        vacPac1.Package_Type__c = 'Full';
        vacPac1.Package_Status__c = 'Draft';
        vacPac1.Household__c = newAcc.id;
        vacPac1.Sale_Date__c = Date.today().addMonths(1).toStartofMonth();    
        vacPac1.Package_Sub_Type__c = newProd.Id;
        packList.add(vacPac1);

    System.debug('vacPac' + vacPac);
    System.debug('vacPac1' + vacPac1);
  //both debugs show new records as expected
    
        Test.startTest();
        upsert packList;
        Test.stopTest();
       
    
    Account testAcc = [SELECT Name FROM Account WHERE Id=:vacPac.Id Limit 1];
    System.debug('Testing Acc' + test);
//No results for testAcc   

       /*
       //I am receiving the error here:

		System.assertEquals('Upgrade Sales', [SELECT Name FROM Account WHERE Id=:vacPac.Id Limit 1].Name);  
		System.assertNotEquals('Upgrade Sales', [SELECT Name FROM Account WHERE Id=:vacPac1.Id Limit 1].Name);        
      	
*/
    }
}




 
Hi All,
I have a requirement to search Course Name in Visual force page.
I have to return all Training Deal Object values based on the course name entered in the search field value.
Course Master: Master Table
Training Deal:Detail Table

Training Deal has a master-detail datatype Course__c field
when I query the Training Deal table I get RecordID of the Course__c field instead of the Course Code value.
How to pass this RecordID in the query to Course Master and get the search results.
I have tried many combinations in below apex class....sorry for the messy looking queries..
VF Page
<apex:page controller="searchname1">
  <apex:form >
   <apex:pageblock id="one" >
    <apex:pageblockSection >
    <apex:pageblocksectionitem >
       <apex:outputlabel >Course to Search</apex:outputlabel>
         <apex:inputtext value="{!name}"/>
         </apex:pageblocksectionitem>
         <apex:commandButton value="go" action="{!search}"/>
          </apex:pageblockSection>
           </apex:pageBlock> 
           <apex:pageBlock rendered="{!searched}" >
            <apex:pageblocktable value="{!lstcourse}" var="c">
            <apex:column value="{!c.Name}"/>
             <apex:column value="{!c.Course_Name__c}"/>
            </apex:pageblocktable>
            <apex:pageblockbuttons >
             <apex:commandButton value="edit" action="{!edit}"/>
            </apex:pageblockbuttons>
               </apex:pageblock>
  </apex:form>
</apex:page>

Apex Class:

public with sharing class searchname1 {

    public PageReference edit() {
       
        return null;
    }


   
   public String name { get; set; }
    public list<Training_Deal__c> lstdeal { get; set; }
    public list<Course_Master__c> lstcourse { get; set; }
    
    public boolean searched{get;set;}
    
    //default constructor
    public searchname1(){
    searched=false;
    string namestr=apexpages.currentpage().getparameters().get('name');
    if(null!=namestr){
    name=namestr;
    }
    }
    public PageReference search() {
    searched=true;
     string searchstr1=('%'+name+'%');
      lstdeal=[select Name,Course__c from Training_Deal__c ];
      //lstcourse=[select Name,Course_Name__c from Course_Master__c where ID=:Training_Deal__c.Course__c];
    /* lstcourse= [select Name,Course_Name__c from Course_Master__c 
                 where Course_Name__c like :searchstr1 limit 10 ];
     for(Course_Master__c crs:lstcourse )
     {
         //coursecode=crs.Id
         lstdeal=[select Name,Course__c from Training_Deal__c where Course__c LIKE :crs.Course_Name__c ];
     }
     */
    //lstdeal=[select Name,Course__c from Training_Deal__c where Course__c like searchstr1 limit 10 ];
        return null;
    }


    
}



 
  • July 11, 2021
  • Like
  • 0
HI,I HAVE A REQUIREMENT WHICH STATES THAT IF Account.Agreement_type__c AND Opportunity.Agreement_type__c IS NOT BLANK AND IF BOTH THE VALUES ARE THE SAME THEN RETURN 1 OR ELSE 0.

IF(NOT(ISBLANK(Account.Agreement_type__c)) AND NOT(ISBLANK(Opportunity.Agreement_type__c)) 
AND (TEXT(Account.Agreement_type__c) == TEXT(Opportunity.Agreement_type__c)),1,0)


I'M GETTING A ERROR AS MISSING ) AND DON'T KNOW WHETHER THIS CODES WORKS AS PER MY REQUIREMENT OR NOT.
CAN ANYONE GUIDE ME
I have tried the below code, but it throws an error saying - variable does not exist: field3 
List<sObject> ppRecordsToupdate = new List<sObject>();
for(sObject ppRecord : [select id, name, from LLC_BI__Product_Package__c where
                                           (field 1 !=NULL OR field2 != NULL)])
{
    if(ppRecord.field1!=Null)
        ppRecord.field3 = ppRecord.field1;
    if(ppRecord.field2!=Null)
    {
        if(field3 !=NULL)
            ppRecord.field3 += ';' + ppRecord.field2;
        else
            ppRecord.field3 = ppRecord.field2;
    }
    if(field3 !=NULL)
        ppRecordsToupdate.add(ppRecord);
}
update ppRecordsToupdate;
  • June 28, 2021
  • Like
  • 0
Hey developers,

I'm little confused trying to access a field in this object, could you help me? 

I have the following sentence in the code:

Map<String, Object> tester = exampleFunction();

When I get the response using "system.debug(tester)" I get the following structure:

{cartId=222222XX, 
messages=(cc_bean_Message:[classToAppend=couponMessagingSection-Error, 
labelId=CouponAddMsg_MaxUseExceeded, 
messageId=null])
}

What I am trying to access is the value of "labelId", how can I do this? 
Hello everyone!
I am not an apex expert so I will need your help to get through this!
We want to setup the omnichannel Skills-Based Routing and if I understood well, if I want to route work items (=cases) based on skills I need to create an apex class and trigger it with a process builder (for example). Here's the article: https://help.salesforce.com/articleView?id=omnichannel_skills_based_routing_define_apex_action_class.htm&type=5 (https://help.salesforce.com/articleView?id=omnichannel_skills_based_routing_define_apex_action_class.htm&type=5)
There is a part in the apex code that I need to understand: 
static String getSkillId(String caseDescription) { String skillName = 'English'; if (caseDescription != null) { if (caseDescription.contains('Spanish')) { skillName = 'Spanish'; } else if (caseDescription.contains('French')) { skillName = 'French'; } }
Does this part should reflect the Skills-Based Routing Rules that I set ? In my case, my rule is also based on language, for example, if the case custom field "Account_Country_skill__c" = DE then the case needs to be routed to the agent with the DE skills. Should I replace CaseDescription with my custom field ? If yes, how should I do it ?
Thank you!
Hi Salesforce developers,

I am exporting standard Contact fields with Salesforce SOQL. I need to import it to other tool but I need to convert LastModifiedDate, which is ISO datetime string, into Unix timestamp seconds from 1/1/1970.
 
SELECT Email,LastModifiedDate FROM Contact

	Email							LastModifiedDate
1	john.doe@trailhead.com			2020-10-27T14:06:12.000Z
2	laetitia.arevik@trailhead.com	2020-10-27T14:06:11.000Z

Do you have any ideas how to do that?

I am using iPaaS platform to load SOQL via API (app.tray.io, elastic.io and [Salesforce Workbench][1] for debugging issues) so I don't have access to write custom javascript or apex code.

I checked the official [Salesforce Date functions][2], but I don't see a function that I need.

**Not** working:
 
SELECT Email,FirstName,LastModifiedDate.getTime(),LastName FROM Contact
SELECT Email,FirstName,DateTime(LastModifiedDate).getTime(),LastName FROM Contact

Thank you for your ideas!

  [1]: https://workbench.developerforce.com/
  [2]: https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_date_functions.htm
I have a hierarchical custom  setting called Audience__C and i have a checkbox field 'Booking__c'. now i have a requirement if booking__c is checked then update a field. So, how to query and put if condition on custom setting.We are using "Default Organization Level Value".

Please help on this.
Hello,

I am a newbie to Salesforce. After setting up Field History for Opportunities Object I wish to retrieve data for a specific field eg. `Account Name`. Can I have an example regarding how this can be done.
Thank you in advance for any  help rendered 
Hello together,

for a system ingeration (oracle DB 19.2) with salesforce (LEX)  i have a customer requirement to call a PL/ SQL Procdure via dataloader through a batch process.

I have been searching in google for hours but could not find anything about the right syntax in the batch. 
I also had a look in several dataloader documentations and also on help.salesforce.com and found nothing. 

I appreciate any help.

Thanks in advance
Ilia
If User's profile has not been given with any permission related to the field "Billing Address" on Account object. And the user is trying to query BillingCountry Field. He is facing with below error:

Error:
“INVALID_FIELD: No such column 'BillingCountry' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.”

I have tried to assign read permission to the user via existing permisison set which was created spectifically for this user purpose but "Billing Address" field is not listed in the object setting > account 

And strangly, this permssion seems like cannot be given via any profile of permission set it seems except from Field Level Security of the Billing Address field on account. Correct me if I m wrong here? but this is my observation.

So, do we have only one option to give permission to the user via field level security of the field? If Yes, this gives access to all the users of this profile but request is for only one user of this profil.

Please verify and guide me on how to proceed further on this requirement.

Thank you in advance.
Hello All,

I am writting a validation rule on a field "Company" of user object. My criteria is if user's role is begins with "Cust" then "Company" name can not be "Test1" and "test2". Below code is not working.
 
NOT(AND(
	BEGINS($UserRole.Name, "Cust"),
	OR(UPPER(Company) = "Test1",
      UPPER(Company) = "test2")
	)
)

 
  • February 19, 2020
  • Like
  • 0
I have a requirement to get a list of Users from a particular Group, check for their Permission Set and send custom notification to these Users. Is this achievable through Lightning Flow. I am not able to store the list into a variable as we do in Apex. Any help is appreciated. 
We have multivalue picklist field, which has 200 values. now we need to add 275 more to this list. is there a way we can add from excel or file instead of adding one by one manually
I have a need for a feild in an object which accepts only unique values for each record created or updated. So, i want to achieve this using process builder to trigger when ever a new record is created and flow to check if that unique field is not having the value which has been entered. Can anyone help me with this ?