GeoffreyHarmuth
8 years agoQrew Captain
Run script in a button
So I have a button called "Send". Basically, when this button is pushed, it changes 2 fields. Here is the code:
var text URLONE = URLRoot()& "db/" &Dbid()& "?a=API_EditRecord" & "&rid=" & [Job Number]
& "&apptoken= xxxxxxx" & "&_fid_40=Work In Progress&_fid_102=Sent&_fid_150=Sent";
var text URLTWO = URLRoot() & "db/" & Dbid() & "?a=q&qid=22";
$URLONE
& "&rdr=" & URLEncode($URLTWO)
At the same time that this button is pushed, I want to run an external PHP script through the following command:
http://weburlgoeshere.com/push.php?id=[DEVICE_ID]&title=New job&msg=You have a new job.
What this does is trigger a push notification to a device where the [user] is the person logged into that device.
Now I have 2 issues with this:
1) Firstly how do I run that URL everytime the button is pressed?(im sure this is pretty easy)
2) Secondly, where the [Device_ID] placeholder is above in the URL, I need it to fetch this from another table within the app. Basically what is happening is, the push notification can only work if the device ID matches that on the logged in user. The device ID has to be pulled from a seperate table in the App (which is updated everytime a user logs in). The common link here is the [user] field. to simplify:
I need to lookup the [device_id] field in another table, using the [user] field in this table as the "common" field. similar to an excel Vlookup.
Its pretty complicated, but I hope this makes sense.
var text URLONE = URLRoot()& "db/" &Dbid()& "?a=API_EditRecord" & "&rid=" & [Job Number]
& "&apptoken= xxxxxxx" & "&_fid_40=Work In Progress&_fid_102=Sent&_fid_150=Sent";
var text URLTWO = URLRoot() & "db/" & Dbid() & "?a=q&qid=22";
$URLONE
& "&rdr=" & URLEncode($URLTWO)
At the same time that this button is pushed, I want to run an external PHP script through the following command:
http://weburlgoeshere.com/push.php?id=[DEVICE_ID]&title=New job&msg=You have a new job.
What this does is trigger a push notification to a device where the [user] is the person logged into that device.
Now I have 2 issues with this:
1) Firstly how do I run that URL everytime the button is pressed?(im sure this is pretty easy)
2) Secondly, where the [Device_ID] placeholder is above in the URL, I need it to fetch this from another table within the app. Basically what is happening is, the push notification can only work if the device ID matches that on the logged in user. The device ID has to be pulled from a seperate table in the App (which is updated everytime a user logs in). The common link here is the [user] field. to simplify:
I need to lookup the [device_id] field in another table, using the [user] field in this table as the "common" field. similar to an excel Vlookup.
Its pretty complicated, but I hope this makes sense.