Important Update: Some Community URL Redirects are Under Maintenance. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

Hide a Copy button in the editing and viewing modes and from a right-click of a record name when the value of a field name, "Component Type" (field ID (19858)) is "Information System"

amurana-HHS
Contributor II

Hi, Archer Custom Objects SMEs,

I need to hide a copy button (in the edit and view modes and from a right click of a record name).  The below script does it except a condition (when the value of a field name, "Component Type" (field ID (19858)) is "Information System"). 

<script type="text/javascript">
$('#master_btnCopy').hide();
$('.rmText:Contains("Copy")').closest('li').remove();
</script>

I combined it with what I learned from an Archer IRM person (how to identify a VL value) below.   Can you correct me to work?  Thank you.  AM

<script type="text/javascript">

if($('div[id*="f'+ 19858 +'c"]').text().includes('Information System') {

$('#master_btnCopy').hide();
$('.rmText:Contains("Copy")').closest('li').remove();

};

</script>

6 REPLIES 6

@Anonymous , thank you for your assistance, but the script does not solve the needs as stated.  I looked at the available posts in Archer Community.  I posted the script that works for removing a copy button (in the view and edit modes and from a right-click of a record). 

What I need is how to add a condition (when a Component Type is "Information System") to make sure that only when a Component Type is "information System", Archer will will remove a copy button (in the view and edit modes from a right-click of a record.)  So,  I added your script (how to identify a VL value list ) into the script, which currently works for all records.  If you or other custom object SMEs can take a look at the combined script and correct the script, that will be appreciated.  AM

Anonymous
Not applicable

The script I provided works fine with certain condition when record loaded in View mode and VL value is set to certain value. I do not know what exactly does not work in your situation and also I see you are not using my script, but changed by removing Sys load function.

Thus it is hard to say anything more specific. Also, Edit mode is a different beast, you may need to use when in Edit $CM.getFieldValue function. Overall, the script is becoming more complex and in most of the cases more tied to your exact environment. So, if you are not that experienced in JS, such may bring more complications to the environment.

And btw, you cannot get rid of COPY function from the report context menu with the help of normal custom object at all.

Thank you, @Anonymous.  Yes, the script you provided works fine with certain condition when record loaded in View mode and VL value is set to certain value.  The script I provided  is at least I can remove a copy button from both of the edit and view modes and from a right-click of a record name for all of records.  I am aware that we cannot get rid of COPY function from the report context menu, and even if an Archer idea request was created to hide buttons using DDEs, but it has never been materialized in Archer.  

Currently I am looking for a sample code in the Archer Community or from Archer Custom Object SMEs, which I can hide a button (in this case copy) in the view and edit modes and from a right-click of a record name with a condition (in this case when a value of Component Type ( (field ID (19858)) = "Information System").

If Archer Custom Objects SMEs can assist me, that will be appreciated.  AM

 

DeanAllen
Contributor III

Not sure if you are still looking for a solution but we did something similar, modified for your inputs that I saw...

<script type="text/javascript">

Sys.Application.add_load(function() {

//Check to see if value of Component Type where 19858 (ID of the Value List) is equal to Information System where ####### (ID of the Value in the value list)
if ($CM.getFieldValue(19858) == '#######:0') {
$('#master_btnCopy').hide();
$('.rmText:Contains("Copy")').closest('li').remove();
}
});
</script>