Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..
2024-11-04 12:12 PM
Slightly odd request here - but I have a CO that populates the current user into a user values field when a button is clicked.
However, it only works when the field is visible on layout and NOT hidden by Rules/Actions DDEs.
I have also tried to make it Read Only - and it will populate the field but the field will revert when it goes back to View mode from Edit.
I do not want users to be able to edit this field - and the only workaround I can think of is to make it visually invisible but where Archer can still read and edit it.
Is it possible to "hide" an entire field via a Custom Object but in such a way that Archer could still see it?
2024-11-19 11:01 AM
This is a great idea, any luck on the above from yesterday from mintyalex @DavidPetty
2024-11-19 11:12 AM - edited 2024-11-19 11:14 AM
@GionlucaMallia as I mention, reuse the setRecordPermission function by adding a parameter for the user array.
Something like this:
var userToPopulate = {
name: setUserConfig.usersName,
value: setUserConfig.usersId + ':' + (setUserConfig.itemType == 'group' ? 3 : 1)
};
var userToClear = {
name: "",
value: "")
};
setRecordPermission(12334, userToPopulate);
setRecordPermission(12334, userToClear);
function setRecordPermission(fldId, user) {
// Obtain the field root by ID and initialize user array
var RPFieldRoot = ArcherTech.UI.ClientContentManager.GetInstance().getFieldById(fldId),
UsrArray = [];
var RPFieldRootId = RPFieldRoot.clientId;
// Push user details into the array in the appropriate format
UsrArray.push(user);
//Serialize and set values in the UI
var serialized = Sys.Serialization.JavaScriptSerializer.serialize(UsrArray);
$('div[id*="' + RPFieldRootId + '_"] div:first-child').text(user.name);
$('input[id*="' + RPFieldRootId + '_"]').val(serialized);
// Set appropriate hidden field based on item type
if (setUserConfig.itemType == 'user') {
$('#SelectedUsers' + fldId).val(user.value.split(':')[0]);
} else if (setUserConfig.itemType == 'group') {
$('#SelectedGroups' + fldId).val(user.value.split(':')[0]);
}
var usersGroups = $CM.getFieldControl(fldId)
var tree = $find(usersGroups.get_treeViewId());
tree.set_popupValue(UsrArray);
// Check if the field is read-only and update the UI accordingly
var layoutItem = $LM.getLayoutItemById(RPFieldRoot.layoutId);
if (layoutItem && layoutItem.display == ArcherTech.Enums.LayoutItemActionType.ReadOnly) {
$('#'+RPFieldRootId).closest('tbody').find('.rtMid').text(user.name);
}
}
Advisory Consultant
2024-11-19 05:11 PM
Hi @DavidPetty
Thanks for your inputs. I have tried to do as suggested but setting it as a blank using something like the below: