Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..
2018-05-21 10:50 AM
Hi
We have a custom object that returns text field value:
<script>
Sys.Application.add_load(function() {
var myField = ArcherTech.UI.GenericContent.GetInstance().getFieldValue(19609);
document.getElementById("myID").innerHTML = myField;
});
We display the returned value (myField) in a bar at the top of the record.
It work great in Edit mode but returns NULL in View mode.
Any idea why? how can we solve it?
(Yes, I'm new with that custom objects thing )
2018-05-21 11:00 AM
Fields work differently in Edit mode vs. View mode.
You'd have to determine the record state:
ArcherTech.UI.GenericContent.GetInstance().get_mode(); // 1 = Edit, 2= View
Then, inspect the field in question in view mode and setup the custom object to retrieve the value. Something like:
$('div[id$="f'+ fldid + '"]').text().trim();
//or
$('span[id$="f'+ fldid + '"]').text().trim();
Advisory Consultant
2018-06-15 03:01 PM
Rock star response David Petty! Learned something new =>
ArcherTech.UI.GenericContent.GetInstance().get_mode();
2023-09-17 12:27 AM
ArcherTech.UI.GenericContent.GetInstance().get_mode();
This is returning undefined in Version 6.12 P5 HF1. @DavidPetty any chance you can share updated syntax?
2023-09-18 09:01 AM
@JoyVanBuskirk the syntax is correct, but it has to be called inside of,
Sys.Application.add_load(function() {
var recordState = ArcherTech.UI.GenericContent.GetInstance().get_mode() == 1 ? "Edit" : "View";
});
Advisory Consultant
2023-09-19 01:56 PM
Yeah, you nailed it! I was getting some other stuff about Archer outside of the SysApplication load function and thought this could be outside too. Eventually that will become my first thought when something doesn't work!