AnsweredAssumed Answered

Scripting a way to find a primary key from another field

Question asked by darcylydia on Jan 3, 2019
Latest reply on Jan 4, 2019 by darcylydia

Hi everyone,

 

I am trying to figure out how to allow a user to choose from an already existing Organization (in my Organizations table) and add it to their contact profile.

 

I started by adding a button "Add Existing Organization" which is scripted to open a card that has the field "Organization PK" on it. I made that a pop-up menu and had it show values from the Organization PK field and also from the Organization Name field as a secondary field. I checked the box "show only values from the second field" so that users would choose from the organization name instead of choosing from a long number (Organization pk).

 

When I did this, whenever I tried to select an organization from the pop-up menu, I received the message "This filed cannot be modified", I assume because it is a primary key. When I change the field to the company name and do it as a pop-up menu I can select a company, but I can't see the Organization ID. In fact, the Organization ID field, if I drag it onto the layout, it stays constant, an ID number which I suppose is related to the record that I am on. I did not script the card to make a new record, but it is in a different layout than the one I was on when I clicked on the button, so I assume it is generating a new record with a new ID?

 

My end goal is to be able to allow users to select an already existing organization while in the contacts layout, script it to find that organizations PK #, create a relationship in the join table and then show up in the portal from ORganizations on the Contacts layout.

 

Any suggestions? Here are some images of the card and the script.

 

Thanks in advance for any advice,

 

Darcy

 

 

 

 

 

 

Screen Shot 2019-01-03 at 2.39.27 PM.pngScreen Shot 2019-01-03 at 2.40.33 PM.pngScreen Shot 2019-01-03 at 2.41.13 PM.png

Outcomes