Confluence has been updated to ver 6.15.9. In case of any troubles, please contact infra team.

auto create customfield

 
1
0
-1

Reading the source of CustomFieldSync.groovy you define a number of Closurers for handling Errors 
Closure<com.exalate.basic.domain.hubobject.v1.BasicHubCustomField> onNoCfFound,
Closure<com.exalate.basic.domain.hubobject.v1.BasicHubCustomField> onCfContextMismatch,
Closure<com.exalate.basic.domain.hubobject.v1.BasicHubOption> onNoOptionFound,
Closure<com.exalate.basic.domain.hubobject.v1.BasicHubUser> onNoUserFound,
Closure<com.exalate.basic.domain.hubobject.v1.BasicHubVersion> onNoVersionFound,

Do you have any examples of creating a closure for determining how to create the custom field for you if it does not exist?

You have a great example here for nfeed (https://docs.idalko.com/exalate/display/ED/How+to+sync+nfeed+fields+when+key+values+are+different) that can fetch the values required to populate the custom field.
Can this be expanded for singleselect, multiselect and cascadeselect custom fields?


You also have onNoUserFound Closure but this isn't propogated to the CreateIssue.groovy and UpdateIssue.groovy scripts so it isn't much use for creating (essentially non active) users.

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      We don't have that example in our toolbox.
      Is this cloud or server?


      1. Stephen Atkinson

        Hi Francis Martens (iDalko)I am working on Jira Server instances.

      2. Francis Martens (iDalko)

        Google is your frind :=) (I didn't validate)
        https://community.atlassian.com/t5/Answers-Developer-Questions/Create-Custom-Field-using-Groovy-Script/qaq-p/501997


        I think you should be able to craft the logic required
        Also check How to access a workload attribute provided by Tempo for an example who to access the services of an add-on (such as tempo)


        What is your use case?

      CommentAdd your comment...