Re: Email notifications not sent to $L.delegates (602 Views)
Reply
Honored Contributor
Audrey H.
Posts: 1,277
Registered: ‎07-27-2006
Message 1 of 9 (614 Views)
Accepted Solution

Email notifications not sent to $L.delegates

[ Edited ]

Hi,

 

We are implementing Approval Delegations for Change and I'm trying to configure a notification so that an email is sent to Change approvers Approval Delegates, which I've been given to understand is $L.delegates (if the jscall("ApprovalDelegationGroups.checkDelegation") is part of the notification condition), but so far have had no success. I've also tried in my OOB instance of the same version (SM9.33) and for a regular Change it did not send an email to the $L.delegates either. Has anyone successfully got these $L.delegates notifications working and is there anything special I need to do for them to be produced?

 

If I remove the jscall as part of the notification condition and change the recipient to a hard coded value, the email goes to the address hardcoded as the recipient, but the minute I put the jscall back in and change my recipient to $L.delegates then no email is produced.  I am testing where the new operator in the current.pending.groups has definitely delegated their approvals and they show in the delegates Approval Queue.

 

Audrey

Honored Contributor
John Stagaman
Posts: 3,429
Registered: ‎07-13-2007
Message 2 of 9 (602 Views)

Re: Email notifications not sent to $L.delegates

Darnit. I was hoping you were on a 7.x version, where delegate notifications were absent from several releases. 

 

In my 9.33 OOB system, delegate notifications appear to be generated as expected. I'll test some more when I have a chance.

----------------------------------------------------
Kudos - what, where, how, and why
Want Good Answers? Ask Good Questions...
Honored Contributor
Piku
Posts: 3,972
Registered: ‎06-17-2010
Message 3 of 9 (575 Views)

Re: Email notifications not sent to $L.delegates

Hi Audrey,

Did you tried to put some print statement in this function to check whether values are setting as desired for operators.

hth,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assign Kudo, if found post useful and mark it accepted if solves the issue.
http://h30499.www3.hp.com/t5/Tips-and-Tricks/Kudos-what-where-how-and-why/m-p/5677925#U5677925
Honored Contributor
Audrey H.
Posts: 1,277
Registered: ‎07-27-2006
Message 4 of 9 (565 Views)

Re: Email notifications not sent to $L.delegates

@ Piku

 

I have rtecalls to print messages from the notification records, so I know it is being called, and since the issue seemed to be what was returned from the jscall("ApprovalDelegationGroups.checkDelegation") ScriptLibrary record,  I had put a few print() statements there and immediately got results the I didn't expect.  My first print statement was just before the "if" statements that check the vars.$L_file.file_name.  When I put print(vars.$L_file.file_name); in the line before this group of statements it returned "null".  This seems wrong, but perhaps you can tell me if you get the same.  I also put a print statement at the end of the function  right before the line " vars.$L_delegates=moreOperators;".  I put print(moreOperators); and got "undefined", but perhaps I'm suppose to write my print statement differently since it would be an array?  Perhaps you can suggest if there are other places where it would be useful to add a print statement?

 

 

@John,

 

I had been thinking the same as you John, that maybe something I had in my SM7 environment carried over when I upgraded to SM9.33, or maybe I could test if it was working before the upgrade, but when I checked my old environment Approval Delegation wasn't even there, so I've kind of eliminated that as a useful area of investigation.

 

Audrey

Honored Contributor
Piku
Posts: 3,972
Registered: ‎06-17-2010
Message 5 of 9 (556 Views)

Re: Email notifications not sent to $L.delegates

HI,

Try to put print just before last line having 'return' ,
print("delegated " + vars.$L_delegates);

print(moreOperators); should also print the value irrespective of array.

This delegation feature not exists till 7.0x and added in 7.1x, also the function [checkDelegation()] we talking about is fix for some QCR, mentioned just before it in SL.
//This function is the fix of QC48598(Emails do not get sent out to the approval delegates as the documentation says). Find the delegations and store them
//in the $L.delegates.The notification should add another msg to send the email.

Till 9.21, there is still no such mail delivers.

hth
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Assign Kudo, if found post useful and mark it accepted if solves the issue.
http://h30499.www3.hp.com/t5/Tips-and-Tricks/Kudos-what-where-how-and-why/m-p/5677925#U5677925
Honored Contributor
Audrey H.
Posts: 1,277
Registered: ‎07-27-2006
Message 6 of 9 (551 Views)

Re: Email notifications not sent to $L.delegates

Hi,

 

I figured out why my notification wasn't going to $L.delegates

 

The notifications that I tested adding my new line to already had a falsed out line with a similar condition that called the jscall("ApprovalDelegationGroups.checkDelegation") and with the recipient of $L.delegates, so I just copied it to a new line, modified the condition slightly and tested.  The problem was that all the notifications I added my new line to (which were triggering) where ChM notifications and $L.file is the value of the cm3r record, not the Approval record.  There is no field called file.name in the cm3r record, so the JavaScript is never fed the necessary information to produce any results.  As soon as I added my new notification line to the Approval Added_1 record it correctly used the Approval record to produce the $L.file, which does have a field called file.name, so it correctly populated $L.delegates and sent the OOB message.

 

It seems strange that there are any OOB ticket record notifications that would call this JavaScript, since they would never produce any results without the field called file.name.  Anyway, I figured it out, so I can now move forward with configuring things as necessary to produce the notifications that I want.

 

Thanks for the help.

 

Audrey

Honored Contributor
John Stagaman
Posts: 3,429
Registered: ‎07-13-2007
Message 7 of 9 (539 Views)

Re: Email notifications not sent to $L.delegates

[ Edited ]

Sorry Audrey, my response above was incorrect. On re-testing in 9.33 OOB, delegate notifications are not working. I'm sure we got these working from ChM notifications at my last customer, but I'll have to look into what we did. I know we didn't base the notification off the Approval record (though a rather clever solution).

 

HOWEVER, I believe there is another defect in the OOB script:

So far as I can tell, it will only notify delegates for an operator-level delegation, not group-level delegations.

  1. I split out the script to hardcode the tables and call the module-specific script from the notification def.
  2. The Delegations that applied to the test record were all for group-level approvals, not operator-assigned approvals.
  3. I could not get it to work, but it did work only if a pending approval was for an individual operator that had delegated to another operator (not a group approval).
  4. Looking further, the query built by checkDelegation is incorrect. It queries: var query="Approver isin "+ system.functions.str(vars.$L_file.current_pending_groups);

BUT Approver is always the ID of the oringinal approval operator and--if groups are assigned--the group-level delegation will not return a notification for delegates (because the operator IDs are not listed in current.pending.groups, only the group names).

INSTEAD:

var query = "AppGroup isin "+ system.functions.str(vars.$L_file.current_pending_groups)

will consistently work, whether the pending approval is an operator-level or group-level delegation (because current.pending.groups includes both groups and approvals assigned to specific operators such as owner in $L.file).

 

The AppGroup field identifies the group/operator for which delegation is assigned, while the Approver field is the individual operator for whom those rights are assigned. 

 

Impact: Confirm that your workaround notifies delegates not only for approvals pending for a specific operator, but also for those pending for groups. 

----------------------------------------------------
Kudos - what, where, how, and why
Want Good Answers? Ask Good Questions...
Honored Contributor
Audrey H.
Posts: 1,277
Registered: ‎07-27-2006
Message 8 of 9 (532 Views)

Re: Email notifications not sent to $L.delegates

[ Edited ]

Hi John,

 

Adding the notification to the "Approval Added_1" notification worked immediately, but I can't produce the email that I want with the fields in the Approval record, so I experimented with adding it to my ChM notification record and just changing the if() statement in the ScriptLibrary record (ApprovalDelegationGroups.checkDelegation) so that it doesn't look for a file.name of cm3r, and instead looks for the number starting with "CM".  This evaluated correctly to produce the query which then produced my $L.delegates list and correctly sent my notifications, but it just seems strange to me that I have to modify this script at all.  I would have thought it should have been configured to work using the ticket as $L.file since there are a few OOB ticket based notification records that call this ScriptLibrary record and if the if() statement that produces the query references a field that doesn't exist I don't see how it will ever produce the $L.delegates list.

 

If you found a better way than modifying the script I would be very interested to know it.

 

Audrey

Honored Contributor
Audrey H.
Posts: 1,277
Registered: ‎07-27-2006
Message 9 of 9 (530 Views)

Re: Email notifications not sent to $L.delegates

John,

 

It is very interesting about the Approver vs AppGroup.  Thanks for letting me know about that.  I will have to do some testing around that also.

 

Audrey

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.