function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sales4cesales4ce 

Help with Java script!

Hi,

 

I have a custom button (Remove Contact) on my Standard Contact Object, which when clicked does a Logical deletion.

I have implemented this using VisualForce Page and a controller extension that extends standard "Contact" object.

 

So, i am overriding the "Remove Contact"  button with my visualforce page. when i click on the button it executes the business logic and displays the VF page accordingly.

 

But, my use-case also requires to prompt a "User Confirmation" like "Do you want to remove". Based on the user response then i have to carry out my business logic. I think we need to use Java script for this when i override "Remove Contact".

But how do i call my VF page after capturing the User response on the confirmation.

 

Here is my VF page:

 

<apex:page standardController="Contact"  extensions="Inactiveandmove" action="{!Move}"  >


</apex:page>

Any help on this is highy appreciated.

 

Thank You!

 

rubixtiousrubixtious

You can add some custom javascript like below:

 

 

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

if( 
(
{!ISPICKVAL( Opportunity.StageName , 'Initiate Contract Process')}
)

&&

{!ISPICKVAL( Opportunity.Type, 'New Business')} 
)
{
window.location ='/apex/controllerdispatchercontract?oppid={!Opportunity.Id}&acctid={!Opportunity.AccountId}';
}
else
{
alert('You can only access contracts when the type = new business and stage = initiate contract process. If you need to edit an existing contract, go to the contract on the Account');
}

 

sales4cesales4ce

Thanks for your reply!

My question is how would i call a controller extension method when my Button behavior is " Onclick Javascript"?

 

Thanks,

Sales4ce