I am trying to modify existing API rtb_events.p to get object related fields information as below
IF Pevent = "checkinObjectBefore" THEN DO:
DEFINE VARIABLE hVer AS HANDLE NO-UNDO.
DEFINE VARIABLE hObj AS HANDLE NO-UNDO. DEFINE VARIABLE hVerBuf AS HANDLE NO-UNDO. DEFINE VARIABLE hObjBuf AS HANDLE NO-UNDO. /* Use Roundtable proxy procedures to get the Object and Version data */ RUN rtb/proxy/p/rtbGetObjectByRowid.p (INPUT Pcontext, OUTPUT TABLE-HANDLE hObj). hObjBuf = hObj:DEFAULT-BUFFER-HANDLE. hObjBuf:FIND-FIRST. RUN rtb/proxy/p/rtbGetVersionByRowid.p (INPUT hObjBuf::objVersionRowid, OUTPUT TABLE-HANDLE hVer). hVerBuf = hVer:DEFAULT-BUFFER-HANDLE. hVerBuf:FIND-FIRST. /* If not update notes are present, set the error message */ IF hVerBuf::upd-notes = "" THEN DO: cError = "Object version update notes cannot be blank!". pOk = FALSE. END. DELETE OBJECT hVer NO-ERROR.
But here I am not getting task related information such as Task Summary, History, Description.
How do I accomplish this ?
You can call rtb/proxy/p/rtbGetTask.p passing hVerBuf::task-num to get the Task Summary and Description.
Roundtable Product Architect
How can we catch output from this rtbGetTask.p as we are passing only input, no output parameters. I do not have rtbGetTask.p file available in progress code only r code is there, so not able to identify the actual structure of this file.
Looking at the rcode I'd say it's also an output table handle.
Not the nicest way to get info, but sometimes it helps.
It is indeed a table-handle like the other proxy calls in your example.
Thanks guyz its running now but what i found here that hVerBuf::task-num field has wrong value, it is not the same task no that i am completing. For e.g. I am closing task no 100 but i am receiving task no 35 in that field. I am catching all these in 'CompleteTaskBefore' event.
In my code I do a find last on rtb_ver but I work directly on the database so there could be a difference between the db table and the temp-table
find rtb_object where rowid(rtb_object) = to-rowid(pcontext) no-lock.
find last rtb_ver of rtb_object no-lock.
find rtb_task where rtb_task.task-num = rtb_ver.task-num no-lock.
Each Version is associated with a specific Task (as Carl's direct db example shows). However, direct DB access is discouraged and not supported unless specify directed by a tech support engineer.
A description of your what you want to accomplish with the hook would be helpful. Others may have already written what you are trying to do.
I changed it to find last but still not able to find the actual task no, showing wrong task no. My code is as below
IF Pevent = "completetaskbefore" THEN
(INPUT Pcontext, OUTPUT TABLE-HANDLE hObj).
hObjBuf = hObj:DEFAULT-BUFFER-HANDLE.
(INPUT hObjBuf::objVersionRowid, OUTPUT TABLE-HANDLE hVer).
hVerBuf = hVer:DEFAULT-BUFFER-HANDLE.
message rtb_ver.task-num view-as alert-box.
(INPUT hVerBuf::task-num, OUTPUT TABLE-HANDLE hTsk).
hTskBuf = hTsk:DEFAULT-BUFFER-HANDLE.
DO i = 1 TO hTskBuf:NUM-FIELDS:
MESSAGE hTskBuf:BUFFER-FIELD(i):NAME hTskBuf:BUFFER-FIELD(i):BUFFER-VALUE VIEW-AS ALERT-BOX.
I want to read the actual task no, summary and description dynamically.
There is no context passed to the completeTaskBefore event. Please review the comments in the header of rtb_events.p.
thanks. its working now.