PromptUser
Node Action:
This node action provides a mechanism for implementers to create custom user interfaces and interactions as part of a client side workflow.
Parameters:
se_type
PromptUser
se_type = PromptUser
se_cardTemplate
Customizable Adaptive Card template in JSON format. Refer to the documentation for available adaptive card options, https://adaptivecards.io/.
se_determineCardData
Lambda expression used to support loading external data into the adaptive card engine.
se_promptCaption
Caption used in the title bar of the adaptive card dialogue.
se_determinePromptCaption
Lambda expression used to derive the caption of the adaptive card dialogue from data in the workflow.
se_resultVariable
Name of the result variable to store the data from the node action.
Example:
Prompt User: The following illustrates the use of the Prompt User node action to request a reassign reason from a user to supply as part of the session history:
digraph workflow {
entry[
label = "Reassign Button"
se_type0 = MultiSessionOperationTrigger
se_displayName0 = "Reassign With Reason"
se_sortOrder0 = 10
se_visibilityCondition0 = "(ctx, log) => {
return ((IEnumerable<dynamic>)ctx.Event.assignments).All(a => a.assignedTo == ctx.User.UserId) && ctx.Event.isSessionOpen == false;
}"
se_type1 = SessionOperationTrigger
se_displayName1 = "Reassign With Reason"
se_sortOrder1 = 50
se_visibilityCondition1 = "(ctx, log) => {
return ctx.Event.assignment.assignedTo == ctx.User.UserId && ctx.Event.isSessionOpen == false;
}"
se_type2 = Action,
se_action2 = "(ctx, log) => {
if(ctx.Event.assignments != null)
{
ctx.State.Assignments = ctx.Event.assignments;
}
else
{
ctx.State.Assignments = new[] {ctx.Event.assignment};
}
}",
]
selectUser[
se_type0 = UserPickList,
se_resultVariable0 = SelectedUser
]
supplyReason[
se_type0 = PromptUser,
se_resultVariable0 = Reason,
se_promptCaption0 = "Reassign Reason",
se_cardTemplate0 = "{
\"$schema\": \"http://adaptivecards.io/schemas/adaptive-card.json\",
\"type\": \"AdaptiveCard\",
\"version\": \"1.3\",
\"body\": [
{
\"type\": \"Input.Text\",
\"style\": \"text\",
\"id\": \"ReasonTB\",
\"label\": \"Reassign Reason\",
\"isRequired\": true,
},
{
\"type\": \"ActionSet\",
\"actions\": [
{
\"type\": \"Action.Submit\",
\"title\": \"OK\",
\"style\": \"positive\",
\"role\": \"Button\"
},
{
\"type\": \"Action.Submit\",
\"title\": \"Cancel\",
\"style\": \"positive\",
\"role\": \"Button\"
}
]
},
]
}",
se_type1 = CopyToClipboard,
se_determineData1 = "(ctx, log) => {
return JsonConvert.SerializeObject(ctx.State.Reason);
}",
]
reassign[
se_executionOrder = ForEach
se_forEachEnumerable = Assignments
se_type0 = Api,
se_method0 = POST
se_modifyRequest0 = "(request, ctx, log) => {
//request.RequestUri = new Uri($\"api/v1/assignments/{ctx.State.__currentForEachItem.id}/assign?to={ctx.State.SelectedUser}&auditNote=Just%20Because\", UriKind.RelativeOrAbsolute);
request.RequestUri = new Uri($\"api/v1/assignments/{ctx.State.__currentForEachItem.id}/assign?to={ctx.State.SelectedUser}&auditNote={ctx.State.Reason.userInputs.ReasonTB}\", UriKind.RelativeOrAbsolute);
}",
se_resultVariable0 = newAssignment
se_service0 = Editor
]
unassign[
se_executionOrder = ForEach
se_forEachEnumerable = Assignments
se_type0 = Api,
se_method0 = POST
se_modifyRequest0 = "(request, ctx, log) => {
request.RequestUri = new Uri($\"api/v1/assignments/{ctx.State.__currentForEachItem.id}/unassign?&auditNote={ctx.State.Reason.userInputs.ReasonTB}\", UriKind.RelativeOrAbsolute);
//request.Content = new StringContent(JsonConvert.SerializeObject(body), Encoding.UTF8, \"application/json\");
}",
se_resultVariable0 = newAssignment
se_service0 = Editor
]
notifyUser[
label = "Notify user"
se_type0 = NotifyUser,
se_determineMessage0 = "(ctx, log) => {
return ctx.State.NotifyUserText;
}",
se_notificationType0 = "Information",
se_showToast0 = true
se_type1 = RefreshMyJobsList,
se_type2 = RefreshAvailableJobsList,
]
exit[
shape=invhouse,
color="#22FF44",
style=filled
]
entry->supplyReason;
supplyReason->selectUser;
selectUser->reassign[
se_type = Condition,
se_condition = "(ctx, log) => {
var result = ctx.State.SelectedUser != null && ctx.State.SelectedUser != Guid.Empty.ToString();
if(result)
{
ctx.State.NotifyUserText = $\"All the selected sessions now belong to {ctx.State.SelectedUser}.\";
}
return result;
}"
]
selectUser->unassign[
se_type = Condition,
se_condition = "(ctx, log) => {
var result = ctx.State.SelectedUser != null && ctx.State.SelectedUser == Guid.Empty.ToString();
if(result)
{
ctx.State.NotifyUserText = $\"All the selected sessions are now unassigned.\";
}
return result;
}"
]
selectUser->exit[
se_type = Condition,
se_condition = "(ctx, log) => {
return ctx.State.SelectedUser == null;
}"
]
unassign->notifyUser;
reassign->notifyUser;
notifyUser->exit
}
View Queried Session Assignments: The following example details the use of incorporating assignment data from the determineCardData lambda into an 'Input.ChoiceSet' combo box.
presentAssignments[
se_type0 = PromptUser,
se_resultVariable0 = "SelectedAction",
se_promptCaption0 = "View Selected Assignments",
se_cardTemplate0 = "{
\"$schema\": \"http://adaptivecards.io/schemas/adaptive-card.json\",
\"type\": \"AdaptiveCard\",
\"version\": \"1.3\",
\"body\": [
{
\"type\": \"Input.ChoiceSet\",
\"id\": \"ChosenUserIndex\",
\"choices\": [
{
\"title\": \"${associatedSession.shortName} - ${associatedSession.versionName}\",
\"value\": \"${associatedSession.versionName}\",
\"$data\": \"${assignments}\"
}
]
},
{
\"type\": \"ActionSet\",
\"actions\": [
{
\"type\": \"Action.Submit\",
\"title\": \"OK\",
\"style\": \"positive\",
\"role\": \"Button\"
},
{
\"type\": \"Action.Submit\",
\"title\": \"Cancel\",
\"style\": \"positive\",
\"role\": \"Button\"
}
]
}
]
}",
se_determineCardData0 = "(ctx, msLogger) => {
var assignments = ctx.State.AllAssignments;
for(var i = 0; i < assignments.Count; i++){
var assignment = assignments[i];
if(assignment.associatedSession.name.ToString().Length > 25){
assignment.associatedSession.shortName = assignment.associatedSession.name.ToString().Substring(0,25);
assignments[i] = assignment;
}
else{
assignment.associatedSession.shortName = assignment.associatedSession.name.ToString();
}
}
var data = new Dictionary<string, IEnumerable<object>>{{\"assignments\", assignments}};
return JToken.FromObject(data);
}",
]