UI Kit JSM Portal Create Property Panel app--Can I relate the data I collect on my custom form with the ticket created?

When building a Forge UI Kit app in the JSM Portal, create property panel, you can put fields on the form in the UI Kit form and see the values when the user submits it, but can you relate those values to the JSM portal ticket that is then created? I can’t figure out if/how the JSM portal returns a ticket number to the Forge app when it is submitted. Is that possible?

Hi @EricKruegerStrataCom,

You can get the value and property key in the extensionContext from the jiraServiceManagement:portalRequestDetail module.

For more context, I added jiraServiceManagement:portalRequestDetail in the manifest file, like this

modules:
  jiraServiceManagement:portalRequestCreatePropertyPanel:
    - key: f-jsm-property-panel-hello-world-panel
      function: main
      title: f-jsm-property-panel
  jiraServiceManagement:portalRequestDetail:
    - key: f-portal-detail
      function: portal-detail
      title: This is the portal detail
  function:
    - key: main
      handler: index.run
    - key: portal-detail
      handler: index.portalDetail

Next, I defined the function module.

const PortalDetailApp = () => {
  const {extensionContext: myExtensionContext} = useProductContext();

  console.log(JSON.stringify(myExtensionContext));

  return(
    <PortalRequestDetail>
      <Text>
        Hello text {JSON.stringify(myExtensionContext)}
      </Text>      
    </PortalRequestDetail>

  );
}

export const portalDetail = render(<PortalDetailApp />);

After creating the request, you will be redirected to the request’s portal view and in the logs you will see something like the one below wherein you can reference the newly created ticket, the entity property key, as well as the fields and values from your PortalRequestCreatePropertyPanel

{
    "accountId": "xyz",
    "accountType": "licensed",
    ...
    "extensionContext":
    {
        "type": "jiraServiceManagement:portalRequestDetail",
        "portal":
        {
            "id": 5
        },
        "request":
        {
            "typeId": 10028,
            "key": "TMJ-4",
            "properties":
            {
                "key": "f22a1bcb-1e5e-4349-b012-e96d84005e2d",
                "value":
                {
                    "fields":
                    [
                        {
                            "key": "textarea_1",
                            "value": "This is the value"
                        }
                    ],
                    "isValid": true
                }
            }
        }
    },
    "moduleKey": "f-portal-detail"
}

Hope this helps.

Ian

1 Like

Hi @iragudo,

We noticed that both a customer user and an unlicensed user can create issues. However, on the ‘jiraServiceManagement:portalRequestDetail’ view, we don’t receive the ‘properties’ key in the extensionContext. But when an agent opens the same issue created by the customer, we can retrieve all the data, including the properties. Is this a bug?
here is configured in the yaml:
Capture d’écran 2023-09-15 à 12.37.31

Thanks,
Zelihan

This worked as expected. I guess the part I’m stuck on is how to save the custom fields to the JSM ticket that is created. It doesn’t appear that we have access to the JSM ticket until the portalDetail panel? If that’s the case, how can we save the values in the custom fields in the ticket on ticket create using the portal request create property panel? Or is that not possible and they must be saved on the portalDetail panel? Thanks for all your help…

Saving the values is done during request creation and the values are saved in Jira entity properties. If the question is how to display these values in the issue view (and not in the portal request view), one of the routes to take is getting the values via Get issue property and displaying them in an issue context.

Cheers,
Ian

OK, I actually see what’s going on now. I was using a ‘form’ inside the form and that definitely does not work like the example that gets installed when you create a new forge app. The ‘form’ definitely adds confusion also, as it adds an extra ‘submit’ button also.

1 Like

Hello @choulledigital,

I reached out to the team who’s familiar with this and it is possible that it is not behaving as expected. In order to progress and keep track of the investigation, kindly raise a bug request in this portal.

Cheers,
Ian

1 Like