Important Update: Community URLs redirect issues are partially resolved. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

GetFieldValue returns Null in View Mode

TamarShelach
Archer Employee
Archer Employee

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 )

5 REPLIES 5

DavidPetty
Archer Employee
Archer Employee

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

Rock star response David Petty‌! Learned something new => 

ArcherTech.UI.GenericContent.GetInstance().get_mode();

JoyVanBuskirk
Collaborator II
ArcherTech.UI.GenericContent.GetInstance().get_mode();

This is returning undefined in Version 6.12 P5 HF1. @DavidPetty any chance you can share updated syntax?

@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

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! Thank you so much!