Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I modify the task lists via oscript? 2

Status
Not open for further replies.

zyoung1002

Technical User
Jul 8, 2010
11
US
Hi,

I got a requirement that I have to change the task list in a case automatically using oscript, and the main problem is the 'assigned to' function, which means I have to assign this task to someone in the livelink system automatically, does anyone has a solution or some sample codes for that?

Thanks very much,

Yang
 
Thanks ggriffit,

What I want to do is to fill the 'assigned to' field in the task lists using the data from the workflow form.

Suppose I am the user and I created a case, in the case, I have several tasks(I already got a task lists in the case template) to do, and I want to assign these tasks to myself(or somebody else in livelink,I can get all the user info) automatically using oscript.

I know the task list has a record in dtree, and the task list id is the owner id for all the sub tasks, but it seems that I can't simply insert user id to the 'ASSIGNEDTO' field in dtree. I believe there are some livelink oscript functions to do that, but where I can find them...
 
I think you will get lucky if you put a break in

TASK:Task LL Nodes:Task:Node.SetAssignees.

I do not know your expertise on oscript but in your workflow code you need to get using a lliapi call a node of subtype task.then you will be able to manipulate it correctly.BTW assigness table is the one you after ...
I would also debug the call from the webgui where you do it manually and trace the call through.
Please note that the task SHOULD be assigned to a user or group who has atleast Edit Permissions on the TASK List.


Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
Certified OT Developer,Livelink ECM Champion 2008
 
Thank you appnair, I am just new to oscript and I just find few materials over internet...
 
The DTREE.ASSIGNEDTO field is NOT the id of the user / group but an internal reference, as per the Schema document - available from OpenText if you sign an NDA.

Also direct db updates are not recommended as they can have unforseen eventualities in some cases which can corrupt your Livelink system.

The method you want need to look at is Task:Task LLNodes:Task:NodeSetAssignees which should to the work for you. There are other methods in that Object to list, add and deleted Assignees.

Have you done the Livelink Developer training as yet ?

Greg Griffiths
Livelink Certified Developer & ECM Global Star Champion 2005 & 2006
 
Thanks ggriffit, I worked as a web developer before and new to livelink oscript.
 
It seems like that the 'NodeSetAssignees' just simply insert(Of course with some validations) two values(node,userid) into the 'Assignees' table...

// Public method
//
// Assign a list of users to a node, overwriting any
// current assignment
//
// Parameters:
//
// node The node.
// context The PrgSession object.
// assigneeList The list of userIDs to assign to the node.
// This MUST be a list of integers or a list
// of assocs with an integer in the field Id.
//
// Return an assoc:
//
// OK TRUE if ok.
// ErrMsg Application error message if not ok.
// ApiError Error returned by API if not ok.
//
function Assoc NodeSetAssignees( \
DAPINODE node, \
Object context, \
List assigneeList = {} )

Dynamic apiError
Dynamic assignee
String errMsg
Assoc retVal
Dynamic status

Object dbConnect = context.fDBConnect
CAPICONNECT connection = dbConnect.fConnection
Integer nodeID = node.pID
Boolean ok = TRUE


status = .CheckAssign( node, context, assigneeList )

if ( !status.ok )
ok = FALSE
errMsg = status.ErrMsg
apiError = status.ApiError
else

if ( !dbConnect.StartTrans() )
ok = FALSE
errMsg = [Task_ErrMsg.ErrorWritingAssigneeData]
else

status = CAPI.exec( connection, 'delete from Assignees where DataID = :A1', nodeID )

if IsError( status )
ok = FALSE
errMsg = [Task_ErrMsg.ErrorWritingAssigneeData]
apiError = status
else

for assignee in assigneeList
status = CAPI.exec( connection, 'insert into Assignees values( :A1, :A2 )', nodeID, assignee )

if IsError( status )
ok = FALSE
errMsg = [Task_ErrMsg.ErrorWritingAssigneeData]
apiError = status
break
end
end
end

dbConnect.EndTrans( ok )

end
end

retVal.OK = ok
retVal.ErrMsg = errMsg
retVal.ApiError = apiError

return retVal

end
 
that is correct but as a general rule you should not touch any direct tables in livelink,because livelink has callbacks registered,you do something here and another module may have subscribed for a alert so if you do db updates they won't get it.If you read my earlier post I have said please put asignees who has at least edit permissions on the task list.With a tasklist in livelink click help for the page and read on about how they work.Simply put the tasklist inherits the permission set of the folder it is on at and only people in that can be made assignees.It is better to go to builder training as then you will become a better livelink programmer

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
Certified OT Developer,Livelink ECM Champion 2008
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top