Question : Create Link to Parent

Experts,
I have a main doc called "company profile" that lists details of a vendor.  A vendor can have another company as a sub-vendor linked to them.  So, I have embedded views that provide this information when I use a form called "sub vendor" that is a response to the main doc.  What I need is the ability to grab the $ref value, so I can have a link back to the parent doc (Company B as outlined below).  

This is how I have the form working now:
1. Main doc is created, company profile, this is now Company A
2. Button on main doc (Company A) opens a new "sub-vendor" form, which is a response doc type
3. This new form, grabs the company name from the prior form (Company A), (inherits values) and a "Parent Name" field is populated.
4. On the "sub vendor" form, I then have a button called "Select Vendor" that opens a PickList form and uses a view that has all of the company profiles -- selecting one will pull in other values I need from the company profile.  This company profile will always be a different one that the "Parent Vendor".  So, this new form will create a response doc linked to Company A with some of Company B's info.

What is happening is that the field I created (computed for display) on the sub-form with $Ref is capturing the original "Parent Vendor" link -- Company A and not the one from the PickList - Company B.  I have the following code that currently grabs one field from the new company profile (Company B)-- from the picklist.  Is there other code that I can add to grab the $Ref from the picklist?  Other ideas?

Ideally, from the embedded view (of Company A), I'd would expect folks to double click the sub-vendor form, which has limited data of Company B to go to the company profile get more details.

(Note - I tried removing the $Ref (from Company A) with SetField, but that didn't work)

Thanks in advance!

==============
@SetField("VndProfileLink";@Trim(@Replace(VndProfileLink;VndProfileLink;"")));
selection:=@PickList( [Custom] ; @DbName ; "(AllVendors)" ; "Select a Vendor" ; "Please select the vendor you want to add as a sub-vendor" ; 1 );
FIELD VndSubVendor :=  @Trim(VndName:(@Word(selection;"¥";1)));
@Command([ViewRefreshFields])

Answer : Create Link to Parent

Now I wonder... Does that actually work, a CwC-field with that formula?? AFAIK, a CwC-field is composed at the start, and the Universal ID of a document is only known AFTER it's been saved... So please check that the documents contain the correct value. In the future, please use @Unique if you need unique keys in a database...

Create a doclink? In Notes? Better use an action button that executes some code.
Random Solutions  
 
programming4us programming4us