Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Confiforms: String Functions (e.g. substring) when setting values

Dan August 15, 2023

New to Confluence - so thanks in advance for any info (or redirection to documentation) that anyone can provide.

When setting values using Confiforms Rules for Field Definition, how can I perform string functions? Is there any documentation?

e.g. in my Values to Set:

IssueDescription=[entry.original_description]


I want to perform a substring, possibly using regular expressions, on the original description.

Thanks again!

1 answer

1 accepted

0 votes
Answer accepted
Alex Medved _ConfiForms_
Community Champion
August 15, 2023

Hi @Dan 

You can see what functions are available in ConfiForms here - https://wiki.vertuna.com/display/CONFIFORMS/Virtual+functions

Alex

Dan August 16, 2023

Thanks - it seems that the string manipulation functions are very minimal? Any thoughts on how I could readily extract the third word or phrase from the below string using virtual functions?

|Foo|Bar|Bah - I want this piece|Bat|

 Thanks again!

Alex Medved _ConfiForms_
Community Champion
August 16, 2023

You can always have a custom call to a JavaScript function if you are using the server/dc version and JavaScript support is not disabled by your admins

Here is a demo with "minimal string manipulation functions" - http://recordit.co/jEk8c627Hs

Alex

Like Dan likes this
Dan August 16, 2023

Yes, I'm exploring that front too. The string manipulation part is easy, but the impediment I'm hitting on that side is that I don't know how to set all types of ConfiForms Form Field Definitions from javascript. I can set (and query) using:

AJS.$('#' + formId).find('#i_fieldToUpdate').val(valueToSet)

The above works for "text" and "textarea" field types, but the val() function seems to not work for the "Jira Issue" or "Dropdown" types. Which is ultimately what I'm trying to get to. Is there a list of AJS javascript functions and what they return for each field type? Or am I taking the wrong route there and there's a better javascript way?

Thanks yet again!

ps. I can't follow the recordit dot co link from inside work, but I'll check it out later.

Like Dan likes this
Dan August 18, 2023

Third impediment: cfSetValue, cfSetValueWithEventPropagation, cfAddFieldRequired, etc.  absolutely do not work :D. I have a ticket in with our Atlassian tooling group to see what's up. Thanks again for all your suggestions and time!

Alex Medved _ConfiForms_
Community Champion
August 18, 2023

The only reason I can think of functions "absolutely do not work" is that you are using some old version of ConfiForms plugin or your admins have disabled support for JavaScript functions

Alex

Like Dan likes this
Dan August 18, 2023

There's always a non-zero chance it's user error - and that would be the preferred reason by far.

Dan September 21, 2023

Follow-up: Our production version of ConfiForms is indeed old - like positively ancient. Enablement is currently moving a more current version through performance acceptance testing and the code (and everything else discussed above) works great in the PAT environment. Thanks for your help :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events