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

cancel
Showing results for 
Search instead for 
Did you mean: 

Record Permission Custom Object

AkshayDaniel
Contributor III

We are working on a requirement wherein we have two manual record permission fields that get populated at different stages of a workflow, the idea is to not have the same person in both these record permission for which the following custom object was written

 

 

<script type="text/javascript">

var reviewerFieldId = 1234;
var peerreviewerFieldId = 5678;

Sys.Application.add_load(function() {

$('div[id*="f' + peerreviewerFieldId + 'cdp"]').change(function(){
var rev1 = $CM.getFieldValue(reviewerFieldId);
var rev2 = $CM.getFieldValue(peerreviewerFieldId);

if(rev1=rev2)
{
alert('Peer reviewer and Reviewer cannot be same person');
});
});

 

</script>

 

 

Alert is followed by clearing the name from second record permission field, however we are unable to trigger the .change event for this most probably it could be due not  have proper element selected. 

 

Kindly advise if record permission fields have different Jquery selector compared to other general fields.

 

We have tried the following selectors

1.$('div[id*="f' + peerreviewerFieldId + 'cdp"]')

2. $('input[id*="f' + peerreviewerFieldId + 'shf"]')

3.$('div[id*="f' + peerreviewerFieldId + 'c_s"]')

None of them worked

 

Archer version is 6.4 HF1.

21 REPLIES 21

Hi Ilya,

 

Sorry I couldn't reply earlier, been working in a restricted network.

 

Thank you for sharing the code it works and I am able to get capture the change event now, however for some reason I see the change event getting triggered twice if I use values pop up or a drop down.

 

Kindly advise if you observed the same in your testing. 

 

Also needed your help in solving the next piece of the puzzle i.e after I do some validation on the change event I wanted to clear the contents of this record permission field, which also does not seem to work .

 

I tried with the following three options 

 

1. $CM.setFieldValue()

2. $("#master_DefaultContent_rts_s566_f17143c_shf").val("")

3.$('input[master_DefaultContent_rts_s566_f17143c_shf]').val("")

 

I'll also try the code shared by David , have to say it is a really interesting discussion.

 

Thanks David Petty and Jason Solar aswell for sharing

Yes, I am aware of double change trigger, but that is due:

1. In current JQuery library used by Archer, there is a bug related to Change trigger, which sometimes is called twice. That is fixed in later releases. 

2. Way Archer sets value for hidden fields, it may cause double set for archer own purposes and functionality.

 

Maybe David's code is more smart and avoid double triggering scenario.

 

You have to work around this in your code. Or should not care, if it is not alert, but double empty set.

 

For setting RP values, that code is used fro RPs:

Custom object for setting value list of type people and group