cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1738
Views
1
Helpful
15
Replies

Approval Email Default Objects?

guthrie
Level 4
Level 4

It's well known that ctxt, util and logger are available in workflows but what about Approval Emails?  By example, ctxt is not.

018-03-01 04:15:20,884 [WFExec-4063-1] ERROR generateEmailNotificationOnDefaultTemplate(ApprovalEmailSender.java:1055) - Error in generate email

javax.script.ScriptException: ReferenceError: "ctxt" is not defined in <eval> at line number 108

    at jdk.nashorn.internal.runtime.ECMAErrors.error(ECMAErrors.java:57)

By tearing apart the "User Approval Workflow", I have gathered the details below but I am wondering if someone else has more?  I would like to pull in other workflow details into the approval emails but the particulars of what is available in the email approval environment seem a little scarce.

request: com.cloupia.lib.util.emailtemplates.EmailGenerationRequest

-    I cannot find references in cucsd-open-auto-sdk-javadocs-6.5.0.0

request.getDataObject(): com.cloupia.lib.util.emailtemplates.wrappers.EmailContentForWorkflowWrapper

-    I cannot find references in cucsd-open-auto-sdk-javadocs-6.5.0.0

request.getDataObject().getSettings(): com.cloupia.model.cIM.MailSettings

     Documented in: cucsd-open-auto-sdk-javadocs-6.5.0.0/com/cloupia/model/cIM/MailSettings.html

request.getDataObject().getObjects().getWorkFlow(): com.cloupia.model.cIM.WorkFlow

     Documented in:  cucsd-open-auto-sdk-javadocs-6.5.0.0/com/cloupia/model/cIM/WorkFlow.html

request.getDataObject().getObjects(): com.cloupia.service.cIM.inframgr.workflowmgr.WorkFlowObjects

-    I cannot find references in cucsd-open-auto-sdk-javadocs-6.5.0.0

api: com.cloupia.lib.util.emailtemplates.EmailTemplateAPIFunctions

-    I cannot find references in cucsd-open-auto-sdk-javadocs-6.5.0.0

Using the launch Interpreter I see the following:

var a = new com.cloupia.lib.util.emailtemplates.EmailGenerationRequest;

> printObj(a);

properties = com.cloupia.lib.util.emailtemplates.EmailGenerationRequest

  definition=,dataObject=,requestTime=Mar 01, 2018 03:10:43 UTC,templateId=,subjectDataObject=,templateName=]

  methods = setSubjectDataObject getDataObject getSubjectDataObject getDefinition setTemplateId getTemplateId setRequestTime getRequestTime setDefinition setTemplateName getTemplateName setDataObject

var g = new com.cloupia.lib.util.emailtemplates.wrappers.EmailContentForWorkflowWrapper;

  > printObj(g);

  properties = com.cloupia.lib.util.emailtemplates.wrappers.EmailContentForWorkflowWrapper

    [settings=,objects=,customDefinition=,entryId=0,handlerApproval=-1,currentStepIndex=0,handlerSubmission=-1]

    methods = getCurrentStepIndex getObjects setCustomDefinition getHandlerApproval getHandlerSubmission getCustomDefinition getEntryId setEntryId setSettings getSettings setObjects setHandlerApproval setHandlerSubmission

var c = new com.cloupia.service.cIM.inframgr.workflowmgr.WorkFlowObjects;

> printObj(c);

properties = com.cloupia.service.cIM.inframgr.workflowmgr.WorkFlowObjects

  [workFlow=,servcieRequest=,group=,vdc=,catalogItem=,submittingUser=,currentUser=,approvers=[],primaryApprovers=[],secondaryApprovers=[],trigger=]

  methods = getSubmittingUser setCatalogItem setSubmittingUser setCurrentUser getGroup getWorkFlow getCurrentUser getApprovers setApprovers getPrimaryApprovers setPrimaryApprovers getSecondaryApprovers setSecondaryApprovers setVdc getVdc setGroup getCatalogItem setServcieRequest setTrigger setWorkFlow getServcieRequest getTrigger

var d = new com.cloupia.lib.util.emailtemplates.EmailTemplateAPIFunctions;

> printObj(d);

properties = com.cloupia.lib.util.emailtemplates.EmailTemplateAPIFunctions

  []

  methods = getUserData getString getString getDate getVMVNicList sanitizeHtmlText getVMTerminationTime getNextRechargeDate formatTime getIp getVMList

15 Replies 15

Orf Gelbrich
Cisco Employee
Cisco Employee

So what are you trying to do?

I am looking to read in workflow variables either the inputs or the computed outputs and include them in the approval message to provide more context in the approval message.

Does #272 on the community site have the right idea?

https://communities.cisco.com/docs/DOC-64395

<facepalm>  Yes, that helps.  Thanks!

I'll poke around that some more to see if that lets met get to task outputs and not just user inputs.

Cool – I wasn’t sure if you had already exhausted that posting.

It looks like this works for getting workflow user inputs but it doesn't let you appear to snag workflow task outputs.  I was really hoping that if I had a task like custom_SomeTask and it had it's outputs, like custom_SomeTask.returned_data that I could reference "custom_SomeTask.returned_data" from the workflow but in the actual approval message.

I am still poking around but I think I am running out of rope on this one.

What happens when you create WF output variables and map your output from tasks to that?

Unless I am missing something, I'm not seeing a way to map outputs variables into the approval task.

Yes try a custom approval task

Use case is…

User provisions VM

Security approves it and enters the IP address for the to be provisioned VM

Workflow continues.

Ah, yeah, we're not quite looking for that.

This is more along the lines of:

1.  User requests a VM and gives it some attributes around RAM, CPU, location, applications to be installed

2.  Another custom workflow task runs some business logic to see if an approval should be required

3.  The CWT says yes, approval should be required and the workflow uses it to signal a request for approval

I'd like to have the approval message include more details about what was supplied/computed.  Today we send an email before the approval step giving all of the details.

I wouldn't be sending it back to someone to use the custom approval tasks to fill in attributes.  We've got a need to just say "here are all of the details, please approve/reject".

Will this work

https://communities.cisco.com/docs/DOC-64395

The DOC-64395 was got me further.  I can see inputs but I cannot see outputs from tasks.

I'll have a look see at 65844.

Yeah tasks probably not… unless you use the API call to get the SR log results..

That might be worth a shot.  I could probably output to the logs using something I can regex anchor on.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Cisco UCS X-Series Energy Efficiency Offer