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
oceanofstarsoceanofstars 

how to display a warning message

Hi All

 

We have our custom build quote tool. From quote tool we have a button called CLOSED WON where we can close the opportunity. If any body wants to change something in the quote they need to change the opportunity stage from closed won to a different page from opportunity and then they can make some changes in the quote and can hit CLOSE WON button from quote.

 

Now i want to display a warning message when anybody try to change some information in the quote for the CLOSE/WON opportunities..want to display as this opportunity went to different environment and any changes will not effect immediately. After displaying this mess the sales rep can save the opportunity or can cancel the changes. Please help me out how can this be done. Appreciate your help in advance

 

 

Best Answer chosen by Admin (Salesforce Developers) 
b-Forceb-Force

 

ApexPages.Message errMsg = new ApexPages.Message(ApexPages.Severity.ERROR, '<b> Any changes made to the quote will not flow to Magnys<b/>');
ApexPages.addMes(errMsg);

 

 

tyry with above code snippet

 

Thanks,

Bala

All Answers

b-Forceb-Force

 

Are you doing this changes on standard salesforce page or any custom visual force page.

 

if you aretrying in vf page,you can use javascript confirm function http://www.tizag.com/javascriptT/javascriptconfirm.php

 

based on user answer either way you can commit the changes or canceled them

by invoking some action function

 

Thanks,

Bala

 

 

 

oceanofstarsoceanofstars

Thanks bala for the reply...I am planning to do this please let me know how does this work...Instead on custom VF page i want to make it on standard opportunity page. Users can close/won the opportunity from the quote. But, before they want to make any changes in the quote for the closed/won opportunity first they need to change the opportunity stage from closed/won to a different stage so that they can enter in to quote and can make some changes. This opportunity stage they need to change from the opportunity page. So, i am planning to create a checkbox field and whenever they change the opportunity stage from closed/won to a different one  the check box will become true. Now i want to write a logic in the controller if (Checkbox==True) display opportunity already went to different environment.

 

Can you help me with the logic how to define this in the controller. Is this possible to get a warning mess in the standard page with the way i am thinking. Appreciate your help

b-Forceb-Force

Hi,

 

we can continue with your idea of adding one more field on Opportunity record in page,

added to this please create one more field on Opportunity object Type=DateTime , Value ==> Timestamp value when Opportunity stage changed from Close/Won to other value, we can achive this field update and Workflow rule.

 

Question: When you want this warning message, when Opty Standard page loaded or when user try to edit this.

 

If you want this when user try to edit this , [We can overide edit button and use our custom button]

if you want this when page loaded , we can go for javascript combination or VF page approach.

 

let me know , so we can build this accordingly,

 

Thanks ,

Bala

Proposal ButtonProposal Button

Thanks bala.. I am almost done i  am geting the warning mess on the custom VF page but the oly thing is i am unable to display the warning mess in red even though i added font color = red tag iam getting it in black color. Here is the thing i did. I created a check box on the opportunity page and added a work flow and field update to that check. Wghenever opp changes from closed/won to a different stage the check box will become true. Whenever the check box is true this warning mess will be displayed in custom VF page. Here are the things i added in the controller and in vf page

 

Controller:

 

 if(Opportunity.Not_Closed_won__c == True)
        {        
        ApexPages.Message errMsg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Any changes made to the quote will not flow to Magnys');
ApexPages.addMessage(errMsg);
 }

 if(Opportunity.Not_Closed_won__c == True)        {                ApexPages.Message errMsg = new ApexPages.Message(ApexPages.Severity.ERROR, 'Any changes made to the quote will not flow to Magnys');ApexPages.addMessage(errMsg); }

 

 

VF page:

 <font color="red"><b><apex:messages /></b></font>

 

The characters which are in red is the warning mess i am trying to display but i am geeting the warning mess in black in the vf page. Can you please let me know why?

b-Forceb-Force

try with ApexPages.Severity.FATAL in controller

 

keep vf code page simple like

 

<apex:messages />

 

 

 

`Hope this will help you.

 

Thanks,

Bala

b-Forceb-Force

if you want HTML formated error message

 

in vf page

<apex:messages  escape="false"/>

 

inside controller use html formated string as error message

e.g.: <b>This is my bold error ....</b>

 

 

Thanks,

Bala

b-Forceb-Force

please check this post Html error message

 

Thanks,

Bala

Proposal ButtonProposal Button

Thanks bala for your help. I changed to following way in my controller but it is throwing me an error. is this the right way i am defining in the controller. I am trying to get atlest HTML version. I mentioned in blue color the way i am defining in the controller. 

 

 

ApexPages.Message errMsg = new ApexPages.Message(ApexPages.Severity.ERROR, <b> 'Any changes made to the quote will not flow to Magnys'<b/>);
ApexPages.addMes

 

Proposal ButtonProposal Button

Thanks bala for your help. I changed to following way in my controller but it is throwing me an error. is this the right way i am defining in the controller. I am trying to get atlest HTML version. I mentioned in blue color the way i am defining in the controller. 

 

 

ApexPages.Message errMsg = new ApexPages.Message(ApexPages.Severity.ERROR, <b> 'Any changes made to the quote will not flow to Magnys'<b/>);
ApexPages.addMes(errMsg);
b-Forceb-Force

 

ApexPages.Message errMsg = new ApexPages.Message(ApexPages.Severity.ERROR, '<b> Any changes made to the quote will not flow to Magnys<b/>');
ApexPages.addMes(errMsg);

 

 

tyry with above code snippet

 

Thanks,

Bala

This was selected as the best answer
Proposal ButtonProposal Button

Thankyou very much bala for your support...i am able to get the warning mess in red..appreciate your help