• Amit Tiwari 48
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hello Everyone,
I created Onclick java script button in quote to update quote version.
{!REQUIRESCRIPT("/soap/ajax/31.0/connection.js")} 

//declare the varaiable that will hold all the information 
var newRecords = []; 

var opp = new sforce.SObject("Quote"); 
opp.Id = '{!Quote.Id}'; 
opp.CBG_Check_to_Quote_Version__c = '1';
opp.CBG_Check_to_Version__c = '1';

if (confirm("Do you want to revise Quote?") == true)
 {
opp.CBG_Check_to_Quote_Version__c = '1';   
 txt = "You pressed OK!";
 
}

else 
{
opp.CBG_Check_to_Quote_Version__c = '0';
opp.CBG_Quote_Version__c = "  ";
txt = "You pressed Cancel!";



result = sforce.connection.update([opp]); 
window.location.reload(); 
opp.CBG_Check_to_Quote_Version__c = '0'; 
newRecords.push(opp); 
result = sforce.connection.update([opp]); 
window.location.reload();


This button is only visible if opportunity Brand = textile(Opportunity field).
so i created two separate record types with deferent page layout.
Now i created workflow to change record type.
Up to now working  well like whenever opportunity Brand = Phoenix and when i create New quote. I am able to see button in Quote detail page.
  User-added image            User-added image                               
Now if change opportunity Brannd = non Phoenix and if i update existing quote. I should not see the button button over there but button is there.---It is not working.

User-added image
User-added image

Please help me how to do it.
Hello Everyone,
I created Onclick java script button in quote to update quote version.
{!REQUIRESCRIPT("/soap/ajax/31.0/connection.js")} 

//declare the varaiable that will hold all the information 
var newRecords = []; 

var opp = new sforce.SObject("Quote"); 
opp.Id = '{!Quote.Id}'; 
opp.CBG_Check_to_Quote_Version__c = '1';
opp.CBG_Check_to_Version__c = '1';

if (confirm("Do you want to revise Quote?") == true)
 {
opp.CBG_Check_to_Quote_Version__c = '1';   
 txt = "You pressed OK!";
 
}

else 
{
opp.CBG_Check_to_Quote_Version__c = '0';
opp.CBG_Quote_Version__c = "  ";
txt = "You pressed Cancel!";



result = sforce.connection.update([opp]); 
window.location.reload(); 
opp.CBG_Check_to_Quote_Version__c = '0'; 
newRecords.push(opp); 
result = sforce.connection.update([opp]); 
window.location.reload();


This button is only visible if opportunity Brand = textile(Opportunity field).
so i created two separate record types with deferent page layout.
Now i created workflow to change record type.
Up to now working  well like whenever opportunity Brand = Phoenix and when i create New quote. I am able to see button in Quote detail page.
  User-added image            User-added image                               
Now if change opportunity Brannd = non Phoenix and if i update existing quote. I should not see the button button over there but button is there.---It is not working.

User-added image
User-added image

Please help me how to do it.