Create Tasks on the Project Schedule Tab via SDK

Hi Team,

I am checking on how to create the new tasks on the Project schedule via SDK.

Below snippet is not working, it is throwing Null Pointer Exception.

IProgram objParent = (IProgram) session.getObject(IProgram.OBJECT_TYPE, “PROJ12345”);

ITable tabSchedule = objParent.getTable(ProgramConstants.TABLE_SCHEDULE);

Map<Integer, Object> params = new HashMap<Integer, Object>();

params.put(ProgramConstants.ATT_GENERAL_INFO_ACTIVITIES_TYPE, ProgramConstants.CLASS_TASK);
params.put(ProgramConstants.ATT_GENERAL_INFO_NAME, “Adding a Task”);

tabSchedule.createRow(params);

Please let me know if it is possible to create the task on the Schedule tab directly instead of creating first and then changing the Parent of the task.

Thanks,
Anand

Add Comment
3 Answer(s)
Agile User Answered on July 13, 2018.
Add Comment

True – I haven’t dealt with IPrograms but ITransfer Order Where Sent table and a Part’s Manufacturers table requires the same thing – you need two or more different fields added to a Map object in order to create the row.

Agile Angel Answered on July 13, 2018.
Add Comment

You received a null pointer exception which does indicate that Agile tried to get an object but that object was null.  It’s like adding an item number to the affected items tab versus IItem.  Looks like you figured it out.  In my earlier answer, if you didn’t have enough required fields to create the row, I think the normal error message you would have received there should have been an “Invalid Parameter”.

Agile Angel Answered on July 13, 2018.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.