Important Update: Community URLs redirect issues are partially resolved. Learn More. .
2023-01-11 08:07 PM
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
2023-01-12 09:37 AM - edited 2023-01-12 09:38 AM
@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
2023-01-12 09:46 AM
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?
2023-01-12 09:54 AM
Is there any such function for subforms?
2023-01-12 05:06 PM
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
2023-01-12 06:08 PM - edited 2023-01-12 07:04 PM
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"))
2023-01-20 12:20 PM
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"))
2023-01-20 02:01 PM
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
2023-01-20 02:02 PM
@Anonymous I believe that should work with sub-forms as well
Advisory Consultant
2023-01-20 03:10 PM
Wonderful! Thanks @DavidPetty !