Let's see. Have you any experience with Smarteam API? What you want to do is not trivial if you are not used to it.
You should start with Client-Side Hooks for Client-Based Applications.pdf and use as reference SmarTeam Object Model Programmers Guide.pdf and STComRefGuide.chm.
There you'll find info on how to exchange data between Smarteam and your customs.
Some tips:
* Check first chapters of Client-Side Hooks for Client-Based Applications.pdf about passing info to and from Smarteam.
* If you launch your custom with a button, then you should check on Client-Side Hooks for Client-Based Applications.pdf chapter about Profile Cards Script Hooks -> On Click (more or less page 34). SecondPar RecordList provides the info you need. On ThirdPar you'll return your output.
* You should use a DLL. And reference at least some .NET Smarteam Libraries (SmarTeam.Std.Interop.SmarTeam.SmApplic.dll , SmarTeam.Std.Interop.SmarTeam.SmRecList.dll, and others depending on your needs)
* This is an example of a Script that will call your DLL. The function parameters are fixed, you should respect this structure, as you'll see on the documentation.
Usually you get info of the object on FirstPar and SecondPar parameters (that in fact are "handlers" or memory pointers that are converted to Record Lists below.
****************************************************************
TestScript.vb
****************************************************************
Function OnClick_Test(ApplHndl As Long,Sstr As String,FirstPar As Long,SecondPar As Long,ThirdPar As Long ) As Integer
Dim Session As SmSession
Set Session = SCREXT_ObjectForInterface(ApplHndl)
Dim RecListIn As Object
Dim SecRecListIn As Object
Dim RecListOut As Object
Dim BufferOut As Object
CONV_RecListToComRecordList FirstPar, RecListIn
CONV_RecListToComRecordList SecondPar, SecRecListIn
CONV_RecListToComRecordList ThirdPar, RecListOut
'You can check recordlist contetns
'RecListIn.PrintToFile "","c:\Temp\OnClick_TestRecListIn.log"
'SecRecListIn.PrintToFile "","c:\Temp\OnClick_TestSecRecListIn.log"
'RecListOut.PrintToFile "","c:\Temp\OnClick_TestRecListOut.log"
Dim PLMDB As Object
Set PLMDB = CreateObject("YourDLL.Application"
PLMDB.OnClick_Test(Session, RecListIn, SecRecListIn, BufferOut)
If BufferOut Is Not Nothing Then
RecListOut.CopyExternal BufferOut
CONV_ComRecListToRecordList RecListOut, ThirdPar
End If
Set PLMDB= Nothing
End Function
*****************************************************************
* As I usually use on entry point Library, I use the same scructure (on VB.NET), like this:
Imports SmarTeam.Std.Interop.SmarTeam.SmApplic
Imports SmarTeam.Std.Interop.SmarTeam.SmRecList
Imports System.Runtime.InteropServices
Public Interface iMap
'*****************************************************
' Interfaces: Fucntion Entries.
'*****************************************************
Function OnClick_Test(ByVal SmSession As SmSession, _
ByVal FirstRec As ISmRecordList, ByRef BufferIn As ISmRecordList, ByRef BufferOut As ISmRecordList) As Integer
End Interface
Public Class Application
Implements iMap
Const ERR_NONE As Short = 0
Const ERR_GEN As Short = 1
Const ERR_REFUSE As Short = 6
Public Function OnClick_Test(ByVal SmSession As SmSession, _
ByVal FirstRec As ISmRecordList, ByVal SecondRec As ISmRecordList, ByRef Buffer As ISmRecordList) As Integer Implements iMap.OnClick_Test
'This is where I call another DLL or class inside my DLL so I split Presentation, Business Logic on layers
With New clsOnClick_Test
OnClick_Test = (IIf(.ClickTest(SmSession, FirstRec, SecondRec, Buffer), ERR_NONE, ERR_GEN))
End With
'So Buffer RecordList will return info to write to Profile Card.
End Function
End Class
**************************************************
I hope this helps.
Please contact me if you need more help!
Regards,
Eduardo
|