Set assignee from a list of assignees and then create Jira issue in the current Sprint
Asked by Adrian M:

I have set up ConfiForms to create a Jira issue successfully. The form now needs to be modified to do the following on submit:

1. Pick a name from a list of assignees
2. Set that name to the assignee field
3. Create Jira issue in whatever is the current sprint

Example:

List of assignee names-

Assignee1  
Assignee2  
Assignee3

The following scenarios occur in sequence.

1. Scenario1- When UserA submits the form, set Assignee1 as value to the assignee field and create the Jira issue in the current Sprint
2. Scenario2- When UserB submits the form, set Assignee2 as value to the assignee field and create the Jira issue in the current Sprint
3. Scenario3- When UserA submits the form, set Assignee3 as value to the assignee field and create the Jira issue in the current Sprint
4. Scenario4- When UserC submits the form, set Assignee1 as value to the assignee field and create the Jira issue in the current Sprint
5. Scenario5- When UserA submits the form, set Assignee2 as value to the assignee field and create the Jira issue in the current Sprint

Appreciate any help or links to tutorials that can point me in the direction of setting this up.

Thanks


Answers:
author: Alex Medved _ConfiForms_
body: Hi

What is the current problem that you have with the form?

Not sure how to do the IF conditions or how to set the assignee?

Alex

comments: author: Adrian M
body: Hi Alex,

Currently the form creates a Jira issue wherein it sets the assignee field to one value that set in the form field definition.

I now need to set up a list of assignee names so that the form can rotate through it for each form submission from different users. The result would be a different assignee is set for each Jira issue.

To clarify, the assignee field is not to be selectable by the user. It should be hidden and the assignee field value should be picked up by iterating through a list of usernames and then set to the assignee field.

Hope I'm making myself clear.


author: Alex Medved _ConfiForms_
body: So, I believe you need to remember the assignee you have assigned (or have it as a sequence number) and then have an IF ELSE logic implemented to take the next

Create Jira IFTTT in ConfiForms supports Velocity templating - <https://wiki.vertuna.com/display/CONFIFORMS/Configuring+ConfiForms+IFTTT+actions+and+rules#ConfiguringConfiFormsIFTTTactionsandrules-CreateJiraIssue>

Which should help you with conditional logic


author: Adrian M
body: Hi Alex,

I can do the conditional logic. But I'm not clear on how to remember the assignee that was assigned for a User and then get the next name in the list for the next User of the form. Would you be able to let me know of any links on how to set that up?


author: Alex Medved _ConfiForms_
body: Hi

For to show how the rotation might be implemented (can be much simpler to check only count, but we try to find the actual last assignee)

Not a very elegant solution, but something to share from my side

Demo:

<http://recordit.co/CRrX7invYg>

Configuration in storage format

```
<ac:structured-macro ac:macro-id="93fb6b5d-3b95-4d00-b1d9-60af7ca07a1c" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">myform</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="fcd0c4e5-c1ea-4c69-bce0-645cf5ee9a37" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="formName">myform</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="a22603d9-bbb0-4b22-af16-ae650ab262f5" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">task</ac:parameter>
<ac:parameter ac:name="fieldLabel">Task</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
<ac:parameter ac:name="required">true</ac:parameter>
</ac:structured-macro>
</p>
<p>-- hide assignee for new records, this field will be assigned automatically</p>
<p>
<ac:structured-macro ac:macro-id="8507ea69-9c5c-44a5-9c22-7eee3117013a" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">id:[empty]</ac:parameter>
<ac:parameter ac:name="fieldName">assignee</ac:parameter>
<ac:parameter ac:name="action">Hide field</ac:parameter>
<ac:parameter ac:name="withReverseRule">true</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="02952c66-7a05-46a3-b072-6bd8bd26ab48" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">assignee</ac:parameter>
<ac:parameter ac:name="fieldLabel">assignee</ac:parameter>
<ac:parameter ac:name="values">false[1=Assignee 1|2=Assignee 2|3=Assignee 3|4=Assignee 4|5=Assignee 5|]</ac:parameter>
<ac:parameter ac:name="type">select</ac:parameter>
</ac:structured-macro>
</p>
<p>
<br/>
</p>
<p>for empty form or when last assignee from the list was set then switch to 1st assignee from the list</p>
<ac:structured-macro ac:macro-id="378147cd-db33-48fa-8618-1d981109cc89" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="condition">id.queryCount(myform:@self;*):1 OR id.queryAndSet(myform:@self;!assignee:[empty];assignee;created DESC LIMIT 1):5</ac:parameter>
<ac:parameter ac:name="extras3">true</ac:parameter>
<ac:parameter ac:name="extras4">true</ac:parameter>
<ac:parameter ac:name="action">Create ConfiForms Entry</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">entryId=[entry.id]&amp;assignee=1</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>-- for non empty form and if assignee is not yet set lookup previous/last value for assignee and assign it to current record, then trigger onmodified event that will add +1</p>
<ac:structured-macro ac:macro-id="e3c8153e-84f2-4852-9ab7-d92c80cf1e10" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="extras5">true</ac:parameter>
<ac:parameter ac:name="condition">assignee:[empty] AND id.queryCount(myform:@self;*):&gt;1</ac:parameter>
<ac:parameter ac:name="extras4">true</ac:parameter>
<ac:parameter ac:name="action">Create ConfiForms Entry</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">entryId=[entry.id]&amp;assignee=[entry.id.queryAndSet(myform:@self;!id:[entry.id];assignee;created DESC LIMIT 1)]</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>-- increments assignee nr</p>
<ac:structured-macro ac:macro-id="51e11535-6fa0-43f4-908f-b783412794c1" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="condition">id:[entry.id] AND !assignee:[empty]</ac:parameter>
<ac:parameter ac:name="extras3">true</ac:parameter>
<ac:parameter ac:name="extras4">true</ac:parameter>
<ac:parameter ac:name="action">Create ConfiForms Entry</ac:parameter>
<ac:parameter ac:name="event">onModified</ac:parameter>
<ac:parameter ac:name="title">entryId=[entry.id]&amp;assignee=[entry.assignee.add(1)]</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
<p>Data</p>
<ac:structured-macro ac:macro-id="071d3d44-3ce9-4b4d-9dac-57d9c95070ae" ac:name="confiform-table" ac:schema-version="1">
<ac:parameter ac:name="formName">myform</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="74c3f47d-e48b-4417-9465-899490cb8c25" ac:name="confiform-entry-edit" ac:schema-version="1">
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
```

Hope it helps

PS, probably I would approach this a bit differently another time and will use <https://wiki.vertuna.com/display/CONFIFORMS/Configuring+ConfiForms+IFTTT+actions+and+rules#ConfiguringConfiFormsIFTTTactionsandrules-GenerateNextNumber>

Alex


author: Alex Medved _ConfiForms_
body: Alternative example with secondary helper form and use of "Generate Next Number" IFTTT

```
<ac:structured-macro ac:macro-id="93fb6b5d-3b95-4d00-b1d9-60af7ca07a1c" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">myform</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="fcd0c4e5-c1ea-4c69-bce0-645cf5ee9a37" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="formName">myform</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="a22603d9-bbb0-4b22-af16-ae650ab262f5" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">task</ac:parameter>
<ac:parameter ac:name="fieldLabel">Task</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
<ac:parameter ac:name="required">true</ac:parameter>
</ac:structured-macro>
</p>
<p>-- hide assignee for new records, this field will be assigned automatically</p>
<p>
<ac:structured-macro ac:macro-id="8507ea69-9c5c-44a5-9c22-7eee3117013a" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">id:[empty]</ac:parameter>
<ac:parameter ac:name="fieldName">assignee</ac:parameter>
<ac:parameter ac:name="action">Hide field</ac:parameter>
<ac:parameter ac:name="withReverseRule">true</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="02952c66-7a05-46a3-b072-6bd8bd26ab48" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">assignee</ac:parameter>
<ac:parameter ac:name="fieldLabel">assignee</ac:parameter>
<ac:parameter ac:name="values">false[1=Assignee 1|2=Assignee 2|3=Assignee 3|4=Assignee 4|5=Assignee 5|]</ac:parameter>
<ac:parameter ac:name="type">select</ac:parameter>
</ac:structured-macro>
</p>
<p>
<br/>
</p>
<ac:structured-macro ac:macro-id="75d77500-9c38-448e-bf07-939f5d749c69" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="condition">id.queryCount(queue:@self;*):5</ac:parameter>
<ac:parameter ac:name="action">Delete ConfiForms Entry</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">*</ac:parameter>
<ac:parameter ac:name="who">queue:@self</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="3bba567c-00e2-42f8-9ccf-4ac34bc9c894" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="extras5">true</ac:parameter>
<ac:parameter ac:name="extras4">true</ac:parameter>
<ac:parameter ac:name="action">Create ConfiForms Entry</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">refId=[entry.id]</ac:parameter>
<ac:parameter ac:name="who">queue</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
<p>Data</p>
<ac:structured-macro ac:macro-id="071d3d44-3ce9-4b4d-9dac-57d9c95070ae" ac:name="confiform-table" ac:schema-version="1">
<ac:parameter ac:name="formName">myform</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="74c3f47d-e48b-4417-9465-899490cb8c25" ac:name="confiform-entry-edit" ac:schema-version="1">
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="e9602918-2189-4190-8a92-57bbc6847c86" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">queue</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="404fc3d7-865b-4a6c-bb14-e683ff28486f" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="action">Generate next number</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">assigneeNr</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:macro-id="b9c0b144-7f90-4a98-8d82-1a3f8b196029" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="condition">!refId:[empty]</ac:parameter>
<ac:parameter ac:name="action">Update ConfiForms entries by filter</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">assignee=[entry.assigneeNr]</ac:parameter>
<ac:parameter ac:name="extras2">id:[entry.refId]</ac:parameter>
<ac:parameter ac:name="who">myform:@self</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<br/>
</p>
<p>
<ac:structured-macro ac:macro-id="d24bcf86-2fe7-496a-a415-77c229322c80" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">assigneeNr</ac:parameter>
<ac:parameter ac:name="fieldLabel">assigneeNr</ac:parameter>
<ac:parameter ac:name="type">numberhidden</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="3ed1b599-4d37-474d-a4d2-1ea4755b2771" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">refId</ac:parameter>
<ac:parameter ac:name="fieldLabel">Ref id (to update record back with assignee nr)</ac:parameter>
<ac:parameter ac:name="type">hidden</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>
```

Let me know if the storage format is not possible to import in your instance and I can provide a short video showcasing the parameters

Alex


author: Adrian M
body: Thanks Alex, I'm not able to use the Storage Format editor as I don't see that option. I tried to recreate the form by reading the above file but I cant find the confiform edit macro.

Appreciate if you could provide me a link to the video showing the parameters. Thanks


author: Alex Medved _ConfiForms_
body: This is very sad to hear that you are missing the storage format editor, as this is the best way to share and import the configurations -\> no need to recreate anything

There is a video in my previous comment

But here it is for the second option: <http://recordit.co/Kpm7eb5GpY>

PS, "confiform edit macro" is the (configuration) key for ConfiForms Edit Controls macro

Alex


author: Adrian M
body: I duplicated the form of the second version by watching the video but couldn't get it to work. Each task entry is saved but assignee does not get set (no value is set) in the record.

The only difference I found was that in my version the IFTTT integration rules (in the queue form) for OnCreated event shows 'Generate next number (experimental)' Unlike in the recording where it does not say 'experimental'. Not sure if that is the issue. But thanks for all the help.


Tags: confiforms

confluence-server

server