﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Retrieving the new primary key after executing .NewRow and .Save</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Mon, 29 Jun 2026 05:33:35 GMT</lastBuildDate><ttl>20</ttl><item><title>Retrieving the new primary key after executing .NewRow and .Save</title><link>http://forum.strataframe.net/FindPost23813.aspx</link><description>I could not find the answer on the forum or in the SF Help.&amp;nbsp; How do I retrieve the newly created primary key after executing the following code:&lt;P&gt;&amp;nbsp;&amp;nbsp;Using job As New PRJTJobsBO&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;With job&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.NewRow()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.job_Customer = "jeff"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.job_Name = "Jeff's Job"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;If .Save = MicroFour.StrataFrame.Data.SaveUndoResult.Success Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Return ...newly created primary key??????&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;End If&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;End With&lt;BR&gt;&amp;nbsp;&amp;nbsp;End Using &lt;/P&gt;&lt;P&gt;&lt;BR&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jeff</description><pubDate>Tue, 14 Jul 2009 07:38:31 GMT</pubDate><dc:creator>Jeff Pagley</dc:creator></item><item><title>RE: Retrieving the new primary key after executing .NewRow and .Save</title><link>http://forum.strataframe.net/FindPost23821.aspx</link><description>Thanks, Greg! :)</description><pubDate>Tue, 14 Jul 2009 07:38:31 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Retrieving the new primary key after executing .NewRow and .Save</title><link>http://forum.strataframe.net/FindPost23816.aspx</link><description>Things are often as easy as they seem with SF.  When I don't know how to do something, I'll often just try what might work and it often does. Glad that helped.</description><pubDate>Mon, 13 Jul 2009 14:36:25 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Retrieving the new primary key after executing .NewRow and .Save</title><link>http://forum.strataframe.net/FindPost23815.aspx</link><description>That was it.&amp;nbsp; I thought about that, but&amp;nbsp;for some reason I was&amp;nbsp;thinking when the BO added a record it reset the cursor to the first record in the BO and I needed to do something special to retrieve the new ID.&lt;/P&gt;&lt;P&gt;Thank You,&lt;/P&gt;&lt;P&gt;Jeff</description><pubDate>Mon, 13 Jul 2009 07:01:32 GMT</pubDate><dc:creator>Jeff Pagley</dc:creator></item><item><title>RE: Retrieving the new primary key after executing .NewRow and .Save</title><link>http://forum.strataframe.net/FindPost23814.aspx</link><description>Assuming that the PK is auto incremented, you just access its property:&lt;br&gt;
&lt;br&gt;
[codesnippet]Using job As New PRJTJobsBO&lt;br&gt;
&amp;nbsp;&amp;nbsp;With job&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.NewRow()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.job_Customer = "jeff"&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.job_Name = "Jeff's Job"&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;If .Save = MicroFour.StrataFrame.Data.SaveUndoResult.Success Then&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Return .job_ID '-- if job_ID is the BO property that contains the ID&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;End If&lt;br&gt;
&amp;nbsp;&amp;nbsp;End With&lt;br&gt;
End Using [/codesnippet]</description><pubDate>Fri, 10 Jul 2009 14:02:47 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item></channel></rss>