function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ManojjenaManojjena 

How to assign value to standrad field isSyncing in test class.

Hi All,

 

     I have a query in that one condition  is there, like ' where  isSyncing=true' .In my test class I am not able to assign value to that isSyncing field .Can any one suggest me how to solve the issue .

 

Thanks In adavce.

Situ

swatKatswatKat

You must have created a test record of the object u are querying. So u can set the value before inserting the test record. Actually if you could paste ur code here, it could be understood better.

ManojjenaManojjena

Quote quot=new Quote();
quot.Name='TestQuote';
quot.AUC_Percentage__c=0.20;
quot.AMC_percentage__c=0.15;
quot.Annual_percentage_value__c=0;
quot.Total_AUC_Value__c=1000.00;
quot.Renewal_Quote__c=true;
quot.Approval_Status__c='Approved';
quot.Quoted_Date__c=System.today();
quot.Exchange_Rate__c=10;
quot.Currency__c='USD';
quot.Tax__c=12.36;
quot.OpportunityId=opp1.id;
quot.isSyncing=true;//Here it is showing error field is not writable.

 

If i can assign value to this field the the query in the trigger will get some record for which it will enter in side the condition condition 

if(listSize >0){}

Puja_mfsiPuja_mfsi

Hi,

Instead of marking the sync at the quote level you'll need to mark it at the opportunity level via the"Opportunity.SyncedQuoteId" field. After doing this the "Quote.IsSyncing" field will be true.

 

Example:

 

Opportunity oppty = new Opportunity (
Name = 'test',
StageName = 'Prospecting',
CloseDate = System.Today()
);
insert oppty;
Quote qu = new Quote (
Name = 'test',
OpportunityId = oppty.Id
);
insert qu;
oppty.SyncedQuoteId = qu.Id;
update oppty;

 

Now the quote record has "IsSyncing" value to true

swatKatswatKat

You can also look at this link. It is explained here with the limitations :  http://blog.softwareallies.com/2010/08/salesfoce-syncing-quote-in-apex.html

John BraunJohn Braun
Puja_mfsi,

Do you know if you can mass update existing Quote records to sync with their corresponding opportunity? I understand you would need to mass update the Opportunity.SyncedQuoteId field somehow.