context.saveObject method

Which IIQ version are you inquiring about?

Version 8.X

Is this question regarding a custom connector? If so, please share relevant details below.

No, this question is not regarding a custom connector.

Please share any other relevant files that may be required (for example, logs).

Approval Assignment Rule .txt (8.32 KB)

Share all details related to your problem, including any error messages you may have received.

Hi all,

I am new to rule development and I have a question on the saveObject method. Can the saveObject method be used on approvalItems, approvalSets, and workItems?

I tried using the method on approvalItem it threw a method invocation error

BeanShell script error: bsh.EvalError: Sourced file: inline evaluation of: import sailpoint.object.*; import sailpoint.object.Workflow; import sailpoint. . . . '' : Error in method invocation: Method saveObject(sailpoint.object.ApprovalItem) not found in class'sailpoint.server.InternalContext' : at Line: 117 : in file: inline evaluation of: import sailpoint.object.*; import sailpoint.object.Workflow; import sailpoint. . . . ‘’ : context .saveObject (aItem)

I have attached the rule that threw the error. as a txt file. Could anyone please help ?

If I remember right, context.saveObject can be used for high level objects like Identity, Application, … only

1 Like

From the javadoc:

void saveObject(SailPointObject obj)
         throws GeneralException

Save an object in the persistent store.

It can save any object which extends SailPointObject.

ApprovalItem and ApprovalSet are not extending SailPointObject, therefore it cannot be saved using saveObject.
Workitem does extend SailPointObject and can be saved.

The javadoc can be found at each installation (and should be removed in production environments) via https:///identityiq/doc/javadoc/index.html

When saving an object, be sure the transaction is committed as well, otherwise it will not be saved in the database.

      context.saveObject(object);
      context.commitTransaction();

– Remold

2 Likes

@sreeram
As @iamnithesh and @Remold mentioned you cannot save Approval Item object but you can set the state of the item within the approval Assignment rule, what is your exact use case here so that we can help accordingly.

1 Like

Hi @iamnithesh @Remold @iamksatish

Thank you for your response.

To elaborate, the rule is an approvalAssignmentRule. I was using this rule to develop a custom approval mechanism. The custom approval requires 2 level of approvals(1. Manager, 2. Owner (custom owner fetched from a customObj)).
Approval Mode: Serial
approvalSplitPoint: Owner

I configured the LCM provisioning and approve and provision workflow to split the approval into parallel mode by defining the approvalSplitpoint & providing the approvalAssignmentRule to handle the logic.

However, after the manager’s approval, it skips the 2nd level of approval and directly provisions. Looking at the trace, It was observed that the workItem state is set to “Finished” after the manager’s approval.

I’ve attached the post I made on the issue here, Any help is appreciated.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.