Display values of fields with another field

sai kumar October 19, 2023

I have form which has text field, checkbox group, dropdown.

when user  enter text and select options from dropdown and check box fields

I want to display text on the form

Ex:

Name: Test

List: list1

Platform: Linux

display text  with concatenate the fields  List-platform-Name

display text  as list1-Linux-Test

this is should be displayed before submit the form

I tried with fieldname and type as formula and concatenating the strings

but seems not working as expected.

 

 

1 answer

0 votes
Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 19, 2023

Hi @sai kumar 

Is this about some plugin you are using... may be ConfiForms related? (just guessing, as the question unfortunately mentions nothing about the context)

Alex

sai kumar October 20, 2023

HI Alex, 

Its about ConfiForms

Here is the fields defined:

Name(text Field): 

Env(dropdown): Dev,Stage,Prod

Platform(checkbox-group): Linux, windows

When user inputs Name, and selected the options from Env and Platform,

On confiform I would like to display like

Ex: Dev-Linux-Server1 (if Linux Platform selected)

      Dev-Windows-Server1 ((if Windows Platform selected)

 

I tried to use  field type formula to display it by given expression 

(CONCAT("[entry.Env.Label]","-""[entry.Platform.label]","-","[entry.Name]"))

It seems it will update the field value after submitting the form. Can we get it before submitting the form.

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 20, 2023

OK, thanks for clarifying that it is about ConfiForms, will add a label, at least to make it clearer...

Formula fields are calculated after submit, but you can set up a rule to calculate on the form - https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Field+Definition+Rules#ConfiFormsFieldDefinitionRules-Setexpression

Alex

sai kumar October 24, 2023

Hi Alex, thanks for the response. with my modifications on form,  no longer required to select platform, when the user enters the Name  Ex: test-server,

I want to pass two entries, like, Dev-Windows-TestServer, Dev-Unix-TestServer, to Jira

by manipulating the input value at Name.

I did for showfunction.

function showValueFunc5(formName, formId) { // never execute it in edit mode

if (isPageViewMode()) {

var name=AJS.$(formName).find('#i_Name').val().replace('-',' ').replace(/ {1,}/g," ");

function toUpper(str) {

return str

.toLowerCase()

.split(' ')

.map(function(word) { return word[0].toUpperCase() + word.substr(1); })

.join('');

}

var entitiyname=toUpper(name)

var result if(name){      

var result = window.confirm("Name: "+name+"\n Windows: Dev-Windows"+entitiyname+"\nLinux: Dev-Linux"+entityname); 

} else {

var result = window.confirm("Name: "+name); }   

if (result == true){

showSaveButton();

} else {

AJS.$(formName).find('#i_s').prop('checked', false); hideSaveButton();

}

}

}

Show function display the popup window and shows the values like this.

Name: test-server

Windows: Dev-Windows-TestServer

Linux: Dev-Linux-TestServer

 

I would like to pass values "Dev-Windows-TestServer" and "Dev-Linux-TestServer" Jira, 

Is there a way to manipulate Name value from test-server to TestServer in IFTTT steps.  As I saw discussion on javascript is not work with in it.

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 24, 2023

You can manipulate and transform the values with the help of these virtual functions https://wiki.vertuna.com/display/CONFIFORMS/Virtual+functions

sai kumar October 24, 2023

Hi Alex, 

I am trying to declare the variables and pass the values Jira.

#set($value = "checkout -- hello")

#if($value)

#set $app=$value.replace(/[\W_]+/g," ")

#set $app=${StringUtils.removeAndHump(${app}, " ")

#set Servers="*Windows :*Dev-Windows-${app} \nLinux: Dev-Linux-${app}" #end "description":"*Feature :* checkout-hello3\n $Apps " } }'.

I am getting the below error.

Can't we define the variable and pass it to Jira.

Invalid format. Unterminated string at 215 [character 0 line 9]

Here is my IFTTT code

ac:structured-macro ac:macro-id="d079499b-a19c-49c6-971d-e005ffb7aef2" ac:name="confiform-ifttt" ac:schema-version="1">
                <ac:parameter ac:name="action">Create JIRA Issue</ac:parameter>
                <ac:parameter ac:name="event">onCreated</ac:parameter>
                <ac:rich-text-body>
                  <p class="auto-cursor-target">
                    <br/>
                  </p>
                  <ac:structured-macro ac:macro-id="7c70c0be-064d-4b30-a73d-0c885f8b10ef" ac:name="noformat" ac:schema-version="1">
                    <ac:plain-text-body><![CDATA[{
"fields" :
{
"project": {"key": "TestProj"},
"issuetype": {"name": "Request"},
"customfield_14362": [{"value": "TestServ"}],
  "labels" : ["Create-TestServers"],
    "summary": "Create TestServers
for the feature [entry.Feature]",
#set($value = "[entry.Feature]")
     #if($value)

         #set $app=$value.replace(/[\W_]+/g," ")

        #set $app=${StringUtils.removeAndHump(${app}, " ")

#end
       "description":"*GitBranch:* [entry.branch]\n*Feature :* [entry.Feature]\n $value"
   }
}]]></ac:plain-text-body>
                  </ac:structured-macro>

Can't we use velocity template syntaxes in IFTTT code.

Ex: convert this "checkout -- hello" to Checkout-Hello

Thanks

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 24, 2023

This is overly complicated for no reason in my opinion

Instead of Velocity scripting in that scale please consider using the https://wiki.vertuna.com/display/CONFIFORMS/Virtual+functions to transform the values as needed

Alex

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events