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

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Object button that works as Add New button for XREF

TuanKhoa
Collaborator III

Hi,

 

I want to create a button by using Custom Object that does the same work as the "Add New" button for a XREF Field.

 

Capture.PNG

I tried to do something like this, but I just got the button, and nothing happened when I clicked on it.

 

<div style="text-align:center;"> 
 <a class="ContentURL" href="javascript:$('#master_DefaultContent_rts_s4182_f20694c_Add_New').click();"> 
  <img src="../BackgroundImageGenerator.axd?className=StyledButton&classProperties=caption:+++++AddNew+++++;iconSetStyle:VistaRound;baseColor:%23BFDDF5;disabled:False"/> 
 </a> 
</div>

 

I don't know how to put the "fieldid" - "refmodid" - "moduleid" in the code.

 

Could anyone help me With this? Thank you!

 

/Tuan

 

GhgcdMq8HwHRCWZuqMwEETnAH3l0sBKt8utOGHAgtsY=

Regards,
Tuan
76 REPLIES 76

Sadly it doesn't work ...

Regards,
Tuan

Give this one a shot

onclick="$('[id*=f20694c]').find('[id=Lookup]').click();"

 Advisory Consultant

Still doesn't work ...

Regards,
Tuan

Odd, this worked fine for me in a custom object.

<a href="#" onclick="$('[id*=f15537c]').find('[id=Lookup]').click();">Lookup</a>

 

If the field you're referencing isn't visible to the user (hidden by ACL is ok) then the field isn't loaded in the DOM and the script cannot access it.

 Advisory Consultant

I'll be out of office next week. I'll try when I'm back. Thanks.

Regards,
Tuan

I have now tested and it works! Thank you

Regards,
Tuan

David, when I change the XREF field from "Single Column" to "Grid" view, the Custom Object code doesn't work anymore ... What can I do?

Regards,
Tuan

What I can see is:

      - Single Column: s4182_f2694c

      - Grid: s4182_ss2694_f2694c

What is "ss" here then?

Regards,
Tuan

Change it back to grid

 

Inspect the … (lookup) element and see what changed.

 Advisory Consultant

Change it back to grid?

 

What I want is Grid, but the code just works for Single Column  

Regards,
Tuan