Forum Discussion
- ChristianStampe8 years agoQrew Trainee
Hello Joshua,
Thank you for the suggestion, that is something I've been researching via the below forum post. In combination with Append or Prepend text fields. The challenge I had there is the walkthrough is specific to text fields. I also have Date and checkbox fields to contend with and would need to build this out for approx. 15 fields individually between my two table records. This is one possible solution I have yet to try, but wanted to research my options and see what other suggestions where out there.
https://community.quickbase.com/quickbase/topics/logging-edits-to-a-record
- JoshuaTate8 years agoQrew CadetHi Christian,
Below handles text and checkbox's - Numbers and dates will also record so long as a text box or checkbox is edited after - yet to work out how to resolve this. I have also added a script to capture and insert the IP address of the logged in user. please see below code:// Below sets up the IPPromise to be called later
var IPpromise = $.ajax({
type: "GET",
url: "https://api.ipify.org/?format=jsonp";,
dataType: "jsonp"
});
$.ajaxSetup({data: {apptoken: apptoken}});
$("#_fid_6, #_fid_9, #_fid_64, #_fid_98, #_fid_150, #_fid_72, #_fid_114, #_fid_132, #_fid_77, #_fid_85, #_fid_7, #_fid_8, #_fid_11, #_fid_12, #_fid_13, #_fid_14, #_fid_15, #_fid_16, #_fid_17, #_fid_18, #_fid_19, #_fid_20, #_fid_21, #_fid_22, #_fid_23, #_fid_24, #_fid_25, #_fid_26, #_fid_27, #_fid_28, #_fid_29, #_fid_30, #_fid_31, #_fid_32, #_fid_33, #_fid_34, #_fid_35, #_fid_36, #_fid_37, #_fid_38, #_fid_39, #_fid_40, #_fid_41, #_fid_42, #_fid_43, #_fid_44, #_fid_45, #_fid_46, #_fid_47, #_fid_48, #_fid_49, #_fid_50, #_fid_51, #_fid_52, #_fid_53, #_fid_54, #_fid_55, #_fid_56, #_fid_57, #_fid_58, #_fid_59, #_fid_60, #_fid_61, #_fid_62, #_fid_63, #_fid_65, #_fid_66, #_fid_67, #_fid_68, #_fid_69, #_fid_70, #_fid_71, #_fid_91, #_fid_100, #_fid_102, #_fid_122, #_fid_127, #_fid_129, #_fid_133, #_fid_136, #_fid_139, #_fid_140, #_fid_147, #_fid_149, #_fid_153 , #_fid_154 , #_fid_155 , #_fid_156 , #_fid_157 , #_fid_158 , #_fid_159 , #_fid_160 , #_fid_161 , #_fid_162").on("change", function() {
log = [];
_.each([6, 9, 64, 98, 150, 72, 114, 132, 77, 85, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 65, 66, 67, 68, 69, 70, 71, 91, 100, 102, 122, 127, 129, 133, 136, 139, 140, 147, 149, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162], function(fid) {
oldValue = $("[name=_fid_oval_" + fid + "]").val();
newValue = $("#_fid_" + fid).val();
newcheckValue = $("#_fid_" + fid).prop("checked");
oldcheckValue = $("[name=_fid_oval_" + fid + "]").prop("checked");
type = $("#_fid_" + fid).attr("type");
if (oldValue != newValue) {
label = $("label[for=_fid_" + fid + "]").text();
if (type == "checkbox" && oldcheckValue != newcheckValue) { // Push to log if checkbox AND values unequal
log.push(label + " was =" + (oldcheckValue ? "true" : "false") + "; now =" + newcheckValue);
}
else if (type == "checkbox" && oldcheckValue == newcheckValue) { // Do nothing if checkbox AND values equal
} else { // Push to log if not a checkbox or date
log.push(label + " was =" + oldValue + "; now =" + newValue);
}
}
})
// Below pushs the IP address from the promise above
$.when(IPpromise).then(function(json) {
var ip = json.ip;
log.push("IP of User: " + ip);
});
$("#_fid_152").html(log.join("\n"));
}); - ChristianStampe8 years agoQrew Trainee
Hi again Joshua,
So far your suggestion seems to meet my needs best based on its description. My use of coding in QB apps has been very limited however, I consider myself a novice in that area. Any chance there's a walkthrough example somewhere I can reference to get my bearings? Basic steps etc. The related forum discussions bounce all over and many of the links no longer work.
- QuickBaseCoachD8 years agoQrew Captain.. or use my no code suggestion below ....
- JoshuaTate8 years agoQrew CadetHi Christian,
Unfortunately not, below is as basic as i can do. The no code suggestion from Mark is a good one for small qty of field logs - I understand Quickbase is bringing out audit logs shortly as well - you should be able to get in on the BETA.
Simple steps are:
1. setup IOL technique
2. add the code above to your module.js
3. add a text field with logging set as required
4. get the logging field id in the code above fid_152 is the field you replace with your fid.
5. Replace all of the below field IDs with the ones you wish to trigger record and update into your code page:$("#_fid_6, #_fid_9, #_fid_64, #_fid_98, #_fid_150, #_fid_72, #_fid_114, #_fid_132, #_fid_77, #_fid_85, #_fid_7, #_fid_8, #_fid_11, #_fid_12, #_fid_13, #_fid_14, #_fid_15, #_fid_16, #_fid_17, #_fid_18, #_fid_19, #_fid_20, #_fid_21, #_fid_22, #_fid_23, #_fid_24, #_fid_25, #_fid_26, #_fid_27, #_fid_28, #_fid_29, #_fid_30, #_fid_31, #_fid_32, #_fid_33, #_fid_34, #_fid_35, #_fid_36, #_fid_37, #_fid_38, #_fid_39, #_fid_40, #_fid_41, #_fid_42, #_fid_43, #_fid_44, #_fid_45, #_fid_46, #_fid_47, #_fid_48, #_fid_49, #_fid_50, #_fid_51, #_fid_52, #_fid_53, #_fid_54, #_fid_55, #_fid_56, #_fid_57, #_fid_58, #_fid_59, #_fid_60, #_fid_61, #_fid_62, #_fid_63, #_fid_65, #_fid_66, #_fid_67, #_fid_68, #_fid_69, #_fid_70, #_fid_71, #_fid_91, #_fid_100, #_fid_102, #_fid_122, #_fid_127, #_fid_129, #_fid_133, #_fid_136, #_fid_139, #_fid_140, #_fid_147, #_fid_149, #_fid_153 , #_fid_154 , #_fid_155 , #_fid_156 , #_fid_157 , #_fid_158 , #_fid_159 , #_fid_160 , #_fid_161 , #_fid_162").on("change", function() {
log = [];
_.each([6, 9, 64, 98, 150, 72, 114, 132, 77, 85, 7, 8, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 65, 66, 67, 68, 69, 70, 71, 91, 100, 102, 122, 127, 129, 133, 136, 139, 140, 147, 149, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162] - ChristianStampe8 years agoQrew Trainee
I'm soaking up the knowledge, I can see your suggestion being applicable to us as well. Especially if we need to track a larger # of fields later down the road. It's still much appreciated. Also, if you have details on that beta please share.
- RyanStanford16 years agoQrew CaptainSorry to add to an old post here... but if I'm understanding this correctly... you're tracking one field (exmple f_152)... that's what QB is tracking for changes...
the Code Page tracks everything else, and appends to the log string which is then pushed to the f_152 field... which then QB updates their audit log with that field's information. - RyanStanford16 years agoQrew CaptainIt's looking like this JQuery notation of $("#_fid_152") isn't getting the proper selector from QB, so I'm not sure if this code is actually working anymore.