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

<a class="ContentURL" href="#" onclick="$('[id*=f20694c_Add_New]')[0].click();">

Regards,
Tuan

I got "$CM" / "$LM" is undefined.

 

How can I turn on monitors?

Regards,
Tuan

Try it without the [0].

 Advisory Consultant

They are available after the record is loaded.  You'd call them in the following function:

Sys.Application.add_load(function() {
     console.log($CM);
     console.log($LM);
});

 Advisory Consultant

The button doesn't react at all after I take out the [0] wildcard

Regards,
Tuan

Send me a screenshot of the element in the developer tools?

 Advisory Consultant

I haven't had my second cup of coffee yet. So, my mind still can't understand the full capabilities you just opened up to me.  However, for some reason I keep humming "a whole new world..." from Aladdin while I'm looking at the console window.

 

 

Thanks!

image002.png

Regards,
Tuan

Tuan as I mentioned I need the screenshot of the element; right-click Inspect element.  I need to see how the ID is formatted for the Add New link.

 Advisory Consultant

Oh sorry here is the correct one

 

image002.png

Regards,
Tuan