In the UI Designer, how can i make a field default to the value of another field. i.e. on the Project Screen i want field PERSON_ID_OWNER to default to CREATED_BY, i have putting the field path in the default value field but it just prints the path and not the value?
its important that it populates as soon as they hit the ‘New’ button so that they onlty need to change it if it needs to be a different value
Following is an approach you can use to achieve your requirement in the Web Client.
Initially create the following the client script
Client Script
Script -
var currentDes = getControlValue("project","project_title"); if (currentDes == null) { var person = getUserInfo('personId'); setControlValue("project","person_id_owner",person); }
Bind the above script with the screen events of the customized project screen.
Screen Events - Project
Following is the output when you login through STUDIO user, the owner is fetched.
Final output
Logic behind the client script - The client script will be triggered every time the page data loads .To make sure that the script is triggered for the “NEW” scenario, the “if” condition is added to the peoject_title/description which is a required field. Therefore this fetching will be performed when creating a new project.
Following is an approach you can use to achieve your requirement in the Web Client.
Initially create the following the client script
Client Script
Script -
var currentDes = getControlValue("project","project_title"); if (currentDes == null) { var person = getUserInfo('personId'); setControlValue("project","person_id_owner",person); }
Bind the above script with the screen events of the customized project screen.
Screen Events - Project
Following is the output when you login through STUDIO user, the owner is fetched.
Final output
Logic behind the client script - The client script will be triggered every time the page data loads .To make sure that the script is triggered for the “NEW” scenario, the “if” condition is added to the peoject_title/description which is a required field. Therefore this fetching will be performed when creating a new project.
The same approach will work for smart client as well. I did not try it out. Following are the some the places to be looked at when implementing the approach.
The Client type should include Smart Client
In order to get the person_id use - getUserInfo("PersonID"); (In the client script guide it has been mentioned in this manner)
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.