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

cancel
Showing results for 
Search instead for 
Did you mean: 

Cross-Reference fields DATA not visible unless record reopened

Sanjay_a
Contributor II

Hi All,

We have written a custom object button ( on the record page) which when clicked brings data from another app and refreshes the page.  For page refresh we are using the view button code

 __doPostBack('master$btnView','')

But page is refreshed, it is displaying all the fields' data, except for cross-references. The data is there but it is not shown unless we close the record and re-open it. This custom object was working for few years now and suddenly started to show this behavior.  Archer version - 6.10 P4

@DavidPetty @BodieMinster 

12 REPLIES 12

DavidPetty
Archer Employee
Archer Employee

@Sanjay_a  call this function and pass the field id and the values you want to send as an array.

 

function setXrefFieldValues(field,values){
  field = $CM._fields[xRefFielddId].clientId;
  ArcherTech.UI.ReferenceField.CurrentLookupField = $find(field);
  var currentField=ArcherTech.UI.ReferenceField.CurrentLookupField;
  if(currentField) {
   currentField.setLookedUpRecords(values);
   if (currentField.get_isInDdeCondition() && Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack()) {
    var endRequestHandler = function () {
     ArcherTech.UI.ReferenceField.UpdateCurrentField(values);
     Sys.WebForms.PageRequestManager.getInstance().remove_endRequest(values);
    };
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);
   } else {
    ArcherTech.UI.ReferenceField.UpdateCurrentField(values);
   }
  }

 

For example:

 

<script type="text/javascript">
 var xRefRecordId = [24075,25626,23621];
 var xRefFielddId = 1234;

 Sys.Application.add_load(function() {
  setXrefFieldValues(xRefFielddId,xRefRecordId)
 });
</script>

 

 

 Advisory Consultant

Thanks for the reply David. We are setting the value of X-ref field ( along with other fields) using server side REST API and when we open the history log we are able to see the values are correctly being set in that field. After all the values are set, I call  __doPostBack('master$btnView','') function to refresh the page. But even after page refresh the values for cross-reference are not shown on screen. All other field types numeric/text/valueslist etc. shows latest data. In order to see the data in x-ref fields we need to close the record and open it again.  Is there any other way to refresh the page instead of __doPostBack('master$btnView','')  which may solve this problem? 

 

Anonymous
Not applicable

@DavidPetty,

Is there any such function for subforms?

If you search the HTML for a hidden input element with an id of selectedvalues9999 (replace 9999 with the field id) do you see the new values added to the cross-reference field?

 

 Advisory Consultant

yes, I can see the value i the hidden input element. It has the tracking id of the cross-references application as the value.  Instead of using function - __doPostBack('master$btnView','') if I replace it with  below line of code, all data including cross-reference data is shown on the page. But wondering what is difference between doPostback and this code.  Is there more standardized way to do same thing using Archer Javascript functions? window.open(parent.ArcherApp.globals.baseUrl+"/GenericContent/Record.aspx?id="+parent.ArcherInterface.lockedContentId.replace(/_/g, "&"),$("iframe", parent.document).attr("name"))

 

 

 

 

 

 

Sanjay_a
Contributor II

Any thoughts on how to refresh the record using javascript/jquery please? 

Any Archer JS function instead of using - 

window.open(parent.ArcherApp.globals.baseUrl+"/GenericContent/Record.aspx?id="+parent.ArcherInterface.lockedContentId.replace(/_/g, "&"),$("iframe", parent.document).attr("name"))

Use the function I provided above and pass the value of selectedvalues9999 (make sure it's an array) along with the field id and that should take care of the issue.

 Advisory Consultant

@Anonymous I believe that should work with sub-forms as well

 Advisory Consultant

Anonymous
Not applicable

Wonderful! Thanks @DavidPetty !