Skip to content

Commit

Permalink
Using Forms in Workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
iam-sharvari committed Jan 25, 2024
1 parent 2b866d5 commit d542bd7
Show file tree
Hide file tree
Showing 6 changed files with 1,129 additions and 0 deletions.
176 changes: 176 additions & 0 deletions workflows/assign-roles-using-forms/Assign Roles via Form.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
{
"id": "57e25357-e5d5-4ba0-a6ac-d3bb6520731d",
"name": "Assign Roles",
"description": "Assign Roles",
"owner": {
"type": "IDENTITY",
"id": "bcae0dce3d7f4dac827e7853835882d1"
},
"usedBy": [],
"formInput": [
{
"id": "employeeNumber",
"type": "STRING",
"label": "Employee Number",
"description": "Employee Number"
},
{
"id": "employeeName",
"type": "STRING",
"label": "Employee Name",
"description": "Employee Name"
}
],
"formElements": [
{
"id": "910277720848",
"elementType": "SECTION",
"config": {
"alignment": "LEFT",
"description": "",
"formElements": [
{
"config": {
"default": "",
"description": "",
"helpText": "",
"label": "Employee Number",
"placeholder": "",
"required": false
},
"elementType": "TEXT",
"id": "1545094594991",
"key": "employeeNumber",
"validations": []
},
{
"config": {
"default": "",
"description": "",
"helpText": "",
"label": "Employee Name",
"placeholder": "",
"required": false
},
"elementType": "TEXT",
"id": "521341509460",
"key": "employeeName",
"validations": []
},
{
"config": {
"dataSource": {
"config": {
"objectType": "ROLE"
},
"dataSourceType": "INTERNAL"
},
"forceSelect": true,
"helpText": "Select the roles you wish to assign from the list below",
"label": "Select Roles",
"maximum": 3,
"placeholder": "Role Name",
"required": true
},
"elementType": "SELECT",
"id": "517197279797",
"key": "selectRoles",
"validations": [
{
"validationType": "REQUIRED"
}
]
}
],
"label": "Role Assignment",
"labelStyle": "h2",
"showLabel": true
},
"validations": []
}
],
"formConditions": [
{
"ruleOperator": "AND",
"rules": [
{
"sourceType": "INPUT",
"source": "Employee Number",
"operator": "EM",
"valueType": "STRING",
"value": ""
}
],
"effects": [
{
"effectType": "DISABLE",
"config": {
"element": "521341509460"
}
},
{
"effectType": "DISABLE",
"config": {
"element": "517197279797"
}
}
]
},
{
"ruleOperator": "AND",
"rules": [
{
"sourceType": "INPUT",
"source": "Employee Number",
"operator": "NOT_EM",
"valueType": "STRING",
"value": ""
}
],
"effects": [
{
"effectType": "SET_DEFAULT_VALUE",
"config": {
"defaultValueLabel": "Employee Number",
"element": "1545094594991"
}
},
{
"effectType": "DISABLE",
"config": {
"element": "1545094594991"
}
}
]
},
{
"ruleOperator": "AND",
"rules": [
{
"sourceType": "INPUT",
"source": "Employee Name",
"operator": "NOT_EM",
"valueType": "STRING",
"value": ""
}
],
"effects": [
{
"effectType": "SET_DEFAULT_VALUE",
"config": {
"defaultValueLabel": "Employee Name",
"element": "521341509460"
}
},
{
"effectType": "DISABLE",
"config": {
"element": "521341509460"
}
}
]
}
],
"created": "2023-11-06T10:47:24.875353142Z",
"modified": "2024-01-10T03:14:32.648826623Z"
}
103 changes: 103 additions & 0 deletions workflows/assign-roles-using-forms/AssignRolesviaForms.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"name": "Assign Roles via Forms",
"description": "Assign Roles to a user via Forms Selection",
"definition": {
"start": "Form",
"steps": {
"End Step — Success": {
"type": "success"
},
"Form": {
"actionId": "sp:forms",
"attributes": {
"deadline": "7d",
"formDefinitionId": "57e25357-e5d5-4ba0-a6ac-d3bb6520731d",
"inputForForm_employeeName.$": "$.trigger.attributes.displayName",
"inputForForm_employeeNumber.$": "$.trigger.attributes.employeeNumber",
"notificationBody": "Hi,<br/><br/>Please use this form to assign additional roles to user - {{$.trigger.attributes.displayName}}. <br/><br/>Regards,<br/>IAM Team",
"notificationSubject": "Action: Role Assignment Required",
"recipient": "bcae0dce3d7f4dac827e7853835882d1",
"reminder": "2d",
"reminderBody": "Hi,<br/><br/>Please use this form to assign additional roles to user - {{$.trigger.attributes.displayName}}. <br/><br/>Regards,<br/>IAM Team"
},
"description": "Form sent to Manager to select Role Assignemnt for user",
"nextStep": "Send Email",
"type": "action",
"versionNumber": 1
},
"Get Identity": {
"actionId": "sp:get-identity",
"attributes": {
"id.$": "$.getListOfIdentities.identities[0].id"
},
"nextStep": "Loop",
"type": "action",
"versionNumber": 2
},
"Get List of Identities": {
"actionId": "sp:get-identities",
"attributes": {
"inputQuery": "attributes.identificationNumber.exact:{{$.form.formData.employeeNumber}}",
"searchBy": "searchQuery"
},
"nextStep": "Get Identity",
"type": "action",
"versionNumber": 2
},
"Loop": {
"actionId": "sp:loop:iterator",
"attributes": {
"context.$": "$.getIdentity",
"input.$": "$.form.formData.selectRoles",
"start": "Manage Access",
"steps": {
"End Step — Success 1": {
"type": "success"
},
"Manage Access": {
"actionId": "sp:access:manage",
"attributes": {
"addIdentities.$": "$.loop.context.id",
"comments": "Providing additional access",
"removeIdentity.$": "$.getIdentity.id",
"requestType": "GRANT_ACCESS",
"requestedItems": [
{
"id": "{{$.loop.loopInput}}",
"type": "ROLE"
}
]
},
"nextStep": "End Step — Success 1",
"type": "action",
"versionNumber": 1
}
}
},
"nextStep": "End Step — Success",
"type": "action",
"versionNumber": 1
},
"Send Email": {
"actionId": "sp:send-email",
"attributes": {
"body": "{{$.form.formData.selectRoles}}",
"context": {},
"recipientEmailList": [
"[email protected]"
],
"subject": "Form Data"
},
"nextStep": "Get List of Identities",
"type": "action",
"versionNumber": 2
}
}
},
"trigger": {
"type": "EVENT",
"attributes": {
"id": "idn:identity-created"
}
}
}
5 changes: 5 additions & 0 deletions workflows/assign-roles-using-forms/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Assign Roles using Forms

This workflow sends a form to the manager for selecting roles that can/need to be added to a new hire user. Once he submits the form, tho selected roles are provisioned to the user. If there is no approval scheme setup they will be auto approved and provisioned. If there is an approval scheme defined for the roles, an access request will be started and notification will be sent out to the first approver. Once access request is approved, the role will be provisioned.

Please modify the receipient email address in Send Email action in the workflow.
5 changes: 5 additions & 0 deletions workflows/new-hire-additional-info/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
New Hire Additional Info

This workflow sends an onboarding form to the manager for filing in additional info about a new hire. This workflow demonstrates the use of all types pf Form attributes, it's Input and Conditions.

Please modify the Form receipient and the receipent email address in the Send Email action.
Loading

0 comments on commit d542bd7

Please sign in to comment.