• Shamus Kelley 4
  • NEWBIE
  • 25 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 9
    Replies
I have this OnClick java button that I need to modify so that it also marks a custom field True while processing. Here is the current code:

{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/25.0/apex.js")} 

// Call the web service method to display the Email Author JSP page for 
// the Work Order email template. Result is an object with success="true" or "false" 
// and msg = "error message or other string." 
try { 
var result = sforce.apex.execute( 
'Work_Order_Buttons', // class name 
'sendWorkOrder', // methodName 

oppIdraw: "{!Work_Order__c.Id}" 

); 
if (result[0].success == 'true') { 
window.location.href = result[0].msg; 

else { 
alert(result[0].msg); 


catch (ex) { 
alert("Error: " + ex); 

any help is appreciated! thank you- 
I'm looking to update the script within this button so that a custom field (i.e. Quote_generated_coun__c) is updated every time the button is clicked. Any help is greatly appreciated! 

Here is the current OnClick Java Script that needs modification:

{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/21.0/apex.js")} 
try{ 
// check that Opp has the necessary approvals in order to continue 
var strCheck = "{!Opportunity.Approval_Required__c}".toLowerCase(); 
if ( strCheck.indexOf("quote") == -1) { 
try{ 
var result = sforce.apex.execute( 
'Opportunity_Buttons', // class name 
'createQuote', // method name 
{ // arguments 
oppIDraw:"{!Opportunity.Id}", 
generateQuoteNum:"true" 

); 

if (result[0].success == 'true') { 
//window.location = result[0].msg; 
window.open(result[0].msg, "quoteWin"); 
} else alert(result[0].msg); 

catch(ex){ 
alert("Error: "+ex); 

} else alert("No Quote can be generated because Approvals are required"); 

catch (ex) { 
alert("Error: " + ex); 
}

this script currently generates a new PDF file each time the button is pushed and stores in on the opportunity as a new Attachment. I want to update a number filed (Quote_generated_count__c) on the opportunity record (where the button resides) to keep a count of how many times that button is pushed. 
 
Hello - 

I need to update the javascript within this button so that a custom field (i.e. counter__c) is updated every time the button is clicked. Any help is greatly appreciated! 

Here is the current OnClick Java Script that needs modification:

{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/21.0/apex.js")} 
try{ 
// check that Opp has the necessary approvals in order to continue 
var strCheck = "{!Opportunity.Approval_Required__c}".toLowerCase(); 
if ( strCheck.indexOf("quote") == -1) { 
try{ 
var result = sforce.apex.execute( 
'Opportunity_Buttons', // class name 
'createQuote', // method name 
{ // arguments 
oppIDraw:"{!Opportunity.Id}", 
generateQuoteNum:"true" 

); 

if (result[0].success == 'true') { 
//window.location = result[0].msg; 
window.open(result[0].msg, "quoteWin"); 
} else alert(result[0].msg); 

catch(ex){ 
alert("Error: "+ex); 

} else alert("No Quote can be generated because Approvals are required"); 

catch (ex) { 
alert("Error: " + ex); 
}
Hello - 

I'm trying to update a number of opportunities via Data Loader but keep receiving an error message. hoping someone call help me resolve this. 

the error message is: "The record couldn't be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID 30130000000PMSb. Contact your administrator for help."

i do have an active process builder flow but I don't see any issues with that one single record updates. 

thank you in advance. 

Shamus 
Hello - 

I'm looking to get insight into an API call that took place on a certain date for one of our connected apps. Is there a standard area to view this in or can this only be done in the developer console with a query? 

thank you!
How can I modify this code to prohibit custom button from functioning while record is within the approval process? See image for code detail. Also fire alert "Cannot use button while record is within the approval process"

thank you-

User-added image
I have a visualforce email template that uses merge fields. Our sales users would like the Contact Name to be more than just text. They would like that particular field value to be a hyperlink to that record in salesforce. Is this possible? If so, how can that be done?

I've included an image of current code. I assume the adjustment would be made with the relatedTo.Name portion on line 14. 

Thank you -

User-added image
Hello - We expereinced an issue yesterday with a few of our OnClick Java buttons, which seemiling were related to the Winter 15 release for our Instance (NA1). I'm curious as to why preexisting code would have been affected. I'm not a developer but we were able to resolve with a few lines. I'm just curious as to what new upgrade caused this and how I could have been made aware of it before the issue came about. 

Old Code:
try{
    var result = sforce.apex.execute(
        'Opportunity_Buttons', // class name
        'createQuote', // method name
        { // arguments
            oppIDraw:"{!Opportunity.Id}",
            generateQuoteNum:"false"
        }
    );
    
    if (result[0].success == 'true') {
        // window.location = result[0].msg;
        window.open(result[0].msg, "quoteWin");
    } else alert(result[0].msg);
}
catch(ex){
    alert("Error: "+ex);
}


Updated Code:
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/21.0/apex.js")}

try{
    var result = sforce.apex.execute(
        'Opportunity_Buttons', // class name
        'createQuote', // method name
        { // arguments
            oppIDraw:"{!Opportunity.Id}",
            generateQuoteNum:"false"
        }
    );
    
    if (result[0].success == 'true') {
        // window.location = result[0].msg;
        window.open(result[0].msg, "quoteWin");
    } else alert(result[0].msg);
}
catch(ex){
    alert("Error: "+ex);
}

thank you in advance! 
I'm looking to track/count each time a custom button is clicked. i.e. each time Send Quote is clicked, i'd like to see the count go up incrementally. *This custom button is an onclick javascript. Thank you in advance. 
I have this OnClick java button that I need to modify so that it also marks a custom field True while processing. Here is the current code:

{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/25.0/apex.js")} 

// Call the web service method to display the Email Author JSP page for 
// the Work Order email template. Result is an object with success="true" or "false" 
// and msg = "error message or other string." 
try { 
var result = sforce.apex.execute( 
'Work_Order_Buttons', // class name 
'sendWorkOrder', // methodName 

oppIdraw: "{!Work_Order__c.Id}" 

); 
if (result[0].success == 'true') { 
window.location.href = result[0].msg; 

else { 
alert(result[0].msg); 


catch (ex) { 
alert("Error: " + ex); 

any help is appreciated! thank you- 
Hello - 

I need to update the javascript within this button so that a custom field (i.e. counter__c) is updated every time the button is clicked. Any help is greatly appreciated! 

Here is the current OnClick Java Script that needs modification:

{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/21.0/apex.js")} 
try{ 
// check that Opp has the necessary approvals in order to continue 
var strCheck = "{!Opportunity.Approval_Required__c}".toLowerCase(); 
if ( strCheck.indexOf("quote") == -1) { 
try{ 
var result = sforce.apex.execute( 
'Opportunity_Buttons', // class name 
'createQuote', // method name 
{ // arguments 
oppIDraw:"{!Opportunity.Id}", 
generateQuoteNum:"true" 

); 

if (result[0].success == 'true') { 
//window.location = result[0].msg; 
window.open(result[0].msg, "quoteWin"); 
} else alert(result[0].msg); 

catch(ex){ 
alert("Error: "+ex); 

} else alert("No Quote can be generated because Approvals are required"); 

catch (ex) { 
alert("Error: " + ex); 
}
Hello - 

I'm trying to update a number of opportunities via Data Loader but keep receiving an error message. hoping someone call help me resolve this. 

the error message is: "The record couldn't be saved because it failed to trigger a flow. A flow trigger failed to execute the flow with version ID 30130000000PMSb. Contact your administrator for help."

i do have an active process builder flow but I don't see any issues with that one single record updates. 

thank you in advance. 

Shamus 
Hello - 

I'm looking to get insight into an API call that took place on a certain date for one of our connected apps. Is there a standard area to view this in or can this only be done in the developer console with a query? 

thank you!
I'm looking to track/count each time a custom button is clicked. i.e. each time Send Quote is clicked, i'd like to see the count go up incrementally. *This custom button is an onclick javascript. Thank you in advance.