Get ID from Lookup Field

Get ID from Lookup Field

Hi,

So I have a form Projects that has a lookup field of "Builders". 

I want to export my Projects in CSV, but I need Builders field by ID instead of the actual name from the lookup, as the CSV export, exports with the name not the ID.

So for this reason, I created a field inside Projects form, called BuildersID.

In order to populate, I ran this script:

  1. for each  project in Add_Project[ID != null]
  2. {
  3. project.BuilderID = project.Builders1;  // where Builders1 is my lookup field
  4. }

When I go to the report, the new BuilderID field was populated across all records, but the actual ID that is there is different, and none of them exist in the Builders form.


I tried many ways around this, and no success. I am getting IDs but none is actual the right one. 

Any ideas?