Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..
2018-05-18 03:59 PM - edited 2024-07-24 05:17 PM
Welcome to my little space in the corner on Link dedicated to custom objects in Archer, Archer Custom Objects Forum - Archer Community
With this little community I plan on writing documents on various aspects to custom objects along with sample code and how they work within Archer to add a little bit of flair to your applications.
I'll start this off with a little background on what custom objects are.
Custom objects is a layout object that allows you add HTML and JavaScript to an application. With custom objects you can use them to manipulate an application to perform actions that cannot be done with calculate fields or Rules/Actions (DDEs). Custom object can implemented based on the state of the record; meaning that it could only run if the record is in View mode, Edit mode or both View and Edit mode and it executes with the same permissions as the user has that's viewing/editing the record.
With custom objects you could perform the following:
There are some concerns with custom objects to be aware of especially when it comes reading or updating fields in an application or questionnaire. Archer uses the "field id" when it comes referencing fields in an application or questionnaire and these id's are specific to the environment. So when you move an application or questionnaire to another environment the field id's will most likely be different and you would have to update those field id's each time you install a package.
|
Advisory Consultant
2020-12-08 03:26 PM
<script type="text/javascript">
var valuesListFieldId = 18829; // This is the field id of the values list
var valuesListValueAId = 54847; // This is the id of the value to check against
var valuesListValueBId = 39148; // This is the id of the value to check against
var valuesListValue;
Sys.Application.add_load(function() {
var recordMode = ArcherTech.UI.GenericContent.GetInstance().get_mode(); // 1 = Edit, 2= View
if(recordMode == 1){
valuesListValue = getValue(valuesListFieldId);
}else if(recordMode == 2) {
valuesListValue = $('div[id*="f' + valuesListFieldId + 'c"] div:last').attr('data-valueslistvalueid');
}
if (valuesListValue.indexOf(valuesListValueAId) != -1 || valuesListValue.indexOf(valuesListValueBId) != -1 ) {
$('#master_btnCopy').hide();
$('.rmLink:Contains("Copy")').parent().parent().hide();
$('.rmText:Contains("Copy")').closest('li').remove();
}
});
function getValue(fldId) {
var RPFieldRoot = ArcherTech.UI.ClientContentManager.GetInstance().getFieldById(fldId);
var RPFieldRootId = RPFieldRoot.clientId;
return $('input[id*="'+ RPFieldRootId +'"]').val();
}
</script>
2020-12-08 03:43 PM
Thanks. Are there any errors being thrown in the browser's console?
Advisory Consultant
2020-12-10 12:13 AM
David,
The record keeps on loading while opening.
If we remove the custom code. It is working normal.
2020-12-10 07:39 AM
Jagan, open the browsers developer tools and select the console before opening a record, then open a record. Any errors being thrown?
Advisory Consultant
2020-12-10 07:55 AM
David,
Please find the Error:
2020-12-10 08:54 AM
Thanks, if you click on Record.aspx (1399,11) it should take you to the line that threw the error.
Advisory Consultant
2020-12-10 09:06 AM
Error:
2020-12-10 09:15 AM
Looks like the variable valuesListValue might not have a value and the indexOf is failing. Make sure the field Id you're passing to the getValue() function is valid and that the field is on the layout and not in a tab that not selected.
Advisory Consultant
2020-12-11 02:43 AM
That is a calculated field. Won't that works?
2020-12-17 08:51 AM
David Petty, It seems the script is not working for calculated field. This is similar to DDE changes. Is there any way to update based on the calculated field?
Thanks...