Adding Attachments to case created via service rest in Pega 7.2
I am creating a case form a service activity using svcAddWorkObject ootb activity. It includes pzAddAttachmentsToWork activity which has the below java code to add attachments to the case created.
StringMap keys = new HashStringMap();
keys.putString("pxObjClass", "Rule-Obj-CaseType");
keys.putString("pyPurpose", "pyDefault");
ParameterPage pp = new ParameterPage();
pp.putString("pyCaseTypePurpose", "ADDATTACHMENT");
pp.putString("WorkPage", myStepPage.getName());
try { tools.doAction(keys, tools.getPrimaryPage(), pp); }
catch (com.pega.pegarules.pub.generator.RuleNotFoundException ex) { // No CaseType found: ignore that situation tools.getStepStatus().backoutWorst(); }
This code, for some reason does not work. I see it looks for ADDATTACHMENT purpose in the case type. I do not see any ADDATTACHMENT purpose in any case type.
Can anyone explain what exactly does this java code do and why is it not working for my use case ?