Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I check the "IsSyncing" checkbox to true on quote to pass a validation in test class?

share|improve this question
up vote 8 down vote accepted

To enable quote to opportunity sync'ing you have to set Opportunity.SyncedQuoteId to the quote id you want to sync with. From salesforce docs:

public void startQuoteSync() {
         Opportunity opp = new Opportunity(); 
         opp.setId(new ID("006D000000CpOSy")); 
         opp.setSyncedQuoteId(new ID("0Q0D000000002OZ")); 
   // Invoke the update call and save the results
   try {
      SaveResult[] saveResults = binding.update(new SObject[] {opp});
      // check results and do more processing after the update call ...
   }
   catch (Exception ex) {
      System.out.println("An unexpected error has occurred." + ex.getMessage());
      return;
 }
}
share|improve this answer
    
Thank you chris. It worked. – Anurag A Mar 1 at 19:50
    
Excellent! Yes salesforce has a number of relationship fields that you would think would be editable, like the quote.issyncing but in reality are not. – Chris Fellows Mar 1 at 20:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.