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

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Object Not Saving Data on Save/Save&Close

PrashantSingh
Contributor III

Hello,

I have using custom object to set the record permission field. I'm using the code from https://www.archerirm.community/t5/discussions/how-to-set-manual-record-permission-field-using-custom-object/m-p/444152/highlight/true#M20122

When the custom object is fired, the name get filled in the record permission field. But the name doesn't get saved when I click Save or Save&Close.

Can anyone please guide me to fix the code?

Archer version 6.13 P2 HF2

Browser: Didn't work in Edge and Chrome

 

 

1 REPLY 1

Srujan7
Contributor II

@PrashantSingh 

I have used the same code and was able to set the current user to the RP filed. Below is the code which I have used. May be you can compare:

 

var setUser = {
fldId: '26951',
usersName: parent.parent.ArcherApp.globals.displayName,
usersId: parent.parent.ArcherApp.globals.userId,
itemType: 'user'}; // Use 'group' if you're adding a group
 
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);
}