Skip to main content
Solved

Apps 9 - Approval Creator

  • November 16, 2021
  • 9 replies
  • 270 views

Forum|alt.badge.img+4

Afternoon,

 

Has anyone ever found a location for the Approval Creator? Basically, what I’m attempting to create using a custom event is to email the creator of the approval process if the approval line is ‘Approved’

 

I’ve checked some of the views such as Approval_current_step and Approval_Routing and neither of these have the creator of the approval process.

 

Any ideas?

 

Kind regards,

Ryan

Best answer by Mathias Dahl

Checked the code again, and found this:

      IF lu_name_ = 'DocIssue' THEN
         Get_Receiver_And_Admins___(receiver_, admin_list_, key_ref_, include_admins_);
      ELSE
         receiver_   := 'NO RECEIVER DEFINED';
      END IF;

As you can see and which is perhaps the reason you ask, when an approval routing is connected to other business objects than documents, there is really no receiver for this event, and the code just sets ‘NO RECEIVER DEFINED’ then. The only way we could have one would be to store whoever added the approval step, and use that as the receiver here. We don’t do that though. Or, we could of course enhance this functionality and make it configurable per object type how to determine the receiver. So, there is room for improvement here…

What you probably can do is to use another event action type, Execute Online SQL. There you can run and SQL or PL/SQL you need to determine the receiver. Once you have it you can send an e-mail using the Command_SYS package. If you search here on Community you might find some code example from which you can copy some code.

Here is the method signature for the Mail method in that package:

PROCEDURE Mail(
   sender_        IN VARCHAR2,
   from_          IN VARCHAR2,
   to_list_       IN VARCHAR2,
   cc_list_       IN VARCHAR2 DEFAULT NULL,
   bcc_list_      IN VARCHAR2 DEFAULT NULL,
   subject_       IN VARCHAR2,
   text_          IN CLOB,
   attachments_   attachment_arr,
   mail_sender_   IN VARCHAR2 DEFAULT NULL);

Good luck!

 

View original
Did this topic help you find an answer to your question?

9 replies

matt.watters
Superhero (Partner)
Forum|alt.badge.img+25
  • Superhero (Partner)
  • 566 replies
  • November 16, 2021

Some things to consider:

  • If the approval routing is created from a template connected to the Document Class in Doc Default Values, then is the creator of the Approval Process the document Responsible Person?
  • If the approval routing is manually assigned, either via RMB-Copy Approval Template or line-by-line, then is the creator of the Approval Process still the Document Responsible Person or the user (possibly another Doc Admin) that added the lines? There is nothing in the Document Revision History that shows that Approval lines were added, only when they are modified or removed.
  • Is the Approval Creator defined as the user that changes the document revision status from Preliminary to Approval in Progress? This info can be obtained from the Document Revision History. Note, though, that there could be multiple instances of one document revision moving from Preliminary to Approval in Progress, each performed by a different user.

Forum|alt.badge.img+28
  • Superhero (Customer)
  • 1482 replies
  • November 16, 2021

You need an event action like this to notify the originator.  Event is out of the box.

 

 

 

 

Took me a while to find this one as well, but once set up, it has worked fine for me.


Forum|alt.badge.img+4
  • Author
  • Sidekick (Customer)
  • 7 replies
  • November 17, 2021
ShawnBerk wrote:

You need an event action like this to notify the originator.  Event is out of the box.

 

 

 

 

Took me a while to find this one as well, but once set up, it has worked fine for me.

Hi Shawn,

 

I’ll give this a test today and let you know if it works as expected. It does look very promising.

Thanks for the information.

 

Regards,

Ryan


Forum|alt.badge.img+4
  • Author
  • Sidekick (Customer)
  • 7 replies
  • November 18, 2021
ShawnBerk wrote:

You need an event action like this to notify the originator.  Event is out of the box.

 

 

 

 

Took me a while to find this one as well, but once set up, it has worked fine for me.

Hi Shawn

 

Thanks for the information again.

 

I’ve managed to get most of the event to work however, when I use the ‘RECEIVER’ field it either returns as just the field name &RECEIVER or has the text ‘NO RECEIVER DEFINED’. Do you have any idea why this could be? 

 

Thanks


Mathias Dahl
Superhero (Employee)
Forum|alt.badge.img+32
  • Superhero (Employee)
  • 2824 replies
  • November 18, 2021

I had a quick look at the code and it looks like the receiver should get the name of the user that created the document revision. When used in an e-mail, the event framework/execution engine should then look up the e-mail address for the foundation user with that name. Perhaps the e-mail address is not in place?

 


Mathias Dahl
Superhero (Employee)
Forum|alt.badge.img+32
  • Superhero (Employee)
  • 2824 replies
  • Answer
  • November 18, 2021

Checked the code again, and found this:

      IF lu_name_ = 'DocIssue' THEN
         Get_Receiver_And_Admins___(receiver_, admin_list_, key_ref_, include_admins_);
      ELSE
         receiver_   := 'NO RECEIVER DEFINED';
      END IF;

As you can see and which is perhaps the reason you ask, when an approval routing is connected to other business objects than documents, there is really no receiver for this event, and the code just sets ‘NO RECEIVER DEFINED’ then. The only way we could have one would be to store whoever added the approval step, and use that as the receiver here. We don’t do that though. Or, we could of course enhance this functionality and make it configurable per object type how to determine the receiver. So, there is room for improvement here…

What you probably can do is to use another event action type, Execute Online SQL. There you can run and SQL or PL/SQL you need to determine the receiver. Once you have it you can send an e-mail using the Command_SYS package. If you search here on Community you might find some code example from which you can copy some code.

Here is the method signature for the Mail method in that package:

PROCEDURE Mail(
   sender_        IN VARCHAR2,
   from_          IN VARCHAR2,
   to_list_       IN VARCHAR2,
   cc_list_       IN VARCHAR2 DEFAULT NULL,
   bcc_list_      IN VARCHAR2 DEFAULT NULL,
   subject_       IN VARCHAR2,
   text_          IN CLOB,
   attachments_   attachment_arr,
   mail_sender_   IN VARCHAR2 DEFAULT NULL);

Good luck!

 


Forum|alt.badge.img+4
  • Author
  • Sidekick (Customer)
  • 7 replies
  • November 18, 2021
Mathias Dahl wrote:

Checked the code again, and found this:

      IF lu_name_ = 'DocIssue' THEN
         Get_Receiver_And_Admins___(receiver_, admin_list_, key_ref_, include_admins_);
      ELSE
         receiver_   := 'NO RECEIVER DEFINED';
      END IF;

As you can see and which is perhaps the reason you ask, when an approval routing is connected to other business objects than documents, there is really no receiver for this event, and the code just sets ‘NO RECEIVER DEFINED’ then. The only way we could have one would be to store whoever added the approval step, and use that as the receiver here. We don’t do that though. Or, we could of course enhance this functionality and make it configurable per object type how to determine the receiver. So, there is room for improvement here…

What you probably can do is to use another event action type, Execute Online SQL. There you can run and SQL or PL/SQL you need to determine the receiver. Once you have it you can send an e-mail using the Command_SYS package. If you search here on Community you might find some code example from which you can copy some code.

Here is the method signature for the Mail method in that package:

PROCEDURE Mail(
   sender_        IN VARCHAR2,
   from_          IN VARCHAR2,
   to_list_       IN VARCHAR2,
   cc_list_       IN VARCHAR2 DEFAULT NULL,
   bcc_list_      IN VARCHAR2 DEFAULT NULL,
   subject_       IN VARCHAR2,
   text_          IN CLOB,
   attachments_   attachment_arr,
   mail_sender_   IN VARCHAR2 DEFAULT NULL);

Good luck!

 

Thanks for the information,

 

It would make sense to have a record of who created the approval, realistically I thought this would be an out of the box field. I’ll see if I can write some customisation that saves the ‘person ID’ of who has created the approval. 

 

The Custom Menu I created to apply the approval could maybe be the trigger. I just need to figure out how to save the creator of the approval now

 

Thanks


Mathias Dahl
Superhero (Employee)
Forum|alt.badge.img+32
  • Superhero (Employee)
  • 2824 replies
  • November 18, 2021

By using a custom event you should be able to save to some place who created each approval step. You could use a custom field or some unused field on the object.

 


Forum|alt.badge.img+28
  • Superhero (Customer)
  • 1482 replies
  • November 18, 2021

For us, the creator of the document revision and the user starting the approval are one and the same, so it works for us due to that simplicity.  For a separate user attaching the approval, then yes, you’ll have to grab the user email you want via an additional event.  I’ll likely have to do the same with future approval routes that become more complex where I need to notify more than one user that the approval is complete.  Just don’t have that setup currently.

It would be useful once you get it all working to update this post with the solution you arrive at, when you have a chance.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings