• Saurabh Gupta Manras
  • 55 Points
  • Member since 2014
  • Manras Technologies Private Limited

  • Chatter
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 10
Once I install unmanaged package from Apex Specialist Superbadge and check Challenge, I am getting below error.
In email I got below message after I installed unmanaged package -
Package: Trailhead Apex Superbadge (04t36000000i5UM)
Some components, such as custom objects, custom report types, and workflow rules, must be activated using the package deploy process, before they are available to your organization.

Challenge Not yet complete... here's what's wrong:
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Validation Formula "Term_schedule_requires_subscription" Invalid (Field 00N5000000ASPDU is inaccessible. Please review all fields referenced by the formula. Context: common.config.entity.ValidationFormulaContext): []
public class TimeTableset_controller{
integer i=1;
integer count;
    if(count<12 || count>=12)
Hello Community,
Looking for some assistance with loading test data via CSV files. I’m attempting to generate test data using the Test.LoadData method. In this circumstance, I’m loading, Users, Accounts and Campaigns. Users and Accounts load fine but when I attempt to load Campaign records, I get an error stating “Validation Errors While Saving Record(s)”. I have turned off all validation rules on the Campaign object and have taken my Campaign CSV data down to bare bones for experimentation purposes (inserting only one record with minimal fields).
The Campaign object has two Account lookup field and two user lookup fields. Although I have not been able to validate it, I’m thinking that the foreign id’s I’m using as references are only being considered directly after the insert. For example.
Step 1:
Load Users with numerically sequential ID’s i.e. 1,2,3,4,5,6. When loaded, the users are assigned actual 15 charter SF id’s .
Step 2:
Load Account data with numerically sequential ID’s i.e. 1,2,3,4,5,6. I also have a user lookup field that I have assigned via the foreign key (numerically sequential ID’s from step 1)
Step 3:
Load Campaign data and reference the users and Accounts via the assigned foreign id’s from step 1 & 2.
Step 3 will not work and throws a validation error described above. I am unable to get any further information from the logs and feel a bit stuck.
Anyone have an idea on the issue here?

Here is my code:
public class TestUtilityClass {
    public static void CreateTestAccountsAndCampaigns() {
        list<SObject> dataList = new list<SObject>();
private class Test_OfficerStats_CampaignUpdate {
@testSetup static void setup() {
        id UserId = system.UserInfo.getUserId();
        user CurrentUser = [Select id from user where id = :UserId];
Here are my CSV files
User-added image
User-added image
User-added image

  • October 13, 2017
  • Like
  • 0


I want to write a VF page or component and user can add it to any page that he want.

I tried but found that VF page must define a specific controller or I can't add this VF page into any page(Account, Opportunity,...)

Is there a way to write a VF page/component once and use it anywhere?


Thank you so much


I have a situation in which I have to run a single query from 2 differenct unrelated custom objects and I actually have no clue how to do that in SOQL, as SOQL doesn't have the JOIN functionality. 

I have 2 Custom Object named: 1. jud_city_list__c and 2. jud_dlr_list__c. 
This is the SQL query which I want to access through SOQL.

SELECT `l`.`city`, `l`.`pref_dlr1`, `l`.`pref_dlr2`, `l`.`pref_dlr3`, `d`.`name`, `d`.`dlrid`, `d`.`state` 
AS `dlr_states`, `d`.`city` AS `dlr_city`, `d`.`ud_dlrid`
FROM `jud_city_list` `l`JOIN `jud_dlr_list` `d` ON `d`.`dlrid` IN (l.pref_dlr1,l.pref_dlr2,l.pref_dlr3)
WHERE `l`.`city` LIKE 'm%' ESCAPE '!'ORDER BY `l`.`city` ASC

where l - jub_city_list__c object
          d - jub_dlr_list__c object. 

I don't know how to get this SQL query into SOQL query. Do I have to write a wrapper class for this ? Or Is there any other possible way available to get this query written into SOQL ?

Thanks you so much in advance, looking for some serious help.

Hardik B.
I try to build a REST API to receive JSON from another server.
The JSON sample like this.

And I have created the apex structure like this.
public class Benef_list {
		public String be_last_name;
		public String be_first_name;
		public String be_pid;
		public String be_relationship;
    public class Policy_list {
		public String po_ins_company_code;
		public String po_policy_id_str;
		public String po_rate;
		public List<Insured_list> insured_list;
    //Request Model
    public class RequestModel
        public String token;
		public String od_order_id_str;
		public String od_status;
		public String od_product_code;
		public String od_rate;
		public String od_deliver_status;
		public String od_archive_policy_doc;
		public String od_contract_status;
		public String od_source;
		public List<String> od_b2b_invalid_data;
		public String ap_first_name;
		public String ap_last_name;
		public String ap_mobile;
		public String ap_pid;
		public String ap_birthday;
		public String ap_email;
		public String ap_address_city_id;
		public String ap_address_area_id;
		public String ap_address;
        public String ap_update_info; 
		public String tr_transport;
		public String tr_country_code;
		public String tr_city_id;
		public String tr_purpose;
		public String tr_start_date;
		public String tr_start_hour;
		public String tr_start_min;
		public String tr_end_date;
		public String tr_end_hour;
		public String tr_end_min;
		public String tr_period_days;
		public String pay_order_id;
		public List<Policy_list> policy_list;
    public class Item_list {
		public String it_is_primary;
		public String it_ins_item_code;
		public String it_ins_company_code;
		public String it_amount_code;
		public String it_amount_name;
		public String it_amount;
		public String it_rate;
		public String it_item_name;

	public class Insured_list {
		public String in_relationship;
		public String in_last_name;
		public String in_first_name;
		public String in_pid;
		public String in_birthday;
		public String in_rate;
		public String pa_package_type;
		public String pa_package_name;
        public String in_taian_package;
		public List<Item_list> item_list;
        public List<Benef_list> benef_list;

It can receive the data successfully, but the question is occurred on inserting or updating data.
In SFDC, I created 3 objects: Order, OrderItem, TravelCom.
Order is the parent of OrderItem, and OrderItem is the parent of TravelCom.
List<Order__c> orderList = [SELECT Id, Name, Account__c,
                                            (SELECT Id, Name, Order__c, relationship__c, 
                                            FROM OrderItems__r),
                                            (SELECT Id, Name ,Order__c, OrderItem__c,
                                            FROM TravelCom__r)
                                            FROM Order__c
                                            WHERE RecordTypeId = :orderRTList[0].Id
                                            AND Name = :tmpRequestModel.od_order_id_str];

The API can create these 3 objects well and insert the responding value on Order, OrderItem but TravelCom is always null.
This is what I wrote.
for (Policy_list objPolicy : tmpRequestModel.policy_list) 
                    for (Insured_list objInsured : objPolicy.insured_list) 

                        tmpOrderItem.Insurance_No__c = objPolicy.po_policy_id_str;
                        upsert tmpOrderItem;

                        for(Item_list objItem : objInsured.item_list)
                                tmpTravelCom.Orderitem__c = tmpOrderItem.Id;

                           if(objItem.it_ins_item_code !=null)

                               	  if(objItem.it_ins_item_code == 'test1)
                                       tmpTravelCom.TA001_amount__c = integer.valueOf(objItem.it_amount);
                                       tmpTravelCom.TA001_Price__c = integer.valueOf(objItem.it_rate);
                                  if(objItem.it_ins_item_code == 'test2' && tmpTravelCom.TA001_amount__c != null && tmpTravelCom.TA001_amount__c != null)
                                       tmpTravelCom.TA002_amount__c = integer.valueOf(objItem.it_amount);
                                       tmpTravelCom.TA002_Price__c = integer.valueOf(objItem.it_rate);
                                  if(objItem.it_ins_item_code == 'test3')
                                       tmpTravelCom.TA003_amount__c = integer.valueOf(objItem.it_amount);
                                       tmpTravelCom.TA003_Price__c = integer.valueOf(objItem.it_rate);
                           {	tmpResponseModel.status = '01';
                                tmpResponseModel.traceError = 'No Insured Item value!';

                        upsert tmpTravelCom;


Can anyone correct me?
Thank you so much.
  • October 12, 2017
  • Like
  • 0