apautz Posted November 11, 2014 Report Share Posted November 11, 2014 Hi I have a field where I want to record the username of the person who updated the record. How do can I automatically populate that with the username of the currently logged in user? Ant m2367 1 Quote Link to comment Share on other sites More sharing options...
Jan Posted November 13, 2014 Report Share Posted November 13, 2014 Hello Ant, You can check "Enable Advanced Options" and "Enable parameters" check-boxes on the DataPage DataSource step, then select your field, open the "Advanced" tab, in the "External Associations and Defaults" section check "On load" checkbox, select the "Authentication Fields" in the dropdown and select the username field. There is the article about automatically populating fields, but it describes the work with System Parameters. I hope, it helps. Quote Link to comment Share on other sites More sharing options...
apautz Posted November 13, 2014 Author Report Share Posted November 13, 2014 Hi Jan Thanks for that. It works perfectly on adding a new record but for editing existing records I don't have the On Load option under External Associations and Defaults". There is only an On Exit option. Is there a way to do this when updating existing records? Ant Quote Link to comment Share on other sites More sharing options...
Jan Posted November 14, 2014 Report Share Posted November 14, 2014 Hi Ant, You can try the following steps: - add a Virtual field to your page, select Hidden in the "Form Element" field, select Authentication Fields and your field in the "On load assign" fields; - add a Header&Footer element and add the following code to the Footer: <SCRIPT LANGUAGE="JavaScript"> function insert_username() { var auth_username = document.getElementById("cbParamVirtual1").value; document.getElementById("EditRecordusername").value = auth_username; } document.getElementById("caspioform").onsubmit=insert_username; </SCRIPT> Please insert the number of your Virtual Field instead of 1 in "cbParamVirtual1" and the name of your field instead of "username" in "EditRecordusername". The username will be inserted, when the user clicks the "Submit" button. I hope, it helps. Quote Link to comment Share on other sites More sharing options...
apautz Posted November 18, 2014 Author Report Share Posted November 18, 2014 Thanks Jan! That did the trick. All working now. Quote Link to comment Share on other sites More sharing options...
Jan Posted November 19, 2014 Report Share Posted November 19, 2014 You are welcome! I am glad my suggestion helped. Quote Link to comment Share on other sites More sharing options...
ElliottGen Posted January 1, 2015 Report Share Posted January 1, 2015 Thank you for the great information! I would not have discovered this otherwise! regards Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.