You need to sign in to do that
Don't have an account?
SamuelRobert
how to build dynamic query
Hi I have to query a record information of the customer. Based on the number of Order the customer submits it should retrieve the same.
Please find my query below.
In the above code i am using the static value to get the same record. I want to make it Dynamic. Please Advise.
I tried the Below logic it still returns me only one at a time.
Please find my query below.
if(OrderNumbers!=null){ String[] splits = OrderNumbers.split(','); String succMes = (splits.size() >1 ? 'Thank you for your order request. Your Order Numbers are ' : 'Thank you for your order request. Your Order Number is '); Set<String> orderIds = new Set<String>(); for(Integer i = 0; i< splits.size(); i++){ orderIds.add(splits[i]); } newOrders = [Select id, Order_Contact__c, OrderNumber, Order_Contact_Phone__c, Order_Contact_Email__c, Type, Rush_Order__c, Type_Of_Order__c, Training_Required__c, Type_Of_Clock__c, Number_of_Clock_Required__c, Ship_to__c,Shipping_Attention__c, Shipping_Attention_Email__c, Shipping_Attention_Phone__c, Shipping_Street__c, Suite_Floor_Address_2__c, Shipping_City__c, Shipping_State__c, Shipping_Postal_Code__c, Shipping_Country__c, Clock_Location_Restriction__c, IP_Restricted__c, Type_of_Clock_Requested__c, Connection_Type__c, Static_IP_Address__c, Static_Subnet_Mask__c, Static_Gateway_Adress__c, DNS1__c, DNS2__c, Branch_Name__c, Branch_number__c, Associates_to_enter_time__c, First_email_reminder_day__c, Second_email_reminder_day__c, PTA_First_email_Day__c, PTA_Second_email_Day__c, PTA_Escalation_email_Day__c, StartTime_for_the_Last_shift_week_time__c, PTA_First_email_Time__c, PTA_Second_email_Time__c, PTA_Escalation_email_Time__c, First_shift_of_the_week_s_start_time__c, Associates_to_enter_late_time__c, i_How_Many_Weeks__c, Last_day_of_your_pay_week__c, Set_up_for_Group_Timesheet__c, Clients_Branch_Name__c, Clients_Branch_ID__c, GT_How_do_they_need_to_enter_time__c, GT_First_name_of_time_submitter__c, GT_Last_name_of_time_submitter__c, Submitter_s_email_address__c, Submitter_First_reminder_day__c, Submitter_Second_reminder_day__c, Auto_approved_submitted_Group_Timesheet__c, Over_Time_Rules__c, Notes__c, Customer_Name__c, Business_Unit_Or_Accounting_number__c, Site_ID_or_Branch_ID_Number__c, Name_of_Clock_Location__c, Site_Street_Address_1__c, Site_Street_Address_2__c, Site_City__c, Site_State__c, Site_ZIP__c, Site_Country_if_not_USA__c, Site_TimeZone__c, Number_of_Employees__c, Pay_Period__c, First_Day_of_payroll_Week__c, First_shift_of_the_week_s_start_day__c, StartTime_for_the_Last_shift_of_the_week__c, Third_Shift_employee_at_the_site__c, OverTime_Rules__c, State_OT_Rules__c, Daily_OT_after_How_many_hours__c, Weekly_OT_after_how_many_hours__c, Does_the_7th_day_rule_apply__c, Non_Standard_Notes__c, Time_Tracking_Options__c, Grace_Period_Before_Shift__c, Grace_Period_After_Shift__c, Meal_Break__c, Length_of_the_meal_break__c, Min_hours_worked_for_auto_meal_deduction__c, California_Meal_Prompts__c, Are_Departments_sent_in_Integration_file__c, Special_Pay_Policies_or_Requests__c from Order where OrderNumber IN :orderIds];
In the above code i am using the static value to get the same record. I want to make it Dynamic. Please Advise.
I tried the Below logic it still returns me only one at a time.
Please check with below link from stack exchange community with suggested workaround on the above issue.
- http://salesforce.stackexchange.com/questions/151030/how-to-build-dynamic-query
Please close this thread by marking it as solved so that it gets removed from the unanswered queue and will be available as a proper solution for others.Regards,
Nagendra.P