Custom Alert Message On Salesforce 'Submit For Approval' Button !?!

Recently I came across a scenario where the business wanted to see the custom message on click of submit for approval button?!? When we understood what was happening on click of the button, It was lot easier for us to implement that.

Salesforce.com apps are being used on the web browsers We can identify what is given to the browser by "right-clicking" on the browser element and seeing what the html for that element, like explained below.

I recommend you do this before proceeding with the solution.

1) Login
2) Go to a record which has an active approval process.
3) Right click on "submit for approval" button
4) Inspect element (Chrome/ Firefox) or view source (safari/ IE and you have to search for "submit for approval" button tag)


There, you will see --

That is just html generated by Salesforce but it has something that we need for this solution. So lets understand that.
It has for confirmation-type alert what is conform()
and it has got redirect url navigateToUrl('/p/process/Submit?retURL=%2F00Q9000000L5LBw&id=00Q9000000L5LBw','DETAIL','submit');
So, onlick of that button a confirmation message pops up and takes our input (Ok/ Cancel) and redirects it to that "/p/process/Submit?id=sobject.id" accordingly.

If that is all the button is doing, I can write my own button which can do this. Can't you write?

And now that we decided to create a custom button, lets give more functionality and domain-friendly alert messages than standard and "understand-salesforce-jargon" messages like "
Unable to Submit for Approval
This record does not meet the entry criteria or initial submitters of any active approval processes. Please contact your administrator for assistance.

Click here to return to the previous page."
 Because we can validate the data within javascript of the custom button.

Lets do it:
1) create a custom buton by the title "Submit For Approval"
2) Include the following script.



var criteria1 = "{!Lead.ProductInterest__c}";
if(criteria1=="GC1000 series")
{
navigateToUrl('/p/process/Submit?retURL=%2F{!Lead.Id}&id={!Lead.Id}','DETAIL','submit');
}
else {
alert("This Lead's Doesn't Have Interest In GC1000 Series, Approval Is Not Needed");
}


3) Include the button on Page layout.

4) Try to enter some value from Product Interest Field and check out put.

The same approach can be used for Convert Lead as well, because "covert Lead" Button is just taking us to /lead/leadconvert.jsp?id={!Lead.Id}


HTH
Prabhan




Comments

  1. Thanks. But how to do the same for 'submit for approval' button in the related list. Please explain.

    The above method only replaces the message in the 'Submit for approval' button in the page layout. Im looking to reflect the same in the related list button too. Do let me know. Thanks much

    ReplyDelete
    Replies
    1. Custom Alert Message On Salesforce 'Submit For Approval' Button !?! >>>>> Download Now

      >>>>> Download Full

      Custom Alert Message On Salesforce 'Submit For Approval' Button !?! >>>>> Download LINK

      >>>>> Download Now

      Custom Alert Message On Salesforce 'Submit For Approval' Button !?! >>>>> Download Full

      >>>>> Download LINK 25

      Delete
  2. Manish,

    There are no direct solutions for that.
    We implemented the following solution for that...
    1) created two record types and two page layouts.
    2) showed the pagelayout with submit for approval button and related list.

    There is also another way which is javascript/ jQuery hack.
    It will hind the html tag which is responsible for the button.
    Please refer tehnerd's blog.

    We can not override the approval related list. :(

    Prabhan

    ReplyDelete
  3. Salesforce Admin Online Training - 21st Century Software ...
    www.21cssindia.com/courses/salesforce-admin-online-training-143.html
    Salesforce admin online training by 21cssindia the largest institute in providing online trainings in all technologies. Salesforce admin training, salesforce ...
    salesforce developer online training| salesforce developer ...
    www.21cssindia.com/.../salesforce-developer-online-training-144.html
    21cssindia provides Salesforce developer online training by real time Experts. Call us +91 9000444287 for online training and demo. Online Salesforce ...
    salesforce crm online training| salesforce crm training| call ...
    www.21cssindia.com/courses/salesforce-crm-online-training-212.html
    21cssindia provides Salesforce crm online training by real time Experts. Call us +91 9000444287 for online training and demo. Online Salesforce crm training ...

    ReplyDelete
  4. "Great blog created by you. I read your blog, its best and useful information. You have done a great work. Super blogging and keep it up.php jobs in hyderabad.
    "

    ReplyDelete
  5. Really I impressed for this blog content, It's really good then check it once through MSBI Online Training Bangalore.

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. Custom Alert Message On Salesforce 'Submit For Approval' Button !?! >>>>> Download Now

    >>>>> Download Full

    Custom Alert Message On Salesforce 'Submit For Approval' Button !?! >>>>> Download LINK

    >>>>> Download Now

    Custom Alert Message On Salesforce 'Submit For Approval' Button !?! >>>>> Download Full

    >>>>> Download LINK Ry

    ReplyDelete

Post a Comment

Popular posts from this blog

Passing URL parameters to controller in Lightning components/ AURA

Lightning spinner inside Button

Nested AURA:IFs in Lightning Components Salesforce