IvanWeiss
4 years agoQrew Captain
Cleaning up javascript in formula URL's
Hi everyone,
I have several formula URL's with the following code in them. Even though I know technically they can stay, I just cannot add in the future I am trying to comply with the new policies and get the script out of there.... The intent of the first javascript call is to popup an alert if a field is not completed and if so stop executing. The second javascript call is to alert the user the code did run so they know. What is the best way to implement this under the new guidelines?
Thanks in advance for your help!!!!
//Button for the RFI log to review a construction admin request on the particular button. It will first check to see if the construction admin was selected and if not display a message. Otherwise it will create a task for the Construction Admin Reviewer
//Check if Construction Administration Reviewer was populated
If(IsNull([Project - Construction Administration Reviewer]),
//If not pop up a dialogue prompting the user
"javascript: alert ('You must set the Construction Administration Reviewer on the Project first. Request was not submitted.')",
//If it was populated create URL to assign a task to that person to perform the review
var text URL = URLRoot() & "db/" & [_DBID_TASKS] & "?a=API_AddRecord" &
"&_fid_21=" & URLEncode ([Project Number]) &
"&apptoken=xxxxxxxx" &
"&_fid_6=" & URLEncode("Review RFI for Project ") & URLEncode([Project - Name]) & ": " & URLEncode([Company - Name]) &
"&_fid_8=" & URLEncode(Today()) &
"&_fid_9=" & URLEncode(WeekdayAdd(Today(),3)) &
"&_fid_23=" & URLEncode("Construction Administration") &
"&_fid_24=" & URLEncode("Assigned") &
"&_fid_28=" & URLEncode("Not Applicable") &
"&_fid_52=" & URLEncode([Project - Construction Administration Reviewer]) &
"&_fid_69=" & URLEncode([Project Coordinator]) &
"&z=" & Rurl();
//Dialogue to confirm the request was submitted
"javascript:" &"$.get('" & $URL & "',function(){" &"location.reload(true);" &"});" & "void(0);alert('Request Created');"
)
------------------------------
Ivan Weiss
------------------------------
I have several formula URL's with the following code in them. Even though I know technically they can stay, I just cannot add in the future I am trying to comply with the new policies and get the script out of there.... The intent of the first javascript call is to popup an alert if a field is not completed and if so stop executing. The second javascript call is to alert the user the code did run so they know. What is the best way to implement this under the new guidelines?
Thanks in advance for your help!!!!
//Button for the RFI log to review a construction admin request on the particular button. It will first check to see if the construction admin was selected and if not display a message. Otherwise it will create a task for the Construction Admin Reviewer
//Check if Construction Administration Reviewer was populated
If(IsNull([Project - Construction Administration Reviewer]),
//If not pop up a dialogue prompting the user
"javascript: alert ('You must set the Construction Administration Reviewer on the Project first. Request was not submitted.')",
//If it was populated create URL to assign a task to that person to perform the review
var text URL = URLRoot() & "db/" & [_DBID_TASKS] & "?a=API_AddRecord" &
"&_fid_21=" & URLEncode ([Project Number]) &
"&apptoken=xxxxxxxx" &
"&_fid_6=" & URLEncode("Review RFI for Project ") & URLEncode([Project - Name]) & ": " & URLEncode([Company - Name]) &
"&_fid_8=" & URLEncode(Today()) &
"&_fid_9=" & URLEncode(WeekdayAdd(Today(),3)) &
"&_fid_23=" & URLEncode("Construction Administration") &
"&_fid_24=" & URLEncode("Assigned") &
"&_fid_28=" & URLEncode("Not Applicable") &
"&_fid_52=" & URLEncode([Project - Construction Administration Reviewer]) &
"&_fid_69=" & URLEncode([Project Coordinator]) &
"&z=" & Rurl();
//Dialogue to confirm the request was submitted
"javascript:" &"$.get('" & $URL & "',function(){" &"location.reload(true);" &"});" & "void(0);alert('Request Created');"
)
------------------------------
Ivan Weiss
------------------------------