function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Approve Custom Object in SControl

I have a custom object and I wanted to be able to approve it via a SControl.
I was looking at the api "ProcessWorkitemRequest" but do not see any sample on it
I was trying the following code but am getting an error

var request = new sforce.ProcessWorkitemRequest();

request.action = "Approve";

request.workitemId = "{!MyObject__c.Id}";

request.comment = "Automated approval.";

var processRes = sforce.connection.process([request]);

This is giving an error -

"invalid cross reference id"

Any help?