Forum Discussion

IvanWeiss's avatar
IvanWeiss
Qrew Captain
5 years ago

Pop Up Requiring Text

I have an Opportunities table in the CRM portion of my project management project.  I have several buttons to update the status of the opportunity.  The two I am looking to enhance the features are "Won" and "Lost"

Each of these works by using an api call to edit the closing date to Today() and change the record to mark it lost.

This prompts automations to run which are set based on the status to create tasks to various team members to start processing the order.

I created a "Lost Opportunity Notes" Field which is a multiline but no one is completing it.  I need a way to prevent the user from hitting Lost until that is finished...  I thought about maybe a javascript alert but my code is not doing anything....  I can click and nothing happens.  Any thoughts?

//Button Functionality:
//
//Check the current Opportunity Stage
//
//If not Lost display button as gray
//Code should change the Opportunity status to Lost

var text CLASS = If([Stage]="Lost","btn btn-danger btn -sm","btn btn-default btn -sm");
var text FONTCOLOR = If([Stage]="Lost", "#FFFFFF", "#A9A9A9");
var text lABEL = "Lost";

//Change the Opportunity Stage to Lost
var text URLPASSED = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
"&rid=" & [Record ID#] &
"&apptoken=HIDDEN" &
"&_fid_9=Lost" &
"&_fid_23=" & URLEncode(Today()) &
"&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]);

//Create edit functionality
var text URL =
If([Lost Comments] = "", "javascript: alert ('Please enter comments in the lost notes box as to why we lost this opportunity.')" ,"href='" & $URLPASSED & "'");



If([Stage]="Won","",
[Stage]="Lost","",
"<a class='" & $CLASS & "' style='color: " & $FONTCOLOR & "; text-decoration: none'" & $URL & ">" & $LABEL & "</a>"
)


Any help as to what might be wrong would be super appreciated!

------------------------------
Ivan Weiss
------------------------------
No RepliesBe the first to reply