+ Start a Discussion
lodoss118lodoss118 

ProcessSubmit Request and ProcessWorkItemRequest

Hi guys i am using javascript to reassign an approval to someone else but i am having problems getting the workitemitds i am confused on what methods i can call on these two objects in javascript


var rDate = new Date();
                rDate.setDate(rDate.getDate() + 2);       
                CreateTask("00520000000tKm3", "IS IN SALES - SENIOR MANAGER", "SUP SUP", rDate, "High");
                UpdateCaseStage("Senior Manager");
               
                var request = new sforce.ProcessSubmitRequest();
                request.objectId = "{!Case.Id}";
                request.comments = "Test Process Submit Request";
                var processRequest = sforce.connection.process([request]);
                //alert(processRequest);
           
                var record = new Array();
                record[0] = processRequest[0];
                alert(record[0].success);
               
                /*var workItem = new sforce.ProcessWorkitemRequest();
                workItem.action = "Approve";
                workItem.workitemId = "04aT00000008POi";
                workItem.nextApproverIds = "00520000000sbtx";
                workItem.comments = "Assigned to Senior Manager";
                var processWorkItem = sforce.connection.process([workItem]);
                alert(processWorkItem);*/


What i am trying to do is get the workItemId from processRequest object but having no go help pls?
werewolfwerewolf
Each ProcessResult item will contain an array of workitem IDs:

http://www.salesforce.com//us/developer/docs/api/Content/sforce_api_calls_process_processresult.htm#topic-title

So in your code below you can probably iterate through the items in processRequest[0].newWorkItemIds.
AmitabhleoAmitabhleo
Hi were you able to resolve the problem.

I am also getting the following error :

{entityId:null, errors:{fields:null, message:'invalid cross reference id', statusCode:'INVALID_CROSS_REFERENCE_KEY', }, instanceId:null, instanceStatus:null, newWorkitemIds:null, success:'false', }
}

Thanks in advance.

Amitabh