Important Update: Community URLs redirect issues are partially resolved. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the current user?

toberle
Contributor II

I need to get the current user using the Archer 6.12.0.5.1 version, I already tried this code, from version 6.4 I found on the forum, but it doesn't work anymore, I think it has to be updated:

<img src="../BackgroundImageGenerator.axd?className=StyledButton&classProperties=caption:Add User;iconSetStyle:VistaRound;baseColor:%23DDDDDD;disabled:False" onclick="setRecordPermission()">
<script type="text/javascript">
var setUser = {
fldId: '35407',
usersName: parent.parent.ArcherApp.globals.displayName,
usersId: parent.parent.ArcherApp.globals.userId,
itemType: 'user'}; // Use 'group' if you're adding a group
function setRecordPermission() {
var RPFieldRoot = ArcherTech.UI.ClientContentManager.GetInstance().getFieldById(setUser.fldId), UsrArray = [];
var RPFieldRootId = RPFieldRoot.clientId;

UsrArray.push({
name: setUser.usersName,
value: setUser.usersId + ':' + (setUser.itemType == 'group' ? 3 : 1)
});
var serialized = Sys.Serialization.JavaScriptSerializer.serialize(UsrArray);
$('div[id*="'+ RPFieldRootId +'_"] div:first-child').text(setUser.usersName);
$('input[id*="'+ RPFieldRootId +'_"]').val(serialized);
if(setUser.itemType == 'user'){
$('#SelectedUsers'+setUser.fldId).val(setUser.usersId);
}else if(setUser.itemType == 'group') {
$('#SelectedGroups'+setUser.fldId).val(setUser.usersId);
}
}
</script>

Our customer wants to remove a specific user from a group as approval on workflow, the problem is, the user belongs to the same group as the approvals, how can I work around it?

2 REPLIES 2

DavidPetty
Archer Employee
Archer Employee

@toberle are you getting an errors in the browsers developer tools console?

For the user issue.  Is the user or group listed for approvers?

 Advisory Consultant

I wasn't getting any errors, sorry for the late delay.