Calling Work Item Template Invocation from Code
3 answers
and why do you think you can only set those fields?
here is one of my java client code sections that creates a new workitem. this is called from a web service, passing the parameters from another system. You build a map of all the fields and values, and 'save that' with the new workitem.
(the synchrule stuff is due to the internal processing my handler provides).
here is one of my java client code sections that creates a new workitem. this is called from a web service, passing the parameters from another system. You build a map of all the fields and values, and 'save that' with the new workitem.
(the synchrule stuff is due to the internal processing my handler provides).
if(!TeamPlatform.isStarted())
TeamPlatform.startup();
try {
IProgressMonitor sPm = new SysoutProgressMonitor();
if(login(sPm)!=null)
{
// get operations handle to repository
IExternalProxy proxy = getExternalProxy(getRepository(),createItem.getProblem(),true, sPm);
IExternalState externalState = InteropFactory.INSTANCE
.createExternalState();
ISyncRule sr = getInteropMgr().findSyncRule(
StringConstants.sfdcworkitem, sPm);
proxy = (IExternalProxy) proxy.getWorkingCopy();
proxy.setSyncRule(sr);
Map<String> states = new HashMap<String>();
System.out.println("processing workitem create\n");
states.put(StringConstants.CreateOnlyType, "defect");
states.put(StringConstants.CreateOnlyfiledAgainst, createItem.getProduct());
states.put(StringConstants.CreateOnlyProblemNumber, createItem.getProblem());
states.put(StringConstants.CreateOnlySummary, createItem.getSummary());
states.put(StringConstants.CreateOnlyCreatedBy, StringConstants.UserPrefix +":"+ createItem.getAuthor());
states.put(StringConstants.CreateOnlyDescription, createItem.getDescription());
java.sql.Timestamp js = new java.sql.Timestamp(java.lang.System.currentTimeMillis());
states.put(StringConstants.CreateOnlyCreationDate, js);
states.put(StringConstants.CommonLastSynch, js);
states.put(StringConstants.CommonStatus, "Initial");
states.put(StringConstants.CommonPriority, createItem.getPriority());
states.put(StringConstants.CommonSeverity, createItem.getSeverity());
states.put(StringConstants.CommonCases,CasestoList(createItem.getCases()));
states.put(StringConstants.CommonComments,CommentstoList(createItem.getComments(),true));
states.put(StringConstants.CommonAttachments,AttachmentstoList(createItem.getAttachments()));
states.put(StringConstants.CommonImpact,createItem.getImpact());
states.put(StringConstants.CommonReproduction,createItem.getHowtoreproduce());
states.put(StringConstants.CommonCircumvention,createItem.getCircumvention());
// save the updated states
externalState.setState(states);
//interop.setSynchronizationEnabled(sr, true, sPm);
// persistently
getInteropMgr().saveProxyWithState(proxy, externalState, sPm);
Thanks for the reply.
I don't want to programmatically create just a work item, but several work items via an existing work item template. Right now, those are the only two "variable" fields that can be set when creating from a work item template.
Any idea on how to do this? Thanks.
Gary
I don't want to programmatically create just a work item, but several work items via an existing work item template. Right now, those are the only two "variable" fields that can be set when creating from a work item template.
Any idea on how to do this? Thanks.
Gary