11/26/2024 8:21:51 PM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
|
|
|
|
Attachment Id
Posted: 21 Nov 06 10:22 AM
|
fiogf49gjkf0d Everyone,
I am currently trying to use the attachment table so I can flag out some compliance related docs. I would like to use the standard Application.basicfunctions.insertAttachmentEx to add the file.. however since I can not interact with this function I need to get the row the insert created in the DB and update it, adding my own data to fields not being used currently. We don't use the support function so I was going to use the ticket ID to relate it to my compliance table id.
I am having trouble trying to get the last attachment Id inserted into the database. I read Ryan's artical, which now has me more confused..lol, I tred the following:
Select Attachid From Attachment Where Attachdate in (Select Top 1 Attachdate from Attachment) --- Which didn't bring me the last attachment entered into the table..
Select Max(AttachID) from Attachment --- Which didn't work either
There is the @@Indentiy function however I don't think this is what that is for.
Anyone with an idea on how I can get and be sure I am entering on the last row created in the table..?
Thanks
|
|
|
|
Re: Attachment Id
Posted: 22 Nov 06 3:36 AM
|
fiogf49gjkf0d This SQL should get you the ID of the most recently inserted attachment record:
select a1.attachid from attachment a1 where a1.attachdate = (select max(a2.attachdate) from attachment a2)
There is a small chance that this will return more than one record - in the circumstance where multiple attachment records are written to the database within the same milli-second. Looking ahead to this, you might like to use:
select top 1 a1.attachid from attachment a1 where a1.attachdate = (select max(a2.attachdate) from attachment a2)
which can never return more than 1 record. |
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|