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

Ugh!

I knew that.

TuanKhoa
Collaborator III

Finallyyyyy I got both "Add New" and "Look Up" to work with Grid mode.

 

Thanks everyone. Now I can go home

Regards,
Tuan

This great info David but there's a lot of heavy lifting involved to transvers all the field id's > get the control id and or layout id  > find the parent element and get the text to compare against field names to reversely use the field/client id going forward.

 

I'm currently working on an ODA that should greatly help with migrating apps from one environment to another and instead updating all the field ids in the custom objects, there would be just one minor change and that's it.

 

More on this in the coming weeks

 Advisory Consultant

NagakiranGogine
Contributor III

Can we create a new related record using any of the above code snippets from some other iView.

I tried the below code in Archer 6.4P3. But I got error: "'$' is undefined". 

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

Nagakiran, the jQuery framework isn't loaded when it comes to custom iViews. Also what you have is specific to the application and cannot be used outside of that.

 

With that said, it easier to create a new record via a URL, https://community.rsa.com/thread/199635 

 Advisory Consultant

Thank you for your reply Petty, I know the deep links concept, but I want to pre-populate the data in a cross reference field.

Pre-populate the record with what?

 

You have to remember you're outside of a record so all the niceties you have in creating a child record within the parent record are thrown out the window when it comes to an iView and creating records.

 

You're better off creating a button in the iView that would invoke the APIs to create the record, populate it with the values you want and upon successful creation of the record redirect the user to that record.

 Advisory Consultant

Ok, whenever we click on add new in Related records field, this record will be populated in the cross reference field in the new record which we have created right. So I thought we can mimic that in an iView.

 

I appreciate your recommendation. But that will be complex and it will save the record if we do it with API. 

Thank you.

Unfortunately you can't being clicking a link to create a "child" record from an iView Archer wouldn't know what content id to link to the new "child" record like it does from an actual record.

 Advisory Consultant

Are all new records you're creating from the iView linking to the same "parent" record?  If so you could still do it via an iView. You'd just have to append a new parameter to the URL and then have a custom object in the application that would first look for the new parameter, if found then link the id passed to cross-reference field to link them.

 Advisory Consultant