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

cancel
Showing results for 
Search instead for 
Did you mean: 

I would like to enhance the custom object that hides the copy button (article #000016800) such that the Copy button is hidden based on the value of a drop down list. This needs to work both for View and Edit mode. I was not able to read the content of a d

GailAlston
Contributor

I have an Archer application where I would like to restrict the ability for users to copy records. I found the article on how to hide the Copy button, but I would like to be able to make the Copy Button available based on the value in a drop down list. I am able to query the value of the drop down list when I am Editing the record, but it returns a null value when in View mode.

Alternatively, if there is a way to copy only the fields to which the user has update privileges, that would be a different way to accomplish what I need.

8 REPLIES 8

DavidPetty
Archer Employee
Archer Employee

Gail, can you post the custom object you are using?

 

Currently there no way to just copy specific fields, it's an all or know scenario.  You'd have to use a data feed to select specific fields to copy.

 

Lastly, which version of Archer are you on?

 Advisory Consultant

Thanks David


Here is the code for the custom object that I am using. What I am looking for is what to replace the ?????????? with. We are using Archer version 6.4.1.6.


<script type=”text/javascript”>
$(document).ready(function() {
var dropdownvalue = ???????;       //Retrieve the value in the drowdown field
var valuetocompare = “12345”       // Numeric value of the field value in Archer

 

If($(‘#master_btnCopy’) && dropdownvalue == valuetocompare) {
$(‘#master_btnCopy’).hide();
}
});
</script>

Ilya_Khen
Champion III

Gail Alston,

 

$CM.getFieldValue() does not work in ViewMode. Retrieve the value by using ID of the element via JS or JQuery.

For copy functionality, vote for:

Add DDE capability or option to disable/hide Copy button from record page and right-click menu for specific applications 

Disable Copy button 

Record Copy Option - Copy Content / Copy Content and Links 

Thank you Iiya - Can you help me to identify the Class name that I should use to get the value of the field in the following sample? This is a very small sample Archer application that I built for this purpose. The name of the dropdown list field is 'my drop down list', and the selected value is 'Jupiter'. What class would I use to get the value of 'Jupiter' in this example? I have included a copy of the Javascript from both Edit mode and View mode.

                                                      View mode

                                                                                                            <td class=" ml-FldLblPadCol"> </td><td class=" FieldLabel ml-FldLbl ml-BrdRight lo_39587 ml-BrdBottom" style="width:15%;"><span id="loitem39587"><img id="42608requiredImg" class="required-icon" src="/RSAarcher/BackgroundImageGenerator.axd?className=Bullet&amp;classProperties=bulletShape:RequiredIndicatorWidget;baseColor:%23B80000" alt="Required" style="display:none;" />my drop down list:</span></td><td class="ml-FldCnt lo_39587 ml-BrdBottom" style="width:35%;"><div id="master_DefaultContent_rts_s6200_f42608c" class="ArcherTreeView DisabledTree">

            <ul class="rtUL rtLines"><li id="" class="rtLI rtFirst rtLast"><div class="rtMid"><div data-valuesListValueId="107915" style="color:#000000;">Jupiter</div></div></li></ul>

</div></td><td class="ml-Col ml-SpcrCol"> </td><td class="ml-FldCnt lo_39588 ml-BrdBottom" colspan="2" style="width:35%;"><span class="loitem39588"><script type="text/javascript">

            $(document).ready(function()

 

 

                                                      Edit Mode

                                                                                                            <td class=" ml-FldLblPadCol"> </td><td class=" FieldLabel ml-FldLbl ml-BrdRight lo_39587 ml-BrdBottom" style="width:15%;"><span id="loitem39587"><img id="42608requiredImg" class="required-icon" src="/RSAarcher/BackgroundImageGenerator.axd?className=Bullet&amp;classProperties=bulletShape:RequiredIndicatorWidget;baseColor:%23B80000" alt="Required" style="display:none;" />my drop down list:</span></td><td class="ml-FldCnt lo_39587 ml-BrdBottom" style="width:35%;"><span id="master_DefaultContent_rts_s6200_f42608c" class="ComboboxWrapper"><table cellpadding="0" cellspacing="0" style="width:100%;">

            <tr>

                        <td style="width:100%;"><div class="enhlst-list-note" aria-labelledby="loitem39587">

                                    <input name="master$DefaultContent$rts$s6200$f42608c$ddl" type="text" value="{&quot;text&quot;:&quot;Jupiter&quot;,&quot;value&quot;:&quot;107915:0&quot;,&quot;enabled&quot;:true,&quot;level&quot;:0,&quot;selected&quot;:true,&quot;children&quot;:[],&quot;html&quot;:null}" id="master_DefaultContent_rts_s6200_f42608c_ddl" autocomplete="off" style="display:none;" />

                        </div></td><td class="EditLink"><a id="master_DefaultContent_rts_s6200_f42608c_f42608_ce" class="SystemURL" aria-label="Edit Values List" href="javascript:$pb(&#39;{&quot;a&quot;:[{&quot;Key&quot;:&quot;valuesListId&quot;,&quot;Value&quot;:&quot;11598&quot;},{&quot;Key&quot;:&quot;taskId&quot;,&quot;Value&quot;:&quot;25773&quot;}],&quot;e&quot;:&quot;editValuesList&quot;}&#39;)">Edit</a></td>

            </tr>

</table></span></td><td class="ml-Col ml-SpcrCol"> </td><td class="ml-FldCnt lo_39588 ml-BrdBottom" colspan="2" style="width:35%;"><span class="loitem39588"><script type="text/javascript">

            $(document).ready(function()

You just right click on the element and Inspect to find out Element ID.

Success! Thank you.

First - I added a rule to the Permissions field to disallow Update when a certain value is in the dropdown list. That way, the user cannot Edit the record (in this case if the value is set to "Jupiter"), so I only need to hide the Copy button in View mode. 

When I inspect the element by right clicking on the dropdown field, the DOM explorer shows the following:

<div class="rtMid">
<div style=”color: rgb(0,0,0);” data-valuesListValueId="107915" >Jupiter</div>
</div>

 

Here is the Javascript that I used in my custom Object. It hides the Copy button in View mode if the value of the dropdown field is "Jupiter".

 

<script type=”text/javascript”>
$(document).ready(function() {
//Retrieve the value in the dropdown field
var dropdownvalue = document.getElementsByClassName(“rtMid”)[0].firstElementChild.textContext;

var valuetocompare = “Jupiter”       // Text content to compare to the dropdown field

 

If($(‘#master_btnCopy’) && dropdownvalue == valuetocompare) {
   $(‘#master_btnCopy’).hide();
}
});
</script>

correction: that should read firstElementChild.textContent  (not textContext)

another update: apparently Archer names all the dropdown lists "rtMid" so the sample code works if the dropdown being evaluated is the first or the only dropdown list in the application. Regardless, the sample shows that the javascript logic works once the right element is located.