• Ramanarayanan Padmanabhan
  • NEWBIE
  • 65 Points
  • Member since 2014

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 12
    Replies
Hi, I am new to salesforce. I dont know how to write a test class for update trigger. I need some one help. Just please give a simple example for test class to update a trigger.
Hi folks,
         Can anyone tell me how to use external java script and css file in Visualforce page?

Give me some example


Thanks in advance
Karthick
I have enabled sites and created a force.com site which has a vf page with a login button and a table to show case records. When I click the login button it should either sync with existing salesforce session and show logged in user's case records or prompt for login if there is not existing salesforce session. Any ideas on the approach  ? How can that be done ?

Thanks in advance.
<?xml version="1.0" encoding="UTF-8"?> 
<FlexiPage xmlns="http://soap.sforce.com/2006/04/metadata"> 
  <flexiPageRegions> 
    <componentInstances> 
      <componentInstanceProperties> 
        <name>entityNames</name> 
        <value>Account,Contact</value> 
      </componentInstanceProperties> 
      <componentName>flexipage:recentItems</componentName> 
    </componentInstances> 
      <componentInstances>
    <componentInstanceProperties> 
        <name>entityName</name> 
        <value>RamSampleHomePage</value>
    </componentInstanceProperties>  
<componentName label = 'RamSampleHomePage' pageName = 'RamSampleHomePage'>flexipage:visualforcePage</componentName>
    </componentInstances>    
    <name>main</name> 
  </flexiPageRegions> 
  <quickActionList> 
    <quickActionListItems> 
      <quickActionName>NewAccount</quickActionName> 
    </quickActionListItems> 
  </quickActionList> 
  <masterLabel>Ram Flexipage</masterLabel> 
</FlexiPage> 
Hi,

We have a custom javascript button on quote which replaces the standard sync functionality of quotes. Apart from that we have added some code to display inactive products in quote line items . If the quote line items has inactive products it shows an alert with Inactive product and will not be synchronized. The custom button works fine except one RecordType. When the quote's status is Won, It is changed to a custom_won_RT. 

On Clicking that button, It's throwing the following error: User-added image

The js code:

var Quote2Update = new sforce.SObject("Quote"); 
Quote2Update.id= "{!Quote.Id}"; 
var strQuery = "select Product2.Name,Id,quote.name,Product2.IsActive from QuoteLineItem where quote.id = " + "'" + Quote2Update.id + "'"; 
var records = sforce.connection.query(strQuery); 
var records1 = records.getArray('records'); 
var active = new Array(); 
var inactiveProd = new Array(); 
var withStyle = new Array(); 
is_sync='{!Quote.Custom_isSync__c}' 

for(var i = 0, j = 0; i < records1.length; i++) 

if(records1[i].Product2.IsActive == 'false') 

inactiveProd[j] = records1[i].Product2.Name; 
j = j + 1; 


//alert(inactiveProd); 

for(var k=0;k < inactiveProd.length;k++) 


withStyle[k] = '\n'+'->'+inactiveProd[k]; 


var Quote3Update = new sforce.SObject("Quote"); 
Quote3Update.Opportunity_Name__c = "{!Quote.Opportunity_Name__c}"; 
var strQuery1 = "select Name,Id,Custom_isSync__c from quote where Quote.Opportunity_Name__c = " + "'" + Quote3Update.Opportunity_Name__c + "' and Custom_isSync__c = true"; 
var oppRecords = sforce.connection.query(strQuery1); 
//alert(oppRecords); 
var oppRecords1 = oppRecords.getArray('records'); 
//alert(oppRecords1); 
//non_Sync = '{!Quote.Custom_isSync__c}' 
//alert(non_Sync); 
var activeQuote = new Array(); 
var Quote3Update_Array = new Array(); 
for(var a=0;a<oppRecords1.length;a++) 

activeQuote[a] = oppRecords1[a].Name; 
//oppRecords[a].Custom_isSync__c = false; 

/****for(var b=0,c=0;b<oppRecords1.length;a++) 

var totalArray = oppRecords1[b]; 
totalArray.Custom_isSync = 0; 
Quote3Update_Array.push(totalArray); 
//activeQuote[a] = oppRecords1[a].Name; 
c = c + 1; 
//oppRecords[a].Custom_isSync__c = false; 
}***/ 

//alert(activeQuote); 
//alert (withStyle); 
//alert(activeProd); 
if(oppRecords1[0]){ 
var newVar = oppRecords1[0]; 
//alert(newVar.Custom_isSync__c); 
newVar.Custom_isSync__c=0; 
Quote3Update_Array.push(newVar); 

if(Quote2Update!= null) 

try 


if(is_sync==0 && inactiveProd.length==1) 

mes = "Quote could not be synchronized since the Product "+withStyle+" is inactive."; 

else if(is_sync==0 && inactiveProd.length>1) 

mes = "Quote could not be synchronized since the Products "+withStyle+" are inactive."; 

else if (is_sync==0 && activeQuote.length>0) 


var bool=confirm("The Quote "+activeQuote+" is already Synchronized.Do you wish to continue?"); 
if(bool){ 
Quote2Update.Custom_isSync__c = 1; 
mes = "Quote Synchronized"; 
result = sforce.connection.update(Quote3Update_Array); 

else{ 
mes = "Quote Not Synchronized"; 


else if (is_sync==0) 

Quote2Update.Custom_isSync__c = 1; 
mes = "Quote Synchronized"; 
result = sforce.connection.update(Quote3Update_Array); 

else 

Quote2Update.Custom_isSync__c=0 
mes = "Quote Not Synchronized anymore"; 

updateQuote = sforce.connection.update([Quote2Update]); 
alert(mes); 
window.location.reload(); 

catch(e) 

alert('error : ' + e); 

}

Any suggestion to resolve this error?
I have two separate orgs.  They're sort of the same, but not really.  

Is there a tool or tools out there to not only compare Metadta, but also to compare Data?  

Any thoughts or suggestions?  

As always, thank you for your feedback!

V
Hi, I am new to salesforce. I dont know how to write a test class for update trigger. I need some one help. Just please give a simple example for test class to update a trigger.
We created some VF tabs that we would like to use in the mobile app, but when clicking on the VF tab from the app, it brings up a login screen. However, when the credentials are entered, it goes blank.
- It works fine in Android Salesforce1 app and mobile browser, this problem is only seen in iOS Salesforce1 app.
- Also, we have enabled all the VF pages for mobile in the Mobile Navigation setup.
- I am logging as a System Admin so profile permission is not an issue.

User-added image
<?xml version="1.0" encoding="UTF-8"?> 
<FlexiPage xmlns="http://soap.sforce.com/2006/04/metadata"> 
  <flexiPageRegions> 
    <componentInstances> 
      <componentInstanceProperties> 
        <name>entityNames</name> 
        <value>Account,Contact</value> 
      </componentInstanceProperties> 
      <componentName>flexipage:recentItems</componentName> 
    </componentInstances> 
      <componentInstances>
    <componentInstanceProperties> 
        <name>entityName</name> 
        <value>RamSampleHomePage</value>
    </componentInstanceProperties>  
<componentName label = 'RamSampleHomePage' pageName = 'RamSampleHomePage'>flexipage:visualforcePage</componentName>
    </componentInstances>    
    <name>main</name> 
  </flexiPageRegions> 
  <quickActionList> 
    <quickActionListItems> 
      <quickActionName>NewAccount</quickActionName> 
    </quickActionListItems> 
  </quickActionList> 
  <masterLabel>Ram Flexipage</masterLabel> 
</FlexiPage> 
Hi,

Is there any way to control the Feed Tracking entries populated by Chatter?
Allow me to elaborate my problem. At the moment, when we have Feed Tracking in a custom object (say Test__c) for a field (FieldName__c) , when there is a change in the field value, it posts a Feed in Chatter saying 'FieldName changed from X to Y'. I wanted to customize this message if possible. 

While Chatter Triggers on FeedItem would allow me control messages entered by users manually I couldn't find a way to control this feed. 
Is there any way to do this? If not, do you have any workaround for this which might work?

Thanks!
Hi,

I have written a trigger on account. On updating the Program status on Account, it update the Opportunity Stage Name and there is another trigger return on Opportunity. The problem is while using bulk update from data loader it is causing problem. Can anyone please provide suggestion
Hi folks,
         Can anyone tell me how to use external java script and css file in Visualforce page?

Give me some example


Thanks in advance
Karthick