Important Update: Some Community URL Redirects are Under Maintenance. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom object to disable collapse for cross reference field

Swapnali_Shinde
Contributor III

Hi DavidPetty

I am looking for custom code to to disable collapse of cross reference when user clicks on cross reference field name. User should be always able to see record whether he clicks or not click on the cross reference field name.

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

DavidPetty
Archer Employee
Archer Employee

@Swapnali_Shinde see how this works.

<script type="text/javascript">
     var xrefToPreventCollapse = 'Name of Cross-Reference Field Not To Collapse';

     Sys.Application.add_load(function() {
          var xrefFldId = lookupFieldId(xrefToPreventCollapse);
          if(xrefFldId != 0){
               $('#master_DefaultContent_rts_s'+ $CM._fields[xrefFldId].sectionId +'_hr').unbind('onclick').prop('onclick',null);
               $('#loitem' + $CM._fields[xrefFldId].layoutId).css('cursor','default');
               $('#master_DefaultContent_rts_s'+ $CM._fields[xrefFldId].sectionId +'_hr').find('.collapse-img').hide();
          }
     });

     function lookupFieldId(fldName){
          var goFindId = 0;

          try{goFindId = parseInt($('.FieldLabel').filter(function() {return $( this ).text().toLowerCase().indexOf( fldName.toLowerCase ()+ ':' ) >= 0;}).find('img.required-icon')[0].id)} catch (err) {}
          try{goFindId = parseInt($('.SubSectionLabel').filter(function() {return $( this ).text().toLowerCase().indexOf( fldName.toLowerCase() + ':' ) >= 0;}).find('img.required-icon')[0].id)} catch (err) {}
          try{goFindId = parseInt($('.SectionLabel').filter(function() {return $( this ).text().toLowerCase().indexOf( fldName.toLowerCase()) >= 0;}).children()[0].id)
          } catch (err) {}

          return goFindId
     }
</script>

 Advisory Consultant

View solution in original post

3 REPLIES 3

DavidPetty
Archer Employee
Archer Employee

@Swapnali_Shinde see how this works.

<script type="text/javascript">
     var xrefToPreventCollapse = 'Name of Cross-Reference Field Not To Collapse';

     Sys.Application.add_load(function() {
          var xrefFldId = lookupFieldId(xrefToPreventCollapse);
          if(xrefFldId != 0){
               $('#master_DefaultContent_rts_s'+ $CM._fields[xrefFldId].sectionId +'_hr').unbind('onclick').prop('onclick',null);
               $('#loitem' + $CM._fields[xrefFldId].layoutId).css('cursor','default');
               $('#master_DefaultContent_rts_s'+ $CM._fields[xrefFldId].sectionId +'_hr').find('.collapse-img').hide();
          }
     });

     function lookupFieldId(fldName){
          var goFindId = 0;

          try{goFindId = parseInt($('.FieldLabel').filter(function() {return $( this ).text().toLowerCase().indexOf( fldName.toLowerCase ()+ ':' ) >= 0;}).find('img.required-icon')[0].id)} catch (err) {}
          try{goFindId = parseInt($('.SubSectionLabel').filter(function() {return $( this ).text().toLowerCase().indexOf( fldName.toLowerCase() + ':' ) >= 0;}).find('img.required-icon')[0].id)} catch (err) {}
          try{goFindId = parseInt($('.SectionLabel').filter(function() {return $( this ).text().toLowerCase().indexOf( fldName.toLowerCase()) >= 0;}).children()[0].id)
          } catch (err) {}

          return goFindId
     }
</script>

 Advisory Consultant

Swapnali_Shinde
Contributor III

Thank You!! I will try this out.

Swapnali_Shinde
Contributor III

It worked @DavidPetty Thanks a Ton!!!