+ Start a Discussion
Best Answer chosen by hasya hasya
Iqbal Hossain 1Iqbal Hossain 1
First check whether you are able to see different record types using SOQL.
As a workaround send the 'recordTypeId' prior to setting default values like follows:

/lightning/o/<Object Name>/new?recordtypeId= recordTypeId=<15 digit Id>&
defaultFieldValues=
Field1=value 1,
Field2=value 2

 
Mubarak HussainMubarak Hussain 
Hi All,
What is an Workbench in Salesforce,and what is the difference between workbench,developer console and Force.com Explorer.


Thanks
Best Answer chosen by Mubarak Hussain
Amit Chaudhary 8Amit Chaudhary 8
Link:- https://workbench.developerforce.com/login.php
Workbench is a powerful, web-based suite of tools designed for administrators and developers to interact with Salesforce.com organizations via the Force.com APIs. Workbench includes robust support for the Force.com Partner, Bulk, Rest, Streaming, Metadata, and Apex APIs that allows users to describe, query, manipulate, and migrate both data and metadata in Salesforce.com organizations directly in their web browser with a simple and intuitive user interface. Workbench also provides many advanced features for testing and troubleshooting the Force.com APIs, such as customizable SOAP headers, debug logs for API traffic, backward compatibility testing with previous API versions, and single sign-on integration within the Salesforce application.

Please check below post for more detail
https://developer.salesforce.com/page/Workbench
http://www.salesforcetutorial.com/workbench-salesforce-using-workbench/

Please let us know if this will help you

between workbench,developer console and Force.com Explorer all three are used almost for same.

Developer Console: The Developer Console is accessible from within your Salesforce organization, and provides a collection of tools you can use to create, edit, debug and test applications.

Force.com IDE: The Force.com IDE is a full-featured, Eclipse-based coding environment, with capabilities like code completion, version control, collaborative development, and project sharing.

Force.com Explorer: This cross-platform AIR application, still in beta, provides a lightweight tool that lets developers browse their schema, custom objects and fields, and build and test SOQL queries.

Workbench: This powerful, web-based suite of tools designed for adminstrators and developers to interact with Salesforce.com organizations via the Force.com APIs. Workbench includes robust support for the Force.com Partner, Bulk, Rest, Streaming, Metadata, and Apex APIs that allows users to describe, query, manipulate, and migrate both data and metadata in Salesforce.com organizations directly in their web browser with a simple and intuitive user interface.
https://developer.salesforce.com/page/Tools

Please let us know if this will help you

Thanks
AMit Chaudhary
Abby StockerAbby Stocker 
Please help with the following error. Thank you! 
User-added imageUser-added image
Best Answer chosen by Abby Stocker
SarvaniSarvani
Hi Abby,

If you initially setup the trigger on diffferent sobject and change the code of the trigger to act on different sobject this error will occur.

Please follow below steps
Copy (backup) the trigger code to a text file and delete the original trigger first

Recreate the trigger again on EmailMessage object
Hope this helps! Please mark as best answer if it does.

Thanks
GunwantGunwant 
Hi All Champs,

Does anyone has any idea, why am I getting this error. " Challenge Not yet complete... here's what's wrong: 
The 'Accounts Without SolarBot Opportunities' report doesn't include the correct collection of accounts
"
I have created a report with Account standard report type. How can we fulfill this requirement for challenge#2.
User-added image

Thanks 
Guns
Best Answer chosen by Gunwant
Debashis BeheraDebashis Behera
Please add the cross filter logic on opportunities as below:
User-added image

Thanks
Debashis
sanjusfdcsanjusfdc 
Hi All,
Help me on this, i want using validation rule "Dealer user cannot save if the selected picklist value in Status field in "Inquiry" record type in Case is "Uploaded".
Best Answer chosen by sanjusfdc
Prakash NawalePrakash Nawale
sanjusfdc,

Use below code in validation rule to prevent creating of Case record based on your requirments.
 
AND(
           $RecordType.DeveloperName='Inquiry',
            $User.Username = 'Dealer username',
            ISPICKVAL( Status , 'Uploaded') 
)

Please like the answer and mark it as best if this helps.
Arpitha GowdaArpitha Gowda 
Hello All

How do i write test class for below Batch apex class, 
 
global class Emailalertbatchclass implements Database.Batchable<sObject>, Schedulable, Database.Stateful {
    
    //Variable Section
    global FINAL String strQuery;
    global FINAL String leadid;
    global List<String> errorMessages = new List<String>();
    
    global Emailalertbatchclass() { 
        this.strQuery = getBatchQuery();
    }
    
    //Returns the Query String to Batch constructor to fetch right records.
    private String getBatchQuery() {
        String strQuery = 'SELECT Id,Name,Status,Email,owner.email,owner.name,ownerid,No_Enquiry_Email_Sent__c,Manager_Email__c FROM Lead where No_Enquiry_Email_Sent__c=false AND Status=\'Enquiry\' And (CreatedDate = YESTERDAY OR LastModifiedDate = YESTERDAY) limit 1';
        return strQuery;
    }
    
    //Batch Start method
    global Database.QueryLocator start(Database.BatchableContext BC) {
        return Database.getQueryLocator(strQuery);
    }
    
    //Batch Execute method calls findCostForWoD method
    global void execute(Database.BatchableContext BC, List<sObject> scopeList) {
        System.debug(LoggingLevel.INFO, '== scopeList size ==' + scopeList.size());
        
        List<Lead> ld = (List<Lead>) scopeList;
        List<Lead> updatedld = new List<Lead>();
        if(!ld.isEmpty()) { 
            List<Messaging.SingleEmailMessage> mailList = new List<Messaging.SingleEmailMessage>();
            for (Lead prod : ld)
            {               
                // Step 1: Create a new Email
                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                
                // Step 2: Set list of people who should get the email
                String[] toAddresses = new String[] {prod.owner.Email,prod.Manager_Email__c,'chandra.s@proseraa.com'};
                    mail.setToAddresses(toAddresses);
                
                // Step 3: Set who the email is sent from
                mail.setReplyTo(prod.owner.Email);
                mail.setSenderDisplayName('No Activity on Leads for 24hrs');
                
                // (Optional) Set list of people who should be CC'ed
                List<String> ccTo = new List<String>();
                ccTo.add('manjunath.s@proseraa.com');
                mail.setCcAddresses(ccTo);
                
                // Step 4. Set email contents - you can use variables!
                mail.setSubject('No Activity on Lead for 24hrs');
                String body = 'Dear ' + prod.owner.name + ', <br><br>';
                body += 'This is to notify you that there is no activity done on the respective <b> Lead Name: ';
                body +=prod.Name+'</b>  please find the link below..<br><br>';
                body += 'link to file: https://moengage--proseraa.lightning.force.com/lightning/r/Lead/'+prod.id+'/view'+'<br><br><br> Thanks,<br>Moengage Team</body></html>';
                mail.setHtmlBody(body);
                
                // Step 5. Add your email to the master list
                mailList.add(mail);
                prod.No_Enquiry_Email_Sent__c = true;
                updatedld.add(prod);
                
            }
            if(!mailList.isEmpty()) {
                try{
                    Messaging.sendEmail(mailList);
                    update updatedld;
                }
                catch (Exception ex) {
                    errorMessages.add('Unable to send email to Tech: '+ ex.getStackTraceString());
                }
            }
        }
    }  
    
    //Batch Finish method for after execution of batch work
    global void finish(Database.BatchableContext BC) { 
        
    }
    
    //Method which schedules the ProductDownloadBatch
    global void execute(SchedulableContext sc) {        
        Emailalertbatchclass snInstance = new Emailalertbatchclass();
        ID batchprocessid = Database.executeBatch(snInstance);
    }
}

 
Best Answer chosen by Arpitha Gowda
Dushyant srivastava 8Dushyant srivastava 8
remove the "Test.startTest()" from the 3rd line of the method and add that after "Test.setCreatedDate(ld.Id, yesterday);"

It will work fine then.
 
@isTest
public class EmailalertbatchclassTestclass
{
    static testMethod void testmethod1()
    {
        lead ld = new lead();
        ld.FirstName= 'test';
        ld.LastName='Test2';
        ld.status='Enquiry';
        ld.Company = 'fgfh';
        ld.Email = 'manjunath.s@proseraa.com';
        ld.Manager_Email__c = 'chandra.s@proseraa.com'  ;  
        Insert ld;  
        
        Datetime yesterday = Datetime.now().addDays(-1);
        Test.setCreatedDate(ld.Id, yesterday);
        
        Test.startTest();
        
        Emailalertbatchclass snInstance = new Emailalertbatchclass();
        ID batchprocessid = Database.executeBatch(snInstance);
        
        Test.stopTest();
    }
}

See the above Class and try to modify your code accordinly.
aam1raam1r 
I have two clases:
1. a controller class to a vf page and another as
2. a helper class accessed by multple classes. 

I have a simple query running in the helper class that is failing to return any records:
...
public static void refreshOrder(Id orderId, Id accountId){

        // Retrieve the Order
        Order ord = [Select Id, Name, Status From Order Where Id = :orderId];

...
The controller class that calls the above method has the following extract:
...

Order order = new Order(
    Pricebook2Id = OrderHelper.getStandardPriceBookId(),
    Status = ORDER_STATUS_PENDING_PAYMENT, 
    AccountId = acc.Id
    EffectiveDate = System.today(),
    CurrencyIsoCode=pkgCurrencyCode
 );
        
 insert order;

OrderHelper.refreshOrder(order.Id, acc.Id);
...
Any idea why a system.debug in the helper class does show a valid Order Id being apssed but then the simple order query does not return anything, and instead throws an error:
"List has no rows for assignment to SObject" ?
 
Best Answer chosen by aam1r
aam1raam1r
Ok, i figured thsi out.  i thought i'd post in case anyone else faces the same issue.  Here's what i checked:
1. User permissions.  This was part of a process involving a Site Guest User.  And although i had set up sharing rules i guess this user worjks a bit differently from a standard, rather a normal user in salesforce
2. I moved the select query from the helper class to teh controller class and then passed the field values to the helper class - and it did work.  So user has access, but only in one class - not the other.
3. I then checked the class definition and yes, it was set to public with sharing. So,
4. i changed this to public without sharing

And it all worked.  Of course, this means that sharing settings will not apply in this class, and that it will run on a system level.  But that's fine.  I'll control access to sensative info via the profile when needed.
Thanks for looking!
EQ AdminEQ Admin 
for(Apttus_Billing__Invoice__c invoice:invoiceObjectList1) // loop over invoices
              {
                  List<InvoiceLineItems> listToStoreLineItems = new List<InvoiceLineItems>();
                  APTS_InvoiceJournalWrapper invoiceJournWrapper= new APTS_InvoiceJournalWrapper();
                   countHeader=0;
                   
                   count=count+1;
                  Decimal Sum=0;
                   
                                    invoiceJournWrapper.id=String.valueof(invoice.id);
                                    invoiceJournWrapper.HeaderKey=String.valueof(count);
                                    invoiceJournWrapper.ZCurrency=(invoice.CurrencyIsoCode!=null?invoice.CurrencyIsoCode:'USD');
                                    //invoiceJournWrapper.AccountingJournal='null';
                                    invoiceJournWrapper.AccountingJournalID=String.valueOf(invoice.Name + '_' +myDate);
                                    invoiceJournWrapper.JournalNumber=String.valueOf(invoice.Name + '_' +myDate);
                                    invoiceJournWrapper.ExternalReferenceID=String.valueOf(invoice.Name);                  
                                    invoiceJournWrapper.AccountingDate=String.valueof(Date.valueof(invoice.Apttus_Billing__InvoiceDate__c));
                  //-------------------
                  list<Apttus_Billing__InvoiceLineItem__c> invlineitems=[Select id,Apttus_Billing__AssetLineItemId__r.Apttus_Config2__ProductId__r.ProductCode,Apttus_Billing__AssetLineItemId__r.Apttus_Config2__OptionId__r.ProductCode,Apttus_Billing__InvoiceId__r.Name,Apttus_Billing__ProductId__r.Name,Apttus_Billing__InvoiceId__r.CurrencyIsoCode,
                                                                      Apttus_Billing__Type__c,Apttus_Billing__InvoiceId__c,Name,Apttus_Billing__Amount__c,Apttus_Billing__SoldToAccountId__r.EQ_ClientRef__c,Apttus_Billing__LocationId__c,
                                                                      Apttus_Billing__ProductId__r.EQ_FeeCode__c,Apttus_Billing__BillToAccountId__r.EQ_ClientRef__c,Apttus_Billing__ProductId__r.ProductCode,Apttus_Billing__InvoiceId__r.EQ_TotalInvoiceAmount__c 
                                                             from Apttus_Billing__InvoiceLineItem__c where Apttus_Billing__InvoiceId__c=:invoice.id and Apttus_Billing__Type__c='Contracted' and Apttus_Billing__Amount__c!=0];
                  //----
                  //
                  //-------------
                   InvoiceLineItems FirstInvItems= new InvoiceLineItems();
                            countHeader=countHeader+1;
                            FirstInvItems.LineKey=string.valueof(countHeader);

 
Best Answer chosen by EQ Admin
paul diracpaul dirac
I find some errors and the code does not compile (i mocked all of your custom object but anyway there might be some sintax errors).
Consider to split some "iterative tasks" in an helper (static) class, since your Rest service might grows in future, developers (you too ofc) may encounter difficulties to maintain that. For example, that part in which lineItems are collected and then modified can be delegated to the helper class to enhance code readability.
Further little optization can be done storing fixed numbers/strings in costants but I guess that there are not any improvements that significately reduce the execution time, I mean the optimization I will want to see here is in code readability first. Hope I helped you to solve your cancerns!
krishna casukhela 15krishna casukhela 15 
I am currently doing business specialist super badge trailhead and I imported the rows using data import wizard .

when I click Check Challenge I am getting the following error

error screenshot

The package is already installed in TrailHead Playground1 but still I am facing an issue.

Anybody who has worked on this badge do please let me know how to complete challenge 1.

I have added "Residentail" and "Other" to the account Type picklist and activated it.

I have given 2 rows of the CSV file for understanding purpose.
Account NameTypeRatingBilling State/ProvinceAccount PhonewebsiteBilling CityBilling Zip/Postal CodeAnnual Revenue
Sam Heath Household  ResidentialHotNM1.23E+09https://twitter.com/trailheadOdessa9411445000
Imran Pope Household  OtherMedium CO3.46E+09https://twitter.com/salesforceDenver8020670000


 
Best Answer chosen by krishna casukhela 15
Khan AnasKhan Anas (Salesforce Developers) 
Hi Krishna,

Greetings to you!

I think you are not installing the package in the correct playground. Please follow the below steps:

Important: Please use a new Trailhead Playground for this challenge.

1. Click on the Install Unmanaged Package URL
2. It will redirect you to your base org and will probably show you an error.
3. Copy your Playground or any different org you want to install the package into URL (Ex.: https://www.playful-bear-xxxxxx-dev-ed.lightning.force.com/ Leave the rest).
4. While installing the package you will get the following URL --> https://yourbaseorg.lightning.force.com/packagingSetupUI/ipLanding.app?apvId=04t0P000000N9rs
5. Replace yourbaseorg.lightning.force.com with the playground URL as follows 
https://www.playful-bear-xxxxxx-dev-ed.lightning.force.com/packagingSetupUI/ipLanding.app?apvId=04t1a000000REQ2
6. Press Enter.

Alternatively, you can follow the below steps:

1. Open an incognito browser window in Chrome.
2. Go to Trailhead and log in.
3. Stop and check and make sure you're in an incognito window. Seriously. This won't work without it. 
4. Navigate to the challenge that requires you to install the package or app. 
5. In the Hands-on Challenge section, click the dropdown to see your list of Developer Edition and Trailhead Playground orgs. Confirm that the org with the checkmark is the org where you want to install the package or app.
6. Click Launch to open that org in a new browser window. 
Note: This new browser window must be open before you go on to the next step. 
7. In the Trailhead browser window, click the package or app install link included in the challenge text. Remember that you need to be in incognito mode. 
8. On the Salesforce login screen, enter the username and password for your Trailhead Playground or Developer Edition org. Note: These login credentials are sometimes different from the username and password you use to log in to Trailhead. If you don’t know the username and password for your Trailhead Playground org, check out this article: https://trailhead.salesforce.com/help?article=Find-the-username-and-password-for-your-Trailhead-Playground
9. Follow the AppExchange instructions to finish installing the package or app.

Please refer to the below link which might help you further.

https://trailhead.salesforce.com/help?article=Installing-a-package-or-app-to-complete-a-Trailhead-challenge

I hope it helps you!

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Halo CEOHalo CEO 
Hello All,

I keep getting this error on this question:

Challenge not yet complete... here's what's wrong: 
An update to an account record failed to update the mailing address fields of all child contact records. Make sure that the process is correct and that it is activated.

Screenshot:
https://www.dropbox.com/s/30lrmgz8zogxulf/Screenshot%202015-03-23%2016.09.38.png?dl=0

Screenshot 2:

https://www.dropbox.com/s/5wrdht63l18591b/Screenshot%202015-03-23%2016.10.57.png?dl=0

I have gone over this many times and I would appreciate any help to get through this challenge!!


Thanks!
Best Answer chosen by Halo CEO
Emilien Guichard 16Emilien Guichard 16
Hi,

here is my process :

User-added image

User-added image