Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..
2023-01-31 09:46 AM - edited 2023-01-31 09:52 AM
Good morning to the community: I apologize in advance if this question is rudimentary as I am trying to learn how to support and utilize COs in our system...
I have an existing CO (written by someone long gone) that is designed to build multiple Assignee names, selected from an Assignee Group value list into Archer's singular value field ("Assignee'). I do this using .js to loop through the value list picking up all selected names and concatenating them into an email-formatted value i.e. "<name 1>;<name 2>; etc.) and then placing that string into the Assignee field. This all works correctly until a record is sent back to the Submitter for revisement and the names selected is modified. When the record is resubmitted, I see my Assignee field being updated, but the webpage still shows the original names...if I then either "save" the updated record or go back through the revise/resubmit process it will then update the webpage field to correctly display the selected names. Some debug:
STGE001: strValue = '[{"name":"KEPLER, JAMES","value":"429:1"}]'
STGE001: rtnValue = 'KEPLER, JAMES'
STGE001: assigneeName = 'KEPLER, JAMES'
STGE001: ->Function funSetFieldValue(fldId,fldValue) = '17712','KEPLER, JAMES'
[Violation] Forced reflow while executing JavaScript took 43ms
I have also attached a snapshot of the record's behavior in questions.
I am trying to work out Archer's sequence of events in firing of a PageLoad vs. when it updates the database and how can I refresh the page to correctly show what my code has updated. Also, I'm concerned about the "reflow" issue as it may be a result of my code mutating the DOM.
Any insight, suggestions, or hints are greatly appreciated!
James
2023-01-31 10:48 AM
@JamesKepler can you attack the entire custom object?
For setting a users/group, record permission field I use the following:
var setUser = {
fldId: '34219',
usersName: 'Doe, John',
usersId: 12345,
itemtype: 'user'}; // Use 'group' if you're adding a group
function setRecordPermission() {
var RPFieldRoot = ArcherTech.UI.ClientContentManager.GetInstance().getFieldById(setUser.fldId), UsrArray = [];
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);
}
}
Advisory Consultant
2023-01-31 11:00 AM
2023-02-06 01:03 PM
Hi David, been away from the community for a short while working on projects, but wanted to know if you saw anything in the uploaded code that might help...the jist of my issue right now is how do I get the CO code to run AFTER I update the value list of selected users i.e. does changing the value of the value list fire something like an ".onchange" event that I can have a listener snag? My selected users in the group list are good and being stored but I need to get them pushed to the 'ASSIGNEE' field on the page so I need the CO to run before Archer updates the database field and pushes me to the "Open Status' layount...any insight is appreciated!
2023-02-06 01:19 PM
@JamesKepler Looking at the code, the call to update the record permission field might be the cause. Use the function I posted above instead and see how that works.
Advisory Consultant