You need to sign in to do that
Don't have an account?
Guru 91
How to show and hide onclick java script button?
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.
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.
Please help me how to do it.
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.
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.
Please help me how to do it.
In Text field set default value to "rev" in place of "rev00" then in your formula field if number field value is less then 10 then concatenate "00" in text field, If number is between 10 to 99 then concatenate "0" in text field and if number is greater then 99 then simply concatenate text field and number field.
Please let us know if this helps.
Thanks
Arpit
All Answers
Check once that you have assigned correct page layout related to record type for associated profiles. It looks like for the logged in user profile same page layout is assigned for both the record types hence it is showing the button in both case.
Please check and let me know for any issues.
Thanks
Arpit
Thank you
I assigned correctly, but is possible to change pagelayout for existing record based on parent field change.
In Text field set default value to "rev" in place of "rev00" then in your formula field if number field value is less then 10 then concatenate "00" in text field, If number is between 10 to 99 then concatenate "0" in text field and if number is greater then 99 then simply concatenate text field and number field.
Please let us know if this helps.
Thanks
Arpit