02-28-2018 08:16 PM - edited 03-01-2019 06:27 AM
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
02-28-2018 09:52 PM
So what are you trying to do?
03-01-2018 05:47 AM
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.
03-01-2018 06:11 AM
Does #272 on the community site have the right idea?
https://communities.cisco.com/docs/DOC-64395
03-01-2018 06:22 AM
<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.
03-01-2018 06:51 AM
Cool – I wasn’t sure if you had already exhausted that posting.
03-02-2018 09:11 AM
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.
03-02-2018 09:23 AM
What happens when you create WF output variables and map your output from tasks to that?
03-06-2018 07:18 AM
Unless I am missing something, I'm not seeing a way to map outputs variables into the approval task.
03-06-2018 07:32 AM
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.
03-06-2018 07:40 AM
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".
03-06-2018 07:49 AM
Will this work
https://communities.cisco.com/docs/DOC-64395
03-06-2018 08:45 AM
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.
03-06-2018 08:47 AM
Yeah tasks probably not… unless you use the API call to get the SR log results..
03-06-2018 08:50 AM
That might be worth a shot. I could probably output to the logs using something I can regex anchor on.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide