AlexKnox
5 years agoQrew Member
If Function with Java Script
Hi all - I had a formula button working and then it doesnt seem to be working anymore and I cannot find the problem.
I have a button that will create several child records once clicked. When the button is clicked, it will update a checkbox field which triggers an automation to copy records to the parent record.
I like using a dialog box to let the end user know what happened. The dialog will either say tasks being created or tasks already created. This is done to avoid duplicate tasks being created.
Right now, it is always saying that the tasks have already been created even the checkbox is not checked and there are zero child records
Here is the code that I have used
var text URL= URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
"&rid=" & URLEncode ([Record ID#]) &
"&_fid_104=Yes" &
"&apptoken=xxxxxxxxx";
var text RDR= URLRoot() & "db/" & Dbid() & "?a=dr" &
"&rid=" & URLEncode ([Record ID#]) &
"&apptoken=xxxxxxxxx";
If(ToText([Tasks Created]) = "No",
"javascript:" &"$.get('" & $URL & "',function(){" &"location.reload(true);" &"});" & "void(0); alert('Project Tasks are being created!');",
"javascript:" &"$.get('" & $RDR & "',function(){" &"location.reload(true);" &"});" & "void(0); alert('Project Tasks have already been created! Please check the task list at the bottom of the screen.');"
)
------------------------------
Alex Knox
------------------------------
I have a button that will create several child records once clicked. When the button is clicked, it will update a checkbox field which triggers an automation to copy records to the parent record.
I like using a dialog box to let the end user know what happened. The dialog will either say tasks being created or tasks already created. This is done to avoid duplicate tasks being created.
Right now, it is always saying that the tasks have already been created even the checkbox is not checked and there are zero child records
Here is the code that I have used
var text URL= URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
"&rid=" & URLEncode ([Record ID#]) &
"&_fid_104=Yes" &
"&apptoken=xxxxxxxxx";
var text RDR= URLRoot() & "db/" & Dbid() & "?a=dr" &
"&rid=" & URLEncode ([Record ID#]) &
"&apptoken=xxxxxxxxx";
If(ToText([Tasks Created]) = "No",
"javascript:" &"$.get('" & $URL & "',function(){" &"location.reload(true);" &"});" & "void(0); alert('Project Tasks are being created!');",
"javascript:" &"$.get('" & $RDR & "',function(){" &"location.reload(true);" &"});" & "void(0); alert('Project Tasks have already been created! Please check the task list at the bottom of the screen.');"
)
------------------------------
Alex Knox
------------------------------