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

cancel
Showing results for 
Search instead for 
Did you mean: 

custom object for cross reference field

ilhankurt
Contributor III

Hi all,

I wantted to set cross reference field with custom object?

Is it possible to do it

 

Regards

31 REPLIES 31

DavidPetty
Archer Employee
Archer Employee

ilhan it's possible, what version of the framework are you on?

 Advisory Consultant

Version 5.5

Thanks.

 

See how below works.

xRefRecordId variable is the tracking id of the record you want to link to the cross-reference field.

xRefFielddId variable is the field id for the cross-reference field you want to set.

 

<script src="./shared/scripts/controls/ReferenceField.js"></script>
<script type="text/javascript">
var xRefRecordId = [24075];
var xRefFielddId = 1234;

Sys.Application.add_load(function() {
  setXrefFieldValues(xRefFielddId,xRefRecordId)
});

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 {
    var genericContent = ArcherTech.UI.GenericContent.GetInstance();
    if (genericContent) {
     var animationOptions = genericContent.get_loadingAnimationOptions();
     $('body').loadingAnimation({ title: "Retrieving User", text: "Please wait, setting user", image: animationOptions.image });
    }
    ArcherTech.UI.ReferenceField.UpdateCurrentField(values);
   }
  }
}
</script>
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

 Advisory Consultant

I have set the attriburtes for my Archer

 

xRefRecordId variable is the tracking id of the record you want to link to the cross-reference field.

xRefFielddId variable is the field id for the cross-reference field you want to set.

 

It didnot work

I want to explain my need.

 

User select a value from value list.

According that value I want to set a value in cross reference field automaticaly.

I  thought I can use custom object.

If there is an aother way to do this I can use.

A few questions ilhan:

Did you get any errors in the browser console?

Is the cross-reference on the layout?

Is the cross-reference on a tab?

 Advisory Consultant

You could use a data feed to do this as well.  Otherwise a custom object is the only other way.

 Advisory Consultant

In console it says

SCRIPT5009: 'fldId' is undefined,

 

      Sys.Application.add_load(function() {
                   setXrefFieldValues(fldId,xRefRecordId)
       });

 

I changed fldId with xRefFielddId then

 

I got Invalid argument error.

How can I do with data feed

Could you give me an example or sth ?