Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..
2020-06-17 03:24 PM
Hi Team,
can somebody help me in achieving the below requirement using custom objects, or is there any other way without custom code, we are trying to avoid use of data feed for this.
here we wants to set the Reviewer Comments field to 'empty/null' when the exception Review Status is "In Process"
i tried using the below code, but doesn't work,
<script type = "text/javascript" >
Sys.Application.add_load(function(){
var a=document.querySelectorAll("[data-valueslistvalueid='104902']")[0].innerText;
if(a==In Process)
document.getElementById("master_DefaultContent_rts_s4889_f44597c").innerText=" "
}
);
</script>
2020-06-17 03:27 PM
Manoj, take a look at my post here, https://community.rsa.com/message/903163?commentID=903163#comment-903163
Advisory Consultant
2020-07-14 03:02 PM
Hi David,
I went through you post to clear the text box field, i tried to the same and replace the field id with ,and that code is not running in 6.8p1 even-though i tried using below javascript code to set the field to blank when the status is 'Approved' ,and it is working fine but when the status is other than approved, then all the fields are not displaying,
any idea to make this condition work
<script type = "text/javascript" >
Sys.Application.add_load(function(){
var a=document.querySelectorAll("[data-valueslistvalueid='104905']")[0].innerText;
if(a=='Approved')
document.getElementById("master_DefaultContent_rts_s4889_f44597c_text").innerText=" ";
}
);
</script>
Thanks,
2020-07-14 03:36 PM
Manoj, try:
<script type = "text/javascript" >
Sys.Application.add_load(function(){
var a=document.querySelectorAll("[data-valueslistvalueid='104905']")[0].innerText;
if(a=='Approved') {
document.getElementById("master_DefaultContent_rts_s4889_f44597c_text").innerText=" ";
}
});
</script>
If not, does the browsers console (developer tools) display any errors?
Advisory Consultant
2020-07-14 04:13 PM
Hi David,
the code below i am running it in Edit Mode only from custom code option layout at a time and what i have noticed that , when the record is in view mode, it is working fine for all the condition and when the record is in 'Edit mode'' only half of the record is getting displayed
<script type = "text/javascript" >
Sys.Application.add_load(function(){
var a=document.querySelectorAll("[data-valueslistvalueid='104905']")[0].innerText;
if(a=='Approved') {
document.getElementById("master_DefaultContent_rts_s4889_f44597c_text").innerText=" ";
}
});
</script>
And when i am running the below code in View mode only from custom code option layout at a time and, vice-versa of Edit mode is happening
<script type = "text/javascript" >
Sys.Application.add_load(function(){
var a=document.querySelectorAll("[data-valueslistvalueid='104905']")[0].innerText;
if(a=='Approved') {
document.getElementById("master_DefaultContent_rts_s4889_f44597c").innerText=" ";
}
});
</script>
And when i have place both the code in on layout then only half of the record is getting displayed
below is the screenshot with console error
Thank you for looking into my issue
2020-07-14 04:28 PM
Manoj, if the custom object isn't doing anything in View mode just set the custom objects Display option to Edit Mode.
Advisory Consultant
2020-07-14 04:53 PM
Hi David,
when setting the custom code in Edit mode
the content of record in view mode displaying properly and in Edit mode the content of record is not displaying properly only half of the record is displaying , as shown above screenshot
when setting custom code in view Mode
the content of record in view mode is not displaying properly and in edit mode the content record is displaying properly
As i have made the 2 separate code one for edit mode and other for view mode, because the text field id is different in each mode
so when i have place both the code i.e in edit and view mode,
then record is not displaying properly in both the mode of record.(only half of the record is displaying)
not sure why this strange thing is happening
2020-07-14 05:36 PM
Archer DOM is different when in Edit mode vs View mode and if you're looking to clear a field in View mode you'll have to inspect the field to see how the element is construct and clear the value.
This should get you started:
<script type = "text/javascript" >
Sys.Application.add_load(function(){
var recordState = ArcherTech.UI.GenericContent.GetInstance().get_mode(); // 1 = Edit Mode | 2 = View Mode
if(recordState == 1) {
//Edit Mode
var a=document.querySelectorAll("[data-valueslistvalueid='104905']")[0].innerText;
if(a=='Approved') {
setTextField(44597,'');
}
} else if (recordState == 2) {
//View Mode
}
});
function setTextField(f,v) {
var textFieldAttributes = new Array();
textFieldAttributes.push({
enabled: true,
emptyMessage: '',
validationText: v,
valueAsString: v,
minValue: '-9999999999999',
maxValue:'9999999999999',
lastSetTextBoxValue: v});
var textFieldAttributesSerialised = Sys.Serialization.JavaScriptSerializer.serialize(textFieldAttributes[0]);
$('input[id$="'+ f +'c"]').val(v);
$('input[id$="'+ f +'c_ClientState"]').val(textFieldAttributesSerialised);
csp(event)
}
</script>
Advisory Consultant
2020-07-15 02:20 AM
Hi David,
i tried the above code, in edit mode when the record is in edit mode the value in text box field is not setting to blank, and when i am clicking inside the text box field then only it is getting blank,
in view mode it is not working
As the text box field has different id in view and edit mode and i am passing setTextField(35615,'') in both the mode.
when i inspected the text field , in edit mode i am getting id ("master_DefaultContent_rts_s4889_f35615c_text") and in view mode i am getting id ("master_DefaultContent_rts_s4889_f35615c")
so when i passed these ids to setTextField("master_DefaultContent_rts_s4889_f35615c_text",'') in edit mode
master_DefaultContent_rts_s4889_f35615c",'') in view mode - it is also not working
below is the code what i have used
<script type = "text/javascript" >
Sys.Application.add_load(function(){
var recordState = ArcherTech.UI.GenericContent.GetInstance().get_mode(); // 1 = Edit Mode | 2 = View Mode
if(recordState == 1) {
//Edit Mode
var a=document.querySelectorAll("[data-valueslistvalueid='104905']")[0].innerText;
if(a=='Approved') {
setTextField(35615,''); // in edit mode only after clicking inside the text box field then only is is removing the data else not
}
} else if (recordState == 1) {
//View Mode
var b=document.querySelectorAll("[data-valueslistvalueid='104905']")[0].innerText;
if(b=='Approved') {
setTextField(35615,''); // not working in view mode
}
}
});
function setTextField(f,v) {
var textFieldAttributes = new Array();
textFieldAttributes.push({
enabled: true,
emptyMessage: '',
validationText: v,
valueAsString: v,
minValue: '-9999999999999',
maxValue:'9999999999999',
lastSetTextBoxValue: v});
var textFieldAttributesSerialised = Sys.Serialization.JavaScriptSerializer.serialize(textFieldAttributes[0]);
$('input[id$="'+ f +'c"]').val(v);
$('input[id$="'+ f +'c_ClientState"]').val(textFieldAttributesSerialised);
csp(event)
}
</script>
2020-07-15 08:06 AM
What's the error being thrown in the browser console? And if there is an error click on the Record.aspx line to see where in the actual code the error is being thrown.
The setTextField() function will not work in View mode being there is no input element to clear. You'll have to clear the element using something like $("#master_DefaultContent_rts_s4889_f35615c").text('');
You'll only need one custom object in the application and set the display option to Both.
Side note, why do you need to clear a field in view mode?
Advisory Consultant