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

DavidBaldwin1
Contributor III

 It is threads like this that make me wish my job allowed me to make custom objects  

 

Backstory

In 5.x days there was a library telerik that powered Archer's frontend. Archer 4.x did not have jQuery so Archer couldn't leverage telerik (you can google them). Anyways, the telerik library had two very nice Javascript classes "ContentManager" and "Layout Manager" which controlled the layout of the interface. That is right, telerik is what powered the DDEs once a person opened a record. I will see if telerik still exist in Archer 6.x and maybe you can leverage it. 

 

Some things to think about

Your Field ID, Section, Layout, etc can change when you migrate between environments. That is to say the id may not be the same Dev->Test->QA->Prod. So you will have to have separate IDs in both environments.

 

How did Telerik help?

Anyways, back in  your custom object to scan the Layout Manager for expected "field name". It would return to you the field, section, and any other important id you needed. I believe it would also tell you that fields entire HTML id -- so you did not have to build it through concatenation. The telerik was the javascript api used to power the DDEs so I used for the entire time I worked with Archer 5.x. No matter the field, no matter the section, the telerik could be counted on to work in all environments with the exact same code. Again, I will see if it exist in Archer 6.x and report back in a couple of days. It will drastically reduce your code size and complexity while improving portability and readibility.

ExtJS may be the library that is being used now...either way I will let you know.

David they still exist; $CM (Client Manager) and $LM (Layout Manger).  Though I haven't found a way to supply a field name to either of them that would return the field id or client id for the environment.

 

I'd be very interested on how you were able to do it in 5.x being it would still be the same in 6.x 

 

Currently ExtJs is being used mainly for the main UI and nothing record related.

 Advisory Consultant

It sounds like going back to Single Column is the only option now?

Regards,
Tuan

Sorry miss-read what you said.

 

When you inspect the Add New link it has an id so you should be able to do $('#id').click();

 Advisory Consultant

@David Petty if I tell you how then you gotta promise not to take my toys away.

Why would ever want to do that

 Advisory Consultant

Now I got this JavaScript error David

 

SCRIPT5007: Unable to get value of the property 'click' of undefined or null reference

 

Is it exclusively related to IE?

Regards,
Tuan

What's the javascript line that threw the error?

 Advisory Consultant

1. Open the "Developer Toolkit" in a browser like Firefox / Chrome / Opera.

2. Make sure you have the monitors turn on such that you see the list files that your browser has to pull to load (ScriptResource.axd, *.js files, etc)

3. Click console tab (should look like a command console)

4. type "$CM" or "$LM" then hit enter

5. If you want to know the functions then you type "$LM." or "$CM."

 

From there it get pretty easy