Blog Post

The Qrew Blog

Sequential Operations in Formula fields.

HimanshuSharma's avatar
Qrew Trainee
3 years ago

There is a discussion regarding the future behavior of Formula fields,

Often we need to perform sequential operations using the Quickbase API's like API_EditRecord, API_PurgeRecords etc. In some requirements we often need to perform the 2nd API call only after the 1st one has completed. Since the JavaScript is going to be prohibited anywhere other than QB code pages we would need another way to perform such an operation.

An example of this kind of operation:

This is the code of field type "URL (formula)" which shows as a button.

var text url_1 =
URLRoot() & "db/" &Dbid()& "?a=API_EditRecord" &
"&rid=" & [Record ID#] &
"&apptoken=xxxxxxxxxx" &
"&_fid_9987=" & [Current User];

var text url_2 =
URLRoot() & "db/" &Dbid()& "?a=API_EditRecord" &
"&rid=" & [Record ID#] &
"&apptoken=xxxxxxxxxx" &

If([Prod Status]="Done",
"javascript:" & "$.get('" & $url_1 & "',\nfunction(){" &"$.get('" & $url_2 & "');"&"});\n"&"void(0);"
,null) //Using the jQuery "get" method.

In the above example $url_2 has to be carried out only when $url_1 has finished, jQuery get method allows us to do nested calls. The get method of $url_2 is invoked only after the callback function of $url_1 is called. 

This will be a helpful way in many scenarios.


Himanshu Sharma
Published 3 years ago
Version 1.0