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

Best way to show an information/warning message






Every product have a default carrier(look up) and a list of authorized carrier(list).

My salesman will be able to choose a carrier for the Opportunity Product even if the carrier isn't in the product authorized carrier by a lookup.




In that case i want to show a message to the salesman as  "for the some product you didn't choose authorized carriers, please make sure to check the delivery costs with de logistics".


I know that i can check my criteria with a Trigger or using Workflow rules/and/ CheckBox.
But my question is about the best way to show up this message. i made a research but i didn't really understand.




I wanted to know if it's possible to generate a pop-up when my user is going to work on an Opportunity X.

My idea is, to show every product + carrier for the product everytimes when the user go to see this opportunity except if my salesman check "i understood - or - don't show me this message again."



Thanks dear developers 


I am sending a sample code
<center> <a href="javascript&colon;if (window.confirm('Do you want to Reject the {!}')) RejectHighStatus('{!l.Id}');" style="font-weight:bold">
<apex:image value="{!$Resource.Reject}" width="15%" title="Reject"/> 
</a> </center>
  <apex:actionFunction name="RejectHighStatus" action="{!Reject}" reRender="table">
<apex:param name="ApplicationId" value="" assignTo="{!AppId}" />

Thanks for the answer but i don't really understood how can i use it?




you can do using the Javascript.


You can see sample code


it will ask Do you want really Delete?


If press OK it will delete like examples will suitable for your question. 




maybe try to  add field in the User object as checkbox - 'ShowWarningMsg' and use it to decide if to show him the message (when he click that he doesn't want to view those messages, set the checkbox to false).




i don't want to delete anything ..;/


@Liron169:  i agree with you  i was thinking to set a checkbox to allow the user to hide the message or not.

But i didn't unsertand how to show up my message. =/


I can Understand .. You want the Verify the Carrier with the authorizsed Carrier. If not then U have to show the errror . ..


Trigger .


In this the error Message will come up then Click of button . . .I mean a DML event . . . But the YOu can error on the top the page .

You have to use this . if  You are the using the input Text . I mean "Not  the Standard field "


Validation rule . .

this is the best possible way . but it depends where you have the list of the Authorizsed  dealer .. . . Because You have cross Verify the current data from there . right . . .It again run the on DML Evetn . .


Javascript . .


this can the run on the "onchange" . The Moment  user put the value , the validation rules fire ...  But in this also . . You have take the list of the all the authorised dealr . . . .






if you want to show message from javascript its:  alert("MESSAGE TEXT");


but it's will be more complicate, and more code involve if you want also to add there checkbox/button and other components.



I think the best solution for you is to use the visualflow for filling the lookup field in the object.


it will somethink like this (not 100% complete): screen with available reocrds for the lookup fields.

2.get the field ShowWarningMessage for the user.

3. if this field is 'Y' then show him screen with message + checkbox field to set this field to false

4.if the user choose to set this check box to 'N', then update the field in the user table.

5. if this tield is 'N' continue and update the record with the value that the user chose.


it might seems slighty complecate, but it will save you writing code and maintainance in the future


@Ankit: the authorized carrier are stored on the Product throught a picklist. Product also have and a text field to have the name of the basic/default carrier- the Opportunity product just have a look up to select his carrier.
So i'm thinking that isn't too hard to compare the choosen value with the authorized list. don't you?


@Liron169: Ok i don't think that the checkbox -or- button components is important. But to do as you said i have to edit my current page?or your meaning is to add the message to the creation page? 


sorry but it's kind a mess for me @___@



I understand that you wnat to show popup message to the user, and there add checkbox to allow him diable this messages. it's need some develop and customization.


So again, I think the best tool for this is the visualflow.

if you are not familiar with this tool, try reading its guide:




@Liron169: How stupid i'm i...i didn't know salesforce have the visualflow...i learn apex and visual force... i'll give a look to the visual flow...and post a reply with my tests!


It looks complicated for this small message ..haha


This is because you not yet familiar with the visual flow.

But if it can be used, than it better than written a code.


Hey , it's pretty awesome!!


But i still don't get one thing...

I how to link my flow to a regular record creation??

The flow have URL, I think it goes - \flow\FLOW_NAME

You can call this link from a button, visualforce page, java script. and actually from any place that you can open URL