1
0
-1

I would like to split the value of the Insight Field over the Select List (cascading field).


For example the value of my Insight Field is HelloThere, when it syncs over to the other instance, I would like Hello to be the first value in the select list, and There to be the second value in the select list.


Is this possible? What would the groovy look like for that?


Much appreciated. 

  1. Francis Martens (Exalate)

    I'm a bit confused about the question - is it about splitting a string, or about extracting a particular value from an Insight Field and put it in a select list.


  2. Francis Martens (Exalate)

    Hi Samuel Carter - can you check out my question?

  3. Samuel Carter

    Hi Francis Martens (Exalate),


    Apologies I missed your initial reply. 


    It's a bit of both. I want the value from the Insight Field to be extracted, and then split that value into the two sections of a cascading select list. 


    Does that make sense?


    Thanks,


    Sam

CommentAdd your comment...

1 answer

  1.  
    2
    1
    0

    We are experimenting with a customised Chatgpt chatbot - check out the details



    I would like to split the value of the Insight Field over the Select List (cascading field).For example the value of my Insight Field is HelloThere, when it syncs over to the other instance, I would like Hello to be the first value in the select list, and There to be the second value in the select list.Is this possible? What would the groovy look like for that?Much appreciated.


    Yes, it is indeed possible to split the value of your Insight Field over to a Select List (cascading field) in Jira Cloud. For instance, given that the value is "HelloThere" and you want to split it so "Hello" becomes the parent and "There" becomes a child option, you will need to configure both the Outgoing and Incoming sync as follows:

    1. First, configure the Outgoing sync to send your Insight field value:



    replica.customFields."InsightField" = issue.customFields."InsightField"


    2. Afterward, in the Incoming sync, you should extract the value from your Insight Field and form the parent-child select list values:

     
    
    
        def insightFieldValue = replica.customFields."InsightField".value
        def splitValues = insightFieldValue.split("(?<=Hello)")
        def parent = nodeHelper.getOption(issue, "Cascading select", splitValues[0])
        issue.customFields."Cascading select".value = nodeHelper.getCascadingSelect(parent, parent.childOptions.find{it.value == splitValues[1]})
    
    

    Note: In the split function, replace "Hello" with the actual parent value you expect in your use case.

    Make sure to replace "InsightField" and "Cascading select" with the actual field names in your case.

    This script will first split the Insight Field value into two parts based on your delimiter ("Hello" in this case). Then it retrieves the parent option and combines it with the child option to form the cascading select field value at the destination side.

    *Remember to check the sync scope and ensure you have permissions to access the custom fields. Also, the 'parent.childOptions.find' function expects the child option to exist; you might want to extend this script to handle the scenario when the child option doesn't exist.

    Find further details on handling custom fields sync in the Exalate documentation: https://docs.exalate.com/docs/how-to-sync-cascading-select-custom-fields-in-jira-cloud



    The insightfield has a structure and it is not necessarily 'value' that contains the value



    Indeed, an Insight custom field has a specific structure, which is not a simple 'value' but rather a set of items (objects) and attributes.

    The synchronization of Insight fields is done by assigning the string representation of the Insight object to a custom field on the replica. The same process applies on the destination side where we set the value of an Insight custom field equal to the value coming from the source.

    Here's an example of how to set a single Insight object to a target Insight custom field:

    Outgoing from Source Side:

    if(issue.customFields."Insight Field Name".value != null){
        replica.customFields."Insight Field Name" = issue.customFields."Insight Field Name".value.inspect()
    }



    Incoming to Destination Side:
    (note that that class is only valid on Jira On Premise)

    issue.customFields."Insight Field Name".value = com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade.loadObjectBean(replica.customFields."Insight Field Name".value)
    
    

    I should mention that the example I have given you here is a basic setup that only considers the primary object of the Insight field. If you have several objects or want to extract values from your Insight object’s attributes or references, you will need to adapt your script accordingly.

    Please check the Exalate documentation for more guidance on how to sync Insight custom fields: https://docs.exalate.com/docs/how-to-sync-insight-custom-fields





    1. Francis Martens (Exalate)

      This is an example of a response from a finetuned Chatgpt trained on the documentation of Exalate.  

    CommentAdd your comment...